gl_image_ref_counted_memory.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef UI_GL_GL_IMAGE_REF_COUNTED_MEMORY_H_
  5. #define UI_GL_GL_IMAGE_REF_COUNTED_MEMORY_H_
  6. #include <stdint.h>
  7. #include "base/memory/ref_counted.h"
  8. #include "ui/gl/gl_export.h"
  9. #include "ui/gl/gl_image_memory.h"
  10. namespace base {
  11. class RefCountedMemory;
  12. }
  13. namespace gl {
  14. class GL_EXPORT GLImageRefCountedMemory : public GLImageMemory {
  15. public:
  16. explicit GLImageRefCountedMemory(const gfx::Size& size);
  17. GLImageRefCountedMemory(const GLImageRefCountedMemory&) = delete;
  18. GLImageRefCountedMemory& operator=(const GLImageRefCountedMemory&) = delete;
  19. bool Initialize(base::RefCountedMemory* ref_counted_memory,
  20. gfx::BufferFormat format);
  21. // Overridden from GLImage:
  22. void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
  23. uint64_t process_tracing_id,
  24. const std::string& dump_name) override;
  25. protected:
  26. ~GLImageRefCountedMemory() override;
  27. private:
  28. scoped_refptr<base::RefCountedMemory> ref_counted_memory_;
  29. };
  30. } // namespace gl
  31. #endif // UI_GL_GL_IMAGE_REF_COUNTED_MEMORY_H_