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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if defined(ENABLE_GPU) 5 #if defined(ENABLE_GPU)
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_DestroyTransferBuffer, 116 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_DestroyTransferBuffer,
117 OnDestroyTransferBuffer); 117 OnDestroyTransferBuffer);
118 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetTransferBuffer, 118 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetTransferBuffer,
119 OnGetTransferBuffer); 119 OnGetTransferBuffer);
120 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoDecoder, 120 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoDecoder,
121 OnCreateVideoDecoder) 121 OnCreateVideoDecoder)
122 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyVideoDecoder, 122 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyVideoDecoder,
123 OnDestroyVideoDecoder) 123 OnDestroyVideoDecoder)
124 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetSurfaceVisible, 124 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetSurfaceVisible,
125 OnSetSurfaceVisible) 125 OnSetSurfaceVisible)
126 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DiscardBackbuffer,
127 OnDiscardBackbuffer)
128 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_EnsureBackbuffer,
129 OnEnsureBackbuffer)
126 IPC_MESSAGE_UNHANDLED(handled = false) 130 IPC_MESSAGE_UNHANDLED(handled = false)
127 IPC_END_MESSAGE_MAP() 131 IPC_END_MESSAGE_MAP()
128 132
129 DCHECK(handled); 133 DCHECK(handled);
130 return handled; 134 return handled;
131 } 135 }
132 136
133 bool GpuCommandBufferStub::Send(IPC::Message* message) { 137 bool GpuCommandBufferStub::Send(IPC::Message* message) {
134 return channel_->Send(message); 138 return channel_->Send(message);
135 } 139 }
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 decoder->Initialize(profile, reply_message, 561 decoder->Initialize(profile, reply_message,
558 channel_->renderer_process()); 562 channel_->renderer_process());
559 } 563 }
560 564
561 void GpuCommandBufferStub::OnDestroyVideoDecoder(int decoder_route_id) { 565 void GpuCommandBufferStub::OnDestroyVideoDecoder(int decoder_route_id) {
562 channel_->RemoveRoute(decoder_route_id); 566 channel_->RemoveRoute(decoder_route_id);
563 video_decoders_.Remove(decoder_route_id); 567 video_decoders_.Remove(decoder_route_id);
564 } 568 }
565 569
566 void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) { 570 void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) {
567 if (visible)
568 surface_->SetBufferAllocation(
569 gfx::GLSurface::BUFFER_ALLOCATION_FRONT_AND_BACK);
570 DCHECK(surface_state_.get()); 571 DCHECK(surface_state_.get());
571 surface_state_->visible = visible; 572 surface_state_->visible = visible;
572 surface_state_->last_used_time = base::TimeTicks::Now(); 573 surface_state_->last_used_time = base::TimeTicks::Now();
573 channel_->gpu_channel_manager()->gpu_memory_manager()->ScheduleManage(); 574 channel_->gpu_channel_manager()->gpu_memory_manager()->ScheduleManage();
574 } 575 }
575 576
577 void GpuCommandBufferStub::OnDiscardBackbuffer() {
578 if (!surface_)
579 return;
580 if (allocation_.suggest_have_frontbuffer)
581 surface_->SetBufferAllocation(
582 gfx::GLSurface::BUFFER_ALLOCATION_FRONT_ONLY);
583 else
584 surface_->SetBufferAllocation(
585 gfx::GLSurface::BUFFER_ALLOCATION_NONE);
586 }
587
588 void GpuCommandBufferStub::OnEnsureBackbuffer() {
589 if (!surface_)
590 return;
591 // TODO(mmocny): Support backbuffer without frontbuffer.
592 surface_->SetBufferAllocation(
593 gfx::GLSurface::BUFFER_ALLOCATION_FRONT_AND_BACK);
594 }
595
576 void GpuCommandBufferStub::SendConsoleMessage( 596 void GpuCommandBufferStub::SendConsoleMessage(
577 int32 id, 597 int32 id,
578 const std::string& message) { 598 const std::string& message) {
579 GPUCommandBufferConsoleMessage console_message; 599 GPUCommandBufferConsoleMessage console_message;
580 console_message.id = id; 600 console_message.id = id;
581 console_message.message = message; 601 console_message.message = message;
582 IPC::Message* msg = new GpuCommandBufferMsg_ConsoleMsg( 602 IPC::Message* msg = new GpuCommandBufferMsg_ConsoleMsg(
583 route_id_, console_message); 603 route_id_, console_message);
584 msg->set_unblock(true); 604 msg->set_unblock(true);
585 Send(msg); 605 Send(msg);
(...skipping 30 matching lines...) Expand all
616 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); 636 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation));
617 } 637 }
618 638
619 void GpuCommandBufferStub::SetMemoryAllocation( 639 void GpuCommandBufferStub::SetMemoryAllocation(
620 const GpuMemoryAllocation& allocation) { 640 const GpuMemoryAllocation& allocation) {
621 if (allocation == allocation_) 641 if (allocation == allocation_)
622 return; 642 return;
623 allocation_ = allocation; 643 allocation_ = allocation;
624 644
625 SendMemoryAllocationToProxy(allocation); 645 SendMemoryAllocationToProxy(allocation);
626
627 if (!surface_)
628 return;
629 if (allocation.suggest_have_frontbuffer && allocation.suggest_have_backbuffer)
630 surface_->SetBufferAllocation(
631 gfx::GLSurface::BUFFER_ALLOCATION_FRONT_AND_BACK);
632 else if (allocation.suggest_have_frontbuffer)
633 surface_->SetBufferAllocation(
634 gfx::GLSurface::BUFFER_ALLOCATION_FRONT_ONLY);
635 else
636 surface_->SetBufferAllocation(
637 gfx::GLSurface::BUFFER_ALLOCATION_NONE);
638 } 646 }
639 647
640 #endif // defined(ENABLE_GPU) 648 #endif // defined(ENABLE_GPU)
OLDNEW
« 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