| OLD | NEW |
| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoDecoder, | 123 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoDecoder, |
| 124 OnCreateVideoDecoder) | 124 OnCreateVideoDecoder) |
| 125 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyVideoDecoder, | 125 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyVideoDecoder, |
| 126 OnDestroyVideoDecoder) | 126 OnDestroyVideoDecoder) |
| 127 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetSurfaceVisible, | 127 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetSurfaceVisible, |
| 128 OnSetSurfaceVisible) | 128 OnSetSurfaceVisible) |
| 129 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DiscardBackbuffer, | 129 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DiscardBackbuffer, |
| 130 OnDiscardBackbuffer) | 130 OnDiscardBackbuffer) |
| 131 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_EnsureBackbuffer, | 131 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_EnsureBackbuffer, |
| 132 OnEnsureBackbuffer) | 132 OnEnsureBackbuffer) |
| 133 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_HandlesMemoryAllocations, |
| 134 OnHandlesMemoryAllocations) |
| 133 IPC_MESSAGE_UNHANDLED(handled = false) | 135 IPC_MESSAGE_UNHANDLED(handled = false) |
| 134 IPC_END_MESSAGE_MAP() | 136 IPC_END_MESSAGE_MAP() |
| 135 | 137 |
| 136 DCHECK(handled); | 138 DCHECK(handled); |
| 137 return handled; | 139 return handled; |
| 138 } | 140 } |
| 139 | 141 |
| 140 bool GpuCommandBufferStub::Send(IPC::Message* message) { | 142 bool GpuCommandBufferStub::Send(IPC::Message* message) { |
| 141 return channel_->Send(message); | 143 return channel_->Send(message); |
| 142 } | 144 } |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 } | 582 } |
| 581 | 583 |
| 582 void GpuCommandBufferStub::OnEnsureBackbuffer() { | 584 void GpuCommandBufferStub::OnEnsureBackbuffer() { |
| 583 if (!surface_) | 585 if (!surface_) |
| 584 return; | 586 return; |
| 585 // TODO(mmocny): Support backbuffer without frontbuffer. | 587 // TODO(mmocny): Support backbuffer without frontbuffer. |
| 586 surface_->SetBufferAllocation( | 588 surface_->SetBufferAllocation( |
| 587 gfx::GLSurface::BUFFER_ALLOCATION_FRONT_AND_BACK); | 589 gfx::GLSurface::BUFFER_ALLOCATION_FRONT_AND_BACK); |
| 588 } | 590 } |
| 589 | 591 |
| 592 void GpuCommandBufferStub::OnHandlesMemoryAllocations() { |
| 593 handles_memory_allocations_ = true; |
| 594 channel_->gpu_channel_manager()->gpu_memory_manager()->ScheduleManage(); |
| 595 } |
| 596 |
| 590 void GpuCommandBufferStub::SendConsoleMessage( | 597 void GpuCommandBufferStub::SendConsoleMessage( |
| 591 int32 id, | 598 int32 id, |
| 592 const std::string& message) { | 599 const std::string& message) { |
| 593 GPUCommandBufferConsoleMessage console_message; | 600 GPUCommandBufferConsoleMessage console_message; |
| 594 console_message.id = id; | 601 console_message.id = id; |
| 595 console_message.message = message; | 602 console_message.message = message; |
| 596 IPC::Message* msg = new GpuCommandBufferMsg_ConsoleMsg( | 603 IPC::Message* msg = new GpuCommandBufferMsg_ConsoleMsg( |
| 597 route_id_, console_message); | 604 route_id_, console_message); |
| 598 msg->set_unblock(true); | 605 msg->set_unblock(true); |
| 599 Send(msg); | 606 Send(msg); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 } | 638 } |
| 632 | 639 |
| 633 void GpuCommandBufferStub::SetMemoryAllocation( | 640 void GpuCommandBufferStub::SetMemoryAllocation( |
| 634 const GpuMemoryAllocation& allocation) { | 641 const GpuMemoryAllocation& allocation) { |
| 635 allocation_ = allocation; | 642 allocation_ = allocation; |
| 636 | 643 |
| 637 SendMemoryAllocationToProxy(allocation); | 644 SendMemoryAllocationToProxy(allocation); |
| 638 } | 645 } |
| 639 | 646 |
| 640 #endif // defined(ENABLE_GPU) | 647 #endif // defined(ENABLE_GPU) |
| OLD | NEW |