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 29 matching lines...) Expand all Loading... | |
40 | 40 |
41 bool CommandBufferProxyImpl::OnMessageReceived(const IPC::Message& message) { | 41 bool CommandBufferProxyImpl::OnMessageReceived(const IPC::Message& message) { |
42 bool handled = true; | 42 bool handled = true; |
43 IPC_BEGIN_MESSAGE_MAP(CommandBufferProxyImpl, message) | 43 IPC_BEGIN_MESSAGE_MAP(CommandBufferProxyImpl, message) |
44 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Destroyed, OnDestroyed); | 44 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Destroyed, OnDestroyed); |
45 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ConsoleMsg, OnConsoleMessage); | 45 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ConsoleMsg, OnConsoleMessage); |
46 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetMemoryAllocation, | 46 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetMemoryAllocation, |
47 OnSetMemoryAllocation); | 47 OnSetMemoryAllocation); |
48 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPointAck, | 48 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPointAck, |
49 OnSignalSyncPointAck); | 49 OnSignalSyncPointAck); |
50 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SwapBuffersCompleted, | |
51 OnSwapBuffersCompleted); | |
50 IPC_MESSAGE_UNHANDLED(handled = false) | 52 IPC_MESSAGE_UNHANDLED(handled = false) |
51 IPC_END_MESSAGE_MAP() | 53 IPC_END_MESSAGE_MAP() |
52 | 54 |
53 DCHECK(handled); | 55 DCHECK(handled); |
54 return handled; | 56 return handled; |
55 } | 57 } |
56 | 58 |
57 void CommandBufferProxyImpl::OnChannelError() { | 59 void CommandBufferProxyImpl::OnChannelError() { |
58 OnDestroyed(gpu::error::kUnknown); | 60 OnDestroyed(gpu::error::kUnknown); |
59 } | 61 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 last_put_offset_ = put_offset; | 182 last_put_offset_ = put_offset; |
181 | 183 |
182 Send(new GpuCommandBufferMsg_AsyncFlush(route_id_, | 184 Send(new GpuCommandBufferMsg_AsyncFlush(route_id_, |
183 put_offset, | 185 put_offset, |
184 ++flush_count_, | 186 ++flush_count_, |
185 latency_info_)); | 187 latency_info_)); |
186 latency_info_.clear(); | 188 latency_info_.clear(); |
187 } | 189 } |
188 | 190 |
189 void CommandBufferProxyImpl::SetLatencyInfo( | 191 void CommandBufferProxyImpl::SetLatencyInfo( |
190 const std::vector<ui::LatencyInfo>& latency_info) { | 192 const std::vector<ui::LatencyInfo>& latency_info, |
193 const SwapBuffersCompletionCallback& callback) { | |
194 swap_buffers_completion_callback_ = callback; | |
191 for (size_t i = 0; i < latency_info.size(); i++) | 195 for (size_t i = 0; i < latency_info.size(); i++) |
192 latency_info_.push_back(latency_info[i]); | 196 latency_info_.push_back(latency_info[i]); |
193 } | 197 } |
194 | 198 |
195 void CommandBufferProxyImpl::WaitForTokenInRange(int32 start, int32 end) { | 199 void CommandBufferProxyImpl::WaitForTokenInRange(int32 start, int32 end) { |
196 TRACE_EVENT2("gpu", | 200 TRACE_EVENT2("gpu", |
197 "CommandBufferProxyImpl::WaitForToken", | 201 "CommandBufferProxyImpl::WaitForToken", |
198 "start", | 202 "start", |
199 start, | 203 start, |
200 "end", | 204 "end", |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
497 void CommandBufferProxyImpl::TryUpdateState() { | 501 void CommandBufferProxyImpl::TryUpdateState() { |
498 if (last_state_.error == gpu::error::kNoError) | 502 if (last_state_.error == gpu::error::kNoError) |
499 shared_state()->Read(&last_state_); | 503 shared_state()->Read(&last_state_); |
500 } | 504 } |
501 | 505 |
502 gpu::CommandBufferSharedState* CommandBufferProxyImpl::shared_state() const { | 506 gpu::CommandBufferSharedState* CommandBufferProxyImpl::shared_state() const { |
503 return reinterpret_cast<gpu::CommandBufferSharedState*>( | 507 return reinterpret_cast<gpu::CommandBufferSharedState*>( |
504 shared_state_shm_->memory()); | 508 shared_state_shm_->memory()); |
505 } | 509 } |
506 | 510 |
511 void CommandBufferProxyImpl::OnSwapBuffersCompleted( | |
512 const std::vector<ui::LatencyInfo>& latency_info) { | |
Mike West
2014/10/07 04:46:23
It doesn't look like you have any limits on the am
| |
513 if (!swap_buffers_completion_callback_.is_null()) { | |
514 swap_buffers_completion_callback_.Run(latency_info); | |
515 swap_buffers_completion_callback_.Reset(); | |
piman
2014/10/07 02:30:39
If we have more than 1 frame deep, I don't think t
no sievers
2014/10/07 19:47:24
Done.
| |
516 } | |
517 } | |
518 | |
507 } // namespace content | 519 } // namespace content |
OLD | NEW |