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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
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_CreateBackbuffer,
127 OnCreateBackbuffer)
128 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyBackbuffer,
129 OnDestroyBackbuffer)
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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 decoder->Initialize(profile, reply_message, 560 decoder->Initialize(profile, reply_message,
557 channel_->renderer_process()); 561 channel_->renderer_process());
558 } 562 }
559 563
560 void GpuCommandBufferStub::OnDestroyVideoDecoder(int decoder_route_id) { 564 void GpuCommandBufferStub::OnDestroyVideoDecoder(int decoder_route_id) {
561 channel_->RemoveRoute(decoder_route_id); 565 channel_->RemoveRoute(decoder_route_id);
562 video_decoders_.Remove(decoder_route_id); 566 video_decoders_.Remove(decoder_route_id);
563 } 567 }
564 568
565 void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) { 569 void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) {
566 if (visible)
567 surface_->SetBufferAllocation(
568 gfx::GLSurface::BUFFER_ALLOCATION_FRONT_AND_BACK);
569 DCHECK(surface_state_.get()); 570 DCHECK(surface_state_.get());
570 surface_state_->visible = visible; 571 surface_state_->visible = visible;
571 surface_state_->last_used_time = base::TimeTicks::Now(); 572 surface_state_->last_used_time = base::TimeTicks::Now();
572 channel_->gpu_channel_manager()->gpu_memory_manager()->ScheduleManage(); 573 channel_->gpu_channel_manager()->gpu_memory_manager()->ScheduleManage();
573 } 574 }
574 575
576 void GpuCommandBufferStub::OnCreateBackbuffer() {
577 printf(" [%i - %p] %s\n", getpid(), this, __PRETTY_FUNCTION__);
mmocny 2012/03/15 19:11:43 printfs will be removed..
578 DCHECK(surface_);
579 surface_->SetBufferAllocation(
580 gfx::GLSurface::BUFFER_ALLOCATION_FRONT_AND_BACK);
mmocny 2012/03/15 19:11:43 I will decouple front/back buffer management, but
581 }
582
583 void GpuCommandBufferStub::OnDestroyBackbuffer() {
584 printf(" [%i - %p] %s\n", getpid(), this, __PRETTY_FUNCTION__);
585 DCHECK(surface_);
586 // TODO(mmocny): Decouple frontbuffer drop from backbuffer drop.
587 surface_->SetBufferAllocation(
588 (allocation_.suggest_have_frontbuffer) ?
mmocny 2012/03/15 19:11:43 Ditto here for decoupling. As is, we wait for ren
589 gfx::GLSurface::BUFFER_ALLOCATION_FRONT_ONLY :
590 gfx::GLSurface::BUFFER_ALLOCATION_NONE);
591 }
592
575 void GpuCommandBufferStub::SendConsoleMessage( 593 void GpuCommandBufferStub::SendConsoleMessage(
576 int32 id, 594 int32 id,
577 const std::string& message) { 595 const std::string& message) {
578 GPUCommandBufferConsoleMessage console_message; 596 GPUCommandBufferConsoleMessage console_message;
579 console_message.id = id; 597 console_message.id = id;
580 console_message.message = message; 598 console_message.message = message;
581 IPC::Message* msg = new GpuCommandBufferMsg_ConsoleMsg( 599 IPC::Message* msg = new GpuCommandBufferMsg_ConsoleMsg(
582 route_id_, console_message); 600 route_id_, console_message);
583 msg->set_unblock(true); 601 msg->set_unblock(true);
584 Send(msg); 602 Send(msg);
(...skipping 30 matching lines...) Expand all
615 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); 633 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation));
616 } 634 }
617 635
618 void GpuCommandBufferStub::SetMemoryAllocation( 636 void GpuCommandBufferStub::SetMemoryAllocation(
619 const GpuMemoryAllocation& allocation) { 637 const GpuMemoryAllocation& allocation) {
620 if (allocation == allocation_) 638 if (allocation == allocation_)
621 return; 639 return;
622 allocation_ = allocation; 640 allocation_ = allocation;
623 641
624 SendMemoryAllocationToProxy(allocation); 642 SendMemoryAllocationToProxy(allocation);
625
626 if (!surface_)
627 return;
628 if (allocation.has_frontbuffer && allocation.has_backbuffer)
629 surface_->SetBufferAllocation(
630 gfx::GLSurface::BUFFER_ALLOCATION_FRONT_AND_BACK);
631 else if (allocation.has_frontbuffer)
632 surface_->SetBufferAllocation(
633 gfx::GLSurface::BUFFER_ALLOCATION_FRONT_ONLY);
634 else
635 surface_->SetBufferAllocation(
636 gfx::GLSurface::BUFFER_ALLOCATION_NONE);
637 } 643 }
638 644
639 #endif // defined(ENABLE_GPU) 645 #endif // defined(ENABLE_GPU)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698