| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 bool handled = true; | 96 bool handled = true; |
| 97 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message) | 97 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message) |
| 98 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize, | 98 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize, |
| 99 OnInitialize); | 99 OnInitialize); |
| 100 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetGetBuffer, | 100 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetGetBuffer, |
| 101 OnSetGetBuffer); | 101 OnSetGetBuffer); |
| 102 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetSharedStateBuffer, | 102 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetSharedStateBuffer, |
| 103 OnSetSharedStateBuffer); | 103 OnSetSharedStateBuffer); |
| 104 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetParent, | 104 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetParent, |
| 105 OnSetParent); | 105 OnSetParent); |
| 106 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Echo, OnEcho); |
| 106 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState); | 107 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState); |
| 107 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetStateFast, | 108 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetStateFast, |
| 108 OnGetStateFast); | 109 OnGetStateFast); |
| 109 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); | 110 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); |
| 110 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled); | 111 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled); |
| 111 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateTransferBuffer, | 112 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateTransferBuffer, |
| 112 OnCreateTransferBuffer); | 113 OnCreateTransferBuffer); |
| 113 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_RegisterTransferBuffer, | 114 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_RegisterTransferBuffer, |
| 114 OnRegisterTransferBuffer); | 115 OnRegisterTransferBuffer); |
| 115 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_DestroyTransferBuffer, | 116 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_DestroyTransferBuffer, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 134 } | 135 } |
| 135 | 136 |
| 136 bool GpuCommandBufferStub::IsScheduled() { | 137 bool GpuCommandBufferStub::IsScheduled() { |
| 137 return !scheduler_.get() || scheduler_->IsScheduled(); | 138 return !scheduler_.get() || scheduler_->IsScheduled(); |
| 138 } | 139 } |
| 139 | 140 |
| 140 bool GpuCommandBufferStub::HasMoreWork() { | 141 bool GpuCommandBufferStub::HasMoreWork() { |
| 141 return scheduler_.get() && scheduler_->HasMoreWork(); | 142 return scheduler_.get() && scheduler_->HasMoreWork(); |
| 142 } | 143 } |
| 143 | 144 |
| 145 void GpuCommandBufferStub::OnEcho(const IPC::Message& message) { |
| 146 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnEcho"); |
| 147 Send(new IPC::Message(message)); |
| 148 } |
| 149 |
| 144 void GpuCommandBufferStub::Destroy() { | 150 void GpuCommandBufferStub::Destroy() { |
| 145 // The scheduler has raw references to the decoder and the command buffer so | 151 // The scheduler has raw references to the decoder and the command buffer so |
| 146 // destroy it before those. | 152 // destroy it before those. |
| 147 scheduler_.reset(); | 153 scheduler_.reset(); |
| 148 | 154 |
| 149 if (decoder_.get()) | 155 if (decoder_.get()) |
| 150 decoder_->MakeCurrent(); | 156 decoder_->MakeCurrent(); |
| 151 FOR_EACH_OBSERVER(DestructionObserver, | 157 FOR_EACH_OBSERVER(DestructionObserver, |
| 152 destruction_observers_, | 158 destruction_observers_, |
| 153 OnWillDestroyStub(this)); | 159 OnWillDestroyStub(this)); |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 return; | 583 return; |
| 578 if (allocation.has_frontbuffer && allocation.has_backbuffer) | 584 if (allocation.has_frontbuffer && allocation.has_backbuffer) |
| 579 surface_->SetVisibility(gfx::GLSurface::VISIBILITY_STATE_FOREGROUND); | 585 surface_->SetVisibility(gfx::GLSurface::VISIBILITY_STATE_FOREGROUND); |
| 580 else if (allocation.has_frontbuffer) | 586 else if (allocation.has_frontbuffer) |
| 581 surface_->SetVisibility(gfx::GLSurface::VISIBILITY_STATE_BACKGROUND); | 587 surface_->SetVisibility(gfx::GLSurface::VISIBILITY_STATE_BACKGROUND); |
| 582 else | 588 else |
| 583 surface_->SetVisibility(gfx::GLSurface::VISIBILITY_STATE_HIBERNATED); | 589 surface_->SetVisibility(gfx::GLSurface::VISIBILITY_STATE_HIBERNATED); |
| 584 } | 590 } |
| 585 | 591 |
| 586 #endif // defined(ENABLE_GPU) | 592 #endif // defined(ENABLE_GPU) |
| OLD | NEW |