| 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 #include "content/common/gpu/client/command_buffer_proxy_impl.h" | 5 #include "content/common/gpu/client/command_buffer_proxy_impl.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 bool CommandBufferProxyImpl::OnMessageReceived(const IPC::Message& message) { | 51 bool CommandBufferProxyImpl::OnMessageReceived(const IPC::Message& message) { |
| 52 bool handled = true; | 52 bool handled = true; |
| 53 IPC_BEGIN_MESSAGE_MAP(CommandBufferProxyImpl, message) | 53 IPC_BEGIN_MESSAGE_MAP(CommandBufferProxyImpl, message) |
| 54 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Destroyed, OnDestroyed); | 54 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Destroyed, OnDestroyed); |
| 55 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_EchoAck, OnEchoAck); | 55 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_EchoAck, OnEchoAck); |
| 56 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ConsoleMsg, OnConsoleMessage); | 56 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ConsoleMsg, OnConsoleMessage); |
| 57 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetMemoryAllocation, | 57 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetMemoryAllocation, |
| 58 OnSetMemoryAllocation); | 58 OnSetMemoryAllocation); |
| 59 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPointAck, | 59 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPointAck, |
| 60 OnSignalSyncPointAck); | 60 OnSignalSyncPointAck); |
| 61 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetLatencyInfo, |
| 62 OnSetLatencyInfo); |
| 61 IPC_MESSAGE_UNHANDLED(handled = false) | 63 IPC_MESSAGE_UNHANDLED(handled = false) |
| 62 IPC_END_MESSAGE_MAP() | 64 IPC_END_MESSAGE_MAP() |
| 63 | 65 |
| 64 DCHECK(handled); | 66 DCHECK(handled); |
| 65 return handled; | 67 return handled; |
| 66 } | 68 } |
| 67 | 69 |
| 68 void CommandBufferProxyImpl::OnChannelError() { | 70 void CommandBufferProxyImpl::OnChannelError() { |
| 69 OnDestroyed(gpu::error::kUnknown); | 71 OnDestroyed(gpu::error::kUnknown); |
| 70 } | 72 } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 if (last_put_offset_ == put_offset) | 197 if (last_put_offset_ == put_offset) |
| 196 return; | 198 return; |
| 197 | 199 |
| 198 last_put_offset_ = put_offset; | 200 last_put_offset_ = put_offset; |
| 199 | 201 |
| 200 Send(new GpuCommandBufferMsg_AsyncFlush(route_id_, | 202 Send(new GpuCommandBufferMsg_AsyncFlush(route_id_, |
| 201 put_offset, | 203 put_offset, |
| 202 ++flush_count_)); | 204 ++flush_count_)); |
| 203 } | 205 } |
| 204 | 206 |
| 207 void CommandBufferProxyImpl::SetLatencyInfo( |
| 208 const cc::LatencyInfo& latency_info) { |
| 209 Send(new GpuCommandBufferMsg_SetLatencyInfo(route_id_, latency_info)); |
| 210 } |
| 211 |
| 212 void CommandBufferProxyImpl::SetLatencyInfoCallback( |
| 213 const GpuLatencyInfoCallback& callback) { |
| 214 latency_info_callback_ = callback; |
| 215 } |
| 216 |
| 217 void CommandBufferProxyImpl::OnSetLatencyInfo( |
| 218 const cc::LatencyInfo& latency_info) { |
| 219 if (!latency_info_callback_.is_null()) |
| 220 latency_info_callback_.Run(latency_info); |
| 221 } |
| 222 |
| 205 gpu::CommandBuffer::State CommandBufferProxyImpl::FlushSync( | 223 gpu::CommandBuffer::State CommandBufferProxyImpl::FlushSync( |
| 206 int32 put_offset, | 224 int32 put_offset, |
| 207 int32 last_known_get) { | 225 int32 last_known_get) { |
| 208 TRACE_EVENT1("gpu", "CommandBufferProxyImpl::FlushSync", "put_offset", | 226 TRACE_EVENT1("gpu", "CommandBufferProxyImpl::FlushSync", "put_offset", |
| 209 put_offset); | 227 put_offset); |
| 210 Flush(put_offset); | 228 Flush(put_offset); |
| 211 TryUpdateState(); | 229 TryUpdateState(); |
| 212 if (last_known_get == last_state_.get_offset) { | 230 if (last_known_get == last_state_.get_offset) { |
| 213 // Send will flag state with lost context if IPC fails. | 231 // Send will flag state with lost context if IPC fails. |
| 214 if (last_state_.error == gpu::error::kNoError) { | 232 if (last_state_.error == gpu::error::kNoError) { |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 void CommandBufferProxyImpl::SendManagedMemoryStats( | 543 void CommandBufferProxyImpl::SendManagedMemoryStats( |
| 526 const GpuManagedMemoryStats& stats) { | 544 const GpuManagedMemoryStats& stats) { |
| 527 if (last_state_.error != gpu::error::kNoError) | 545 if (last_state_.error != gpu::error::kNoError) |
| 528 return; | 546 return; |
| 529 | 547 |
| 530 Send(new GpuCommandBufferMsg_SendClientManagedMemoryStats(route_id_, | 548 Send(new GpuCommandBufferMsg_SendClientManagedMemoryStats(route_id_, |
| 531 stats)); | 549 stats)); |
| 532 } | 550 } |
| 533 | 551 |
| 534 } // namespace content | 552 } // namespace content |
| OLD | NEW |