Chromium Code Reviews| Index: content/renderer/gpu/compositor_software_output_device.h |
| diff --git a/content/renderer/gpu/compositor_software_output_device.h b/content/renderer/gpu/compositor_software_output_device.h |
| index b82ffe2dd5463940ef2d8f60a3885bfc4deda332..7c4f65ca2d588a22c571173126271e494b879606 100644 |
| --- a/content/renderer/gpu/compositor_software_output_device.h |
| +++ b/content/renderer/gpu/compositor_software_output_device.h |
| @@ -5,11 +5,16 @@ |
| #ifndef CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_H_ |
| #define CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_H_ |
| +#include "base/memory/scoped_ptr.h" |
| #include "base/memory/scoped_vector.h" |
| +#include "base/memory/shared_memory.h" |
| #include "base/threading/non_thread_safe.h" |
| #include "cc/output/software_output_device.h" |
| +#include "content/public/renderer/render_thread.h" |
| #include "third_party/skia/include/core/SkBitmap.h" |
| +class SkRegion; |
| + |
| namespace content { |
| // This class can be created only on the main thread, but then becomes pinned |
| @@ -26,43 +31,59 @@ public: |
| virtual SkCanvas* BeginPaint(gfx::Rect damage_rect) OVERRIDE; |
| virtual void EndPaint(cc::SoftwareFrameData* frame_data) OVERRIDE; |
| - virtual void ReclaimDIB(const TransportDIB::Id& id) OVERRIDE; |
| + virtual void ReclaimSoftwareFrame(int id) OVERRIDE; |
| private: |
| - class DIB { |
| + class Buffer { |
| public: |
| - explicit DIB(size_t size); |
| - ~DIB(); |
| + explicit Buffer(int id, scoped_ptr<base::SharedMemory> mem); |
| + ~Buffer(); |
| - TransportDIB* dib() const { |
| - return dib_; |
| - } |
| + int id() const { return id_; } |
| + |
| + void* memory() const { return mem_->memory(); } |
| + base::SharedMemoryHandle handle() const { return mem_->handle(); } |
| + |
| + bool free() const { return free_; } |
| + void SetFree(bool free) { free_ = free; } |
| + |
| + Buffer* parent() const { return parent_; } |
| + void SetParent(Buffer* parent, const gfx::Rect& damage); |
|
piman
2013/05/28 20:58:57
The "parenting" relationship could use an explanat
slavi
2013/05/29 18:31:48
Done.
|
| + |
| + bool FindDamageDifferenceFrom(Buffer* buffer, SkRegion* result) const; |
| private: |
| - TransportDIB* dib_; |
| + const int id_; |
| + scoped_ptr<base::SharedMemory> mem_; |
| + bool free_; |
| + Buffer* parent_; |
| + gfx::Rect damage_; |
| - DISALLOW_COPY_AND_ASSIGN(DIB); |
| + DISALLOW_COPY_AND_ASSIGN(Buffer); |
| }; |
| class CompareById { |
| public: |
| - CompareById(const TransportDIB::Id& id) : id_(id) {} |
| + CompareById(int id) : id_(id) {} |
| - bool operator()(const DIB* dib) const { |
| - return dib->dib() && dib->dib()->id() == id_; |
| + bool operator()(const Buffer* buffer) const { |
| + return buffer->id() == id_; |
| } |
| private: |
| - TransportDIB::Id id_; |
| + const int id_; |
| }; |
| - DIB* CreateDIB(); |
| + int GetNextId(); |
| + Buffer* CreateBuffer(); |
| + int FindFreeBuffer(int hint); |
| - int front_buffer_; |
| - int num_free_buffers_; |
| - ScopedVector<DIB> dibs_; |
| - ScopedVector<DIB> awaiting_ack_; |
| + int current_index_; |
| + int next_buffer_id_; |
| + ScopedVector<Buffer> buffers_; |
| + ScopedVector<Buffer> awaiting_ack_; |
| SkBitmap bitmap_; |
| + RenderThread* render_thread_; |
| }; |
| } // namespace content |