| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 gpu::CommandBuffer::State CommandBufferProxyImpl::GetLastState() { | 164 gpu::CommandBuffer::State CommandBufferProxyImpl::GetLastState() { |
| 165 return last_state_; | 165 return last_state_; |
| 166 } | 166 } |
| 167 | 167 |
| 168 int32 CommandBufferProxyImpl::GetLastToken() { | 168 int32 CommandBufferProxyImpl::GetLastToken() { |
| 169 TryUpdateState(); | 169 TryUpdateState(); |
| 170 return last_state_.token; | 170 return last_state_.token; |
| 171 } | 171 } |
| 172 | 172 |
| 173 void CommandBufferProxyImpl::Flush(int32 put_offset) { | 173 void CommandBufferProxyImpl::Flush(int32 put_offset, |
| 174 const std::vector<uint32>& sync_points) { |
| 174 if (last_state_.error != gpu::error::kNoError) | 175 if (last_state_.error != gpu::error::kNoError) |
| 175 return; | 176 return; |
| 176 | 177 |
| 177 TRACE_EVENT1("gpu", | 178 TRACE_EVENT1("gpu", |
| 178 "CommandBufferProxyImpl::Flush", | 179 "CommandBufferProxyImpl::Flush", |
| 179 "put_offset", | 180 "put_offset", |
| 180 put_offset); | 181 put_offset); |
| 181 | 182 |
| 182 if (last_put_offset_ == put_offset) | 183 if (last_put_offset_ == put_offset) |
| 183 return; | 184 return; |
| 184 | 185 |
| 185 last_put_offset_ = put_offset; | 186 last_put_offset_ = put_offset; |
| 186 | 187 |
| 187 Send(new GpuCommandBufferMsg_AsyncFlush(route_id_, | 188 Send(new GpuCommandBufferMsg_AsyncFlush(route_id_, put_offset, ++flush_count_, |
| 188 put_offset, | 189 sync_points, latency_info_)); |
| 189 ++flush_count_, | |
| 190 latency_info_)); | |
| 191 latency_info_.clear(); | 190 latency_info_.clear(); |
| 192 } | 191 } |
| 193 | 192 |
| 194 void CommandBufferProxyImpl::SetLatencyInfo( | 193 void CommandBufferProxyImpl::SetLatencyInfo( |
| 195 const std::vector<ui::LatencyInfo>& latency_info) { | 194 const std::vector<ui::LatencyInfo>& latency_info) { |
| 196 for (size_t i = 0; i < latency_info.size(); i++) | 195 for (size_t i = 0; i < latency_info.size(); i++) |
| 197 latency_info_.push_back(latency_info[i]); | 196 latency_info_.push_back(latency_info[i]); |
| 198 } | 197 } |
| 199 | 198 |
| 200 void CommandBufferProxyImpl::SetSwapBuffersCompletionCallback( | 199 void CommandBufferProxyImpl::SetSwapBuffersCompletionCallback( |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 if (!ui::LatencyInfo::Verify( | 531 if (!ui::LatencyInfo::Verify( |
| 533 latency_info, "CommandBufferProxyImpl::OnSwapBuffersCompleted")) { | 532 latency_info, "CommandBufferProxyImpl::OnSwapBuffersCompleted")) { |
| 534 swap_buffers_completion_callback_.Run(std::vector<ui::LatencyInfo>()); | 533 swap_buffers_completion_callback_.Run(std::vector<ui::LatencyInfo>()); |
| 535 return; | 534 return; |
| 536 } | 535 } |
| 537 swap_buffers_completion_callback_.Run(latency_info); | 536 swap_buffers_completion_callback_.Run(latency_info); |
| 538 } | 537 } |
| 539 } | 538 } |
| 540 | 539 |
| 541 } // namespace content | 540 } // namespace content |
| OLD | NEW |