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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 } else { | 523 } else { |
524 // Flag the command buffer as lost. Defer deleting the channel until | 524 // Flag the command buffer as lost. Defer deleting the channel until |
525 // OnChannelError is called after returning to the message loop in case | 525 // OnChannelError is called after returning to the message loop in case |
526 // it is referenced elsewhere. | 526 // it is referenced elsewhere. |
527 last_state_.error = gpu::error::kLostContext; | 527 last_state_.error = gpu::error::kLostContext; |
528 return false; | 528 return false; |
529 } | 529 } |
530 } | 530 } |
531 | 531 |
532 // Callee takes ownership of message, regardless of whether Send is | 532 // Callee takes ownership of message, regardless of whether Send is |
533 // successful. See IPC::Message::Sender. | 533 // successful. See IPC::Sender. |
534 delete msg; | 534 delete msg; |
535 return false; | 535 return false; |
536 } | 536 } |
537 | 537 |
538 void CommandBufferProxyImpl::OnUpdateState( | 538 void CommandBufferProxyImpl::OnUpdateState( |
539 const gpu::CommandBuffer::State& state) { | 539 const gpu::CommandBuffer::State& state) { |
540 // Handle wraparound. It works as long as we don't have more than 2B state | 540 // Handle wraparound. It works as long as we don't have more than 2B state |
541 // updates in flight across which reordering occurs. | 541 // updates in flight across which reordering occurs. |
542 if (state.generation - last_state_.generation < 0x80000000U) | 542 if (state.generation - last_state_.generation < 0x80000000U) |
543 last_state_ = state; | 543 last_state_ = state; |
544 } | 544 } |
545 | 545 |
546 void CommandBufferProxyImpl::SetOnConsoleMessageCallback( | 546 void CommandBufferProxyImpl::SetOnConsoleMessageCallback( |
547 const GpuConsoleMessageCallback& callback) { | 547 const GpuConsoleMessageCallback& callback) { |
548 console_message_callback_ = callback; | 548 console_message_callback_ = callback; |
549 } | 549 } |
550 | 550 |
551 void CommandBufferProxyImpl::TryUpdateState() { | 551 void CommandBufferProxyImpl::TryUpdateState() { |
552 if (last_state_.error == gpu::error::kNoError) | 552 if (last_state_.error == gpu::error::kNoError) |
553 shared_state_->Read(&last_state_); | 553 shared_state_->Read(&last_state_); |
554 } | 554 } |
OLD | NEW |