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

Unified Diff: content/common/gpu/gpu_command_buffer_stub.h

Issue 9289052: Adding GpuMemoryManager to track GpuCommandBufferStub visibility and last_used_time and dictate mem… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Changing tests to use a test harness for setup, and splitting big test into several smaller. Created 8 years, 11 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/common/gpu/gpu_command_buffer_stub.h
diff --git a/content/common/gpu/gpu_command_buffer_stub.h b/content/common/gpu/gpu_command_buffer_stub.h
index 8f4e84a0f092e32e70e6385c50471eb5f4bd7c9b..613a9004cecc5c42924737c987b6fe7c085e1557 100644
--- a/content/common/gpu/gpu_command_buffer_stub.h
+++ b/content/common/gpu/gpu_command_buffer_stub.h
@@ -13,6 +13,7 @@
#include "base/id_map.h"
#include "base/memory/weak_ptr.h"
+#include "content/common/content_export.h"
#include "content/common/gpu/media/gpu_video_decode_accelerator.h"
#include "gpu/command_buffer/common/constants.h"
#include "gpu/command_buffer/service/command_buffer_service.h"
@@ -32,11 +33,38 @@
#endif
class GpuChannel;
+class GpuMemoryAllocation;
class GpuWatchdog;
-class GpuCommandBufferStub
+class CONTENT_EXPORT GpuCommandBufferStubBase {
nduca 2012/02/01 00:01:17 Put a comment above this class explaining that exp
+ public:
+ struct CONTENT_EXPORT SurfaceState {
+ int32 surface_id;
+ bool visible;
+ base::TimeTicks last_used_time;
+
+ SurfaceState(int32 surface_id,
+ bool visible,
+ base::TimeTicks last_used_time);
+ };
+
+ public:
+ virtual ~GpuCommandBufferStubBase() {}
+
+ // Null if surface_id == 0.
nduca 2012/02/01 00:01:17 Null if this is an offscreen commandbuffer. surfac
+ virtual SurfaceState* surface_state() = 0;
+
+ // This stubs' surface_id should *not* be in the affected_surface_ids list
+ virtual const std::vector<int32>& affected_surface_ids() = 0;
+
+ virtual void SendMemoryAllocationToProxy(
+ const GpuMemoryAllocation& allocation) = 0;
+};
+
+class CONTENT_EXPORT GpuCommandBufferStub
: public IPC::Channel::Listener,
public IPC::Message::Sender,
+ public GpuCommandBufferStubBase,
public base::SupportsWeakPtr<GpuCommandBufferStub> {
public:
GpuCommandBufferStub(
@@ -61,6 +89,15 @@ class GpuCommandBufferStub
// IPC::Message::Sender implementation:
virtual bool Send(IPC::Message* msg) OVERRIDE;
+ // GpuCommandBufferStubBase implementation:
+ virtual GpuCommandBufferStubBase::SurfaceState* surface_state() OVERRIDE;
+ // affected_surface_ids refers to others stubs' surfaces. This stubs'
nduca 2012/02/01 00:01:17 space between methods. Change comment so that it
+ // surface_id is found via surface state
+ virtual const std::vector<int32>& affected_surface_ids() OVERRIDE;
+ virtual void SendMemoryAllocationToProxy(
+ const GpuMemoryAllocation& allocation) OVERRIDE;
+
+
// Whether this command buffer can currently handle IPC messages.
bool IsScheduled();
@@ -74,7 +111,8 @@ class GpuCommandBufferStub
gpu::GpuScheduler* scheduler() const { return scheduler_.get(); }
// Identifies the target surface.
- int32 surface_id() const { return surface_id_; }
+ int32 surface_id() const { return (surface_state_.get()) ?
nduca 2012/02/01 00:01:17 newline after the { maybe move to cpp
+ surface_state_->surface_id : 0; }
// Identifies the various GpuCommandBufferStubs in the GPU process belonging
// to the same renderer process.
@@ -141,6 +179,8 @@ class GpuCommandBufferStub
int32 route_id_;
bool software_;
uint32 last_flush_count_;
+ scoped_ptr<GpuCommandBufferStubBase::SurfaceState> surface_state_;
+ std::vector<int32> affected_surface_ids_;
// Identifies the window for the rendering results on the browser side.
int32 surface_id_;
nduca 2012/02/01 00:01:17 Are you deleting this? Looks like you've gotten 99

Powered by Google App Engine
This is Rietveld 408576698