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

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

Issue 9699125: Chromium implementation of discardBackbuffer WebGraphicsContext3D extension. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renaming extension for now, so its not mistaken for the standard one 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
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f47652973cd0075c710a8bc31fa435d0b1ecbfec..844b515461eb5a6365cbcd5eb3ac9f50e6bc01e5 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_DiscardBackbuffer,
+ OnDiscardBackbuffer)
+ IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_EnsureBackbuffer,
+ OnEnsureBackbuffer)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -564,15 +568,31 @@ 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::OnDiscardBackbuffer() {
+ if (!surface_)
+ return;
+ if (allocation_.suggest_have_frontbuffer)
+ surface_->SetBufferAllocation(
+ gfx::GLSurface::BUFFER_ALLOCATION_FRONT_ONLY);
+ else
+ surface_->SetBufferAllocation(
+ gfx::GLSurface::BUFFER_ALLOCATION_NONE);
+}
+
+void GpuCommandBufferStub::OnEnsureBackbuffer() {
+ if (!surface_)
+ return;
+ // TODO(mmocny): Support backbuffer without frontbuffer.
+ surface_->SetBufferAllocation(
+ gfx::GLSurface::BUFFER_ALLOCATION_FRONT_AND_BACK);
+}
+
void GpuCommandBufferStub::SendConsoleMessage(
int32 id,
const std::string& message) {
@@ -623,18 +643,6 @@ void GpuCommandBufferStub::SetMemoryAllocation(
allocation_ = allocation;
SendMemoryAllocationToProxy(allocation);
-
- if (!surface_)
- return;
- if (allocation.suggest_have_frontbuffer && allocation.suggest_have_backbuffer)
- surface_->SetBufferAllocation(
- gfx::GLSurface::BUFFER_ALLOCATION_FRONT_AND_BACK);
- else if (allocation.suggest_have_frontbuffer)
- surface_->SetBufferAllocation(
- gfx::GLSurface::BUFFER_ALLOCATION_FRONT_ONLY);
- else
- surface_->SetBufferAllocation(
- gfx::GLSurface::BUFFER_ALLOCATION_NONE);
}
#endif // defined(ENABLE_GPU)
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698