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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 void CommandBufferProxyImpl::OnConsoleMessage( | 97 void CommandBufferProxyImpl::OnConsoleMessage( |
98 const GPUCommandBufferConsoleMessage& message) { | 98 const GPUCommandBufferConsoleMessage& message) { |
99 if (!console_message_callback_.is_null()) { | 99 if (!console_message_callback_.is_null()) { |
100 console_message_callback_.Run(message.message, message.id); | 100 console_message_callback_.Run(message.message, message.id); |
101 } | 101 } |
102 } | 102 } |
103 | 103 |
104 void CommandBufferProxyImpl::SetMemoryAllocationChangedCallback( | 104 void CommandBufferProxyImpl::SetMemoryAllocationChangedCallback( |
105 const base::Callback<void(const GpuMemoryAllocationForRenderer&)>& | 105 const base::Callback<void(const GpuMemoryAllocationForRenderer&)>& |
106 callback) { | 106 callback) { |
| 107 if (last_state_.error != gpu::error::kNoError) |
| 108 return; |
| 109 |
107 memory_allocation_changed_callback_ = callback; | 110 memory_allocation_changed_callback_ = callback; |
108 Send(new GpuCommandBufferMsg_SetClientHasMemoryAllocationChangedCallback( | 111 Send(new GpuCommandBufferMsg_SetClientHasMemoryAllocationChangedCallback( |
109 route_id_, !memory_allocation_changed_callback_.is_null())); | 112 route_id_, !memory_allocation_changed_callback_.is_null())); |
110 } | 113 } |
111 | 114 |
112 void CommandBufferProxyImpl::OnSetMemoryAllocation( | 115 void CommandBufferProxyImpl::OnSetMemoryAllocation( |
113 const GpuMemoryAllocationForRenderer& allocation) { | 116 const GpuMemoryAllocationForRenderer& allocation) { |
114 if (!memory_allocation_changed_callback_.is_null()) | 117 if (!memory_allocation_changed_callback_.is_null()) |
115 memory_allocation_changed_callback_.Run(allocation); | 118 memory_allocation_changed_callback_.Run(allocation); |
116 } | 119 } |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 | 505 |
503 void CommandBufferProxyImpl::SetOnConsoleMessageCallback( | 506 void CommandBufferProxyImpl::SetOnConsoleMessageCallback( |
504 const GpuConsoleMessageCallback& callback) { | 507 const GpuConsoleMessageCallback& callback) { |
505 console_message_callback_ = callback; | 508 console_message_callback_ = callback; |
506 } | 509 } |
507 | 510 |
508 void CommandBufferProxyImpl::TryUpdateState() { | 511 void CommandBufferProxyImpl::TryUpdateState() { |
509 if (last_state_.error == gpu::error::kNoError) | 512 if (last_state_.error == gpu::error::kNoError) |
510 shared_state_->Read(&last_state_); | 513 shared_state_->Read(&last_state_); |
511 } | 514 } |
OLD | NEW |