Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Unified Diff: content/renderer/gpu/compositor_software_output_device.h

Issue 15001027: [Aura] Added Support for rendering software compositor frames as cc::TextureLayers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..194c1ed4fe886c66450b2bbdd3df7098261af2e5 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,63 @@ 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 {
+ // Internal buffer class that manages shared memory lifetime and ownership.
+ // It also tracks buffers' history so we can calculate what's the minimum
+ // damage rect difference between any two given buffers (see SetParent and
+ // FindDamageDifferenceFrom).
+ class Buffer {
public:
- explicit DIB(size_t size);
- ~DIB();
+ explicit Buffer(int id, scoped_ptr<base::SharedMemory> mem);
piman 2013/06/05 00:30:55 This id and all other ones in this class should be
slavi 2013/06/06 23:02:47 Done.
+ ~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);
+
+ 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();
piman 2013/06/05 00:30:55 unsigned int.
slavi 2013/06/06 23:02:47 Done.
+ Buffer* CreateBuffer();
+ int FindFreeBuffer(int hint);
- int front_buffer_;
- int num_free_buffers_;
- ScopedVector<DIB> dibs_;
- ScopedVector<DIB> awaiting_ack_;
+ int current_index_;
+ unsigned next_buffer_id_;
+ ScopedVector<Buffer> buffers_;
+ ScopedVector<Buffer> awaiting_ack_;
SkBitmap bitmap_;
+ RenderThread* render_thread_;
};
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698