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

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

Issue 9702081: Splitting GpuMemoryAllocation into two parts: for renderer and browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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.cc
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index 96ca0ea68ab85ff030ddaac2a1a4a1494614602e..5d4f818f1430644c2ef6f31230116a9f72524bc5 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -123,6 +123,10 @@ bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) {
OnDestroyVideoDecoder)
IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetSurfaceVisible,
OnSetSurfaceVisible)
+ IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_CreateBackbuffer,
+ OnCreateBackbuffer)
+ IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyBackbuffer,
+ OnDestroyBackbuffer)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -563,15 +567,29 @@ void GpuCommandBufferStub::OnDestroyVideoDecoder(int decoder_route_id) {
}
void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) {
- if (visible)
- surface_->SetBufferAllocation(
- gfx::GLSurface::BUFFER_ALLOCATION_FRONT_AND_BACK);
DCHECK(surface_state_.get());
surface_state_->visible = visible;
surface_state_->last_used_time = base::TimeTicks::Now();
channel_->gpu_channel_manager()->gpu_memory_manager()->ScheduleManage();
}
+void GpuCommandBufferStub::OnCreateBackbuffer() {
+ printf(" [%i - %p] %s\n", getpid(), this, __PRETTY_FUNCTION__);
mmocny 2012/03/15 19:11:43 printfs will be removed..
+ DCHECK(surface_);
+ surface_->SetBufferAllocation(
+ gfx::GLSurface::BUFFER_ALLOCATION_FRONT_AND_BACK);
mmocny 2012/03/15 19:11:43 I will decouple front/back buffer management, but
+}
+
+void GpuCommandBufferStub::OnDestroyBackbuffer() {
+ printf(" [%i - %p] %s\n", getpid(), this, __PRETTY_FUNCTION__);
+ DCHECK(surface_);
+ // TODO(mmocny): Decouple frontbuffer drop from backbuffer drop.
+ surface_->SetBufferAllocation(
+ (allocation_.suggest_have_frontbuffer) ?
mmocny 2012/03/15 19:11:43 Ditto here for decoupling. As is, we wait for ren
+ gfx::GLSurface::BUFFER_ALLOCATION_FRONT_ONLY :
+ gfx::GLSurface::BUFFER_ALLOCATION_NONE);
+}
+
void GpuCommandBufferStub::SendConsoleMessage(
int32 id,
const std::string& message) {
@@ -622,18 +640,6 @@ void GpuCommandBufferStub::SetMemoryAllocation(
allocation_ = allocation;
SendMemoryAllocationToProxy(allocation);
-
- if (!surface_)
- return;
- if (allocation.has_frontbuffer && allocation.has_backbuffer)
- surface_->SetBufferAllocation(
- gfx::GLSurface::BUFFER_ALLOCATION_FRONT_AND_BACK);
- else if (allocation.has_frontbuffer)
- surface_->SetBufferAllocation(
- gfx::GLSurface::BUFFER_ALLOCATION_FRONT_ONLY);
- else
- surface_->SetBufferAllocation(
- gfx::GLSurface::BUFFER_ALLOCATION_NONE);
}
#endif // defined(ENABLE_GPU)

Powered by Google App Engine
This is Rietveld 408576698