OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer/gpu/command_buffer_proxy.h" | 5 #include "content/renderer/gpu/command_buffer_proxy.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 } | 42 } |
43 | 43 |
44 bool CommandBufferProxy::OnMessageReceived(const IPC::Message& message) { | 44 bool CommandBufferProxy::OnMessageReceived(const IPC::Message& message) { |
45 bool handled = true; | 45 bool handled = true; |
46 IPC_BEGIN_MESSAGE_MAP(CommandBufferProxy, message) | 46 IPC_BEGIN_MESSAGE_MAP(CommandBufferProxy, message) |
47 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_UpdateState, OnUpdateState); | 47 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_UpdateState, OnUpdateState); |
48 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Destroyed, OnDestroyed); | 48 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Destroyed, OnDestroyed); |
49 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_NotifyRepaint, | 49 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_NotifyRepaint, |
50 OnNotifyRepaint); | 50 OnNotifyRepaint); |
51 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_EchoAck, OnEchoAck); | 51 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_EchoAck, OnEchoAck); |
| 52 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ConsoleMsg, OnConsoleMessage); |
52 IPC_MESSAGE_UNHANDLED(handled = false) | 53 IPC_MESSAGE_UNHANDLED(handled = false) |
53 IPC_END_MESSAGE_MAP() | 54 IPC_END_MESSAGE_MAP() |
54 | 55 |
55 DCHECK(handled); | 56 DCHECK(handled); |
56 return handled; | 57 return handled; |
57 } | 58 } |
58 | 59 |
59 void CommandBufferProxy::OnChannelError() { | 60 void CommandBufferProxy::OnChannelError() { |
60 for (Decoders::iterator it = video_decoder_hosts_.begin(); | 61 for (Decoders::iterator it = video_decoder_hosts_.begin(); |
61 it != video_decoder_hosts_.end(); ++it) { | 62 it != video_decoder_hosts_.end(); ++it) { |
(...skipping 18 matching lines...) Expand all Loading... |
80 } | 81 } |
81 } | 82 } |
82 | 83 |
83 void CommandBufferProxy::OnEchoAck() { | 84 void CommandBufferProxy::OnEchoAck() { |
84 DCHECK(!echo_tasks_.empty()); | 85 DCHECK(!echo_tasks_.empty()); |
85 base::Closure callback = echo_tasks_.front(); | 86 base::Closure callback = echo_tasks_.front(); |
86 echo_tasks_.pop(); | 87 echo_tasks_.pop(); |
87 callback.Run(); | 88 callback.Run(); |
88 } | 89 } |
89 | 90 |
| 91 void CommandBufferProxy::OnConsoleMessage( |
| 92 const GPUCommandBufferConsoleMessage& message) { |
| 93 // TODO(gman): Pass this on to the console. |
| 94 DLOG(INFO) << "CONSOLE_MESSAGE: " |
| 95 << message.id << " : " << message.message; |
| 96 } |
| 97 |
90 void CommandBufferProxy::SetChannelErrorCallback( | 98 void CommandBufferProxy::SetChannelErrorCallback( |
91 const base::Closure& callback) { | 99 const base::Closure& callback) { |
92 channel_error_callback_ = callback; | 100 channel_error_callback_ = callback; |
93 } | 101 } |
94 | 102 |
95 bool CommandBufferProxy::Initialize() { | 103 bool CommandBufferProxy::Initialize() { |
96 ChildThread* child_thread = ChildThread::current(); | 104 ChildThread* child_thread = ChildThread::current(); |
97 if (!child_thread) | 105 if (!child_thread) |
98 return false; | 106 return false; |
99 | 107 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 delete msg; | 413 delete msg; |
406 return false; | 414 return false; |
407 } | 415 } |
408 | 416 |
409 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) { | 417 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) { |
410 // Handle wraparound. It works as long as we don't have more than 2B state | 418 // Handle wraparound. It works as long as we don't have more than 2B state |
411 // updates in flight across which reordering occurs. | 419 // updates in flight across which reordering occurs. |
412 if (state.generation - last_state_.generation < 0x80000000U) | 420 if (state.generation - last_state_.generation < 0x80000000U) |
413 last_state_ = state; | 421 last_state_ = state; |
414 } | 422 } |
OLD | NEW |