| 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/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 "put_offset", | 182 "put_offset", |
| 183 put_offset); | 183 put_offset); |
| 184 | 184 |
| 185 if (last_put_offset_ == put_offset) | 185 if (last_put_offset_ == put_offset) |
| 186 return; | 186 return; |
| 187 | 187 |
| 188 last_put_offset_ = put_offset; | 188 last_put_offset_ = put_offset; |
| 189 | 189 |
| 190 Send(new GpuCommandBufferMsg_AsyncFlush(route_id_, | 190 Send(new GpuCommandBufferMsg_AsyncFlush(route_id_, |
| 191 put_offset, | 191 put_offset, |
| 192 ++flush_count_)); | 192 ++flush_count_, |
| 193 latency_info_)); |
| 194 latency_info_.clear(); |
| 193 } | 195 } |
| 194 | 196 |
| 195 void CommandBufferProxyImpl::SetLatencyInfo( | 197 void CommandBufferProxyImpl::SetLatencyInfo( |
| 196 const std::vector<ui::LatencyInfo>& latency_info) { | 198 const std::vector<ui::LatencyInfo>& latency_info) { |
| 197 if (last_state_.error != gpu::error::kNoError || | 199 for (size_t i = 0; i < latency_info.size(); i++) |
| 198 latency_info.empty()) | 200 latency_info_.push_back(latency_info[i]); |
| 199 return; | |
| 200 Send(new GpuCommandBufferMsg_SetLatencyInfo(route_id_, latency_info)); | |
| 201 } | 201 } |
| 202 | 202 |
| 203 void CommandBufferProxyImpl::WaitForTokenInRange(int32 start, int32 end) { | 203 void CommandBufferProxyImpl::WaitForTokenInRange(int32 start, int32 end) { |
| 204 TRACE_EVENT2("gpu", | 204 TRACE_EVENT2("gpu", |
| 205 "CommandBufferProxyImpl::WaitForToken", | 205 "CommandBufferProxyImpl::WaitForToken", |
| 206 "start", | 206 "start", |
| 207 start, | 207 start, |
| 208 "end", | 208 "end", |
| 209 end); | 209 end); |
| 210 TryUpdateState(); | 210 TryUpdateState(); |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 if (last_state_.error == gpu::error::kNoError) | 519 if (last_state_.error == gpu::error::kNoError) |
| 520 shared_state()->Read(&last_state_); | 520 shared_state()->Read(&last_state_); |
| 521 } | 521 } |
| 522 | 522 |
| 523 gpu::CommandBufferSharedState* CommandBufferProxyImpl::shared_state() const { | 523 gpu::CommandBufferSharedState* CommandBufferProxyImpl::shared_state() const { |
| 524 return reinterpret_cast<gpu::CommandBufferSharedState*>( | 524 return reinterpret_cast<gpu::CommandBufferSharedState*>( |
| 525 shared_state_shm_->memory()); | 525 shared_state_shm_->memory()); |
| 526 } | 526 } |
| 527 | 527 |
| 528 } // namespace content | 528 } // namespace content |
| OLD | NEW |