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 "gpu/ipc/client/command_buffer_proxy_impl.h" | 5 #include "gpu/ipc/client/command_buffer_proxy_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 flush_count_(0), | 53 flush_count_(0), |
54 last_put_offset_(-1), | 54 last_put_offset_(-1), |
55 last_barrier_put_offset_(-1), | 55 last_barrier_put_offset_(-1), |
56 next_fence_sync_release_(1), | 56 next_fence_sync_release_(1), |
57 flushed_fence_sync_release_(0), | 57 flushed_fence_sync_release_(0), |
58 verified_fence_sync_release_(0), | 58 verified_fence_sync_release_(0), |
59 next_signal_id_(0), | 59 next_signal_id_(0), |
60 weak_this_(AsWeakPtr()), | 60 weak_this_(AsWeakPtr()), |
61 callback_thread_(base::ThreadTaskRunnerHandle::Get()) { | 61 callback_thread_(base::ThreadTaskRunnerHandle::Get()) { |
62 DCHECK(channel_); | 62 DCHECK(channel_); |
63 DCHECK(stream_id); | 63 DCHECK_NE(stream_id, GPU_STREAM_INVALID); |
64 } | 64 } |
65 | 65 |
66 CommandBufferProxyImpl::~CommandBufferProxyImpl() { | 66 CommandBufferProxyImpl::~CommandBufferProxyImpl() { |
67 FOR_EACH_OBSERVER(DeletionObserver, deletion_observers_, OnWillDeleteImpl()); | 67 FOR_EACH_OBSERVER(DeletionObserver, deletion_observers_, OnWillDeleteImpl()); |
68 if (channel_) { | 68 if (channel_) { |
69 channel_->DestroyCommandBuffer(this); | 69 channel_->DestroyCommandBuffer(this); |
70 channel_ = nullptr; | 70 channel_ = nullptr; |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 const uint64_t token_channel = | 573 const uint64_t token_channel = |
574 sync_token->command_buffer_id().GetUnsafeValue() >> 32; | 574 sync_token->command_buffer_id().GetUnsafeValue() >> 32; |
575 const uint64_t channel = command_buffer_id_.GetUnsafeValue() >> 32; | 575 const uint64_t channel = command_buffer_id_.GetUnsafeValue() >> 32; |
576 if (sync_token->namespace_id() != gpu::CommandBufferNamespace::GPU_IO || | 576 if (sync_token->namespace_id() != gpu::CommandBufferNamespace::GPU_IO || |
577 token_channel != channel) { | 577 token_channel != channel) { |
578 return false; | 578 return false; |
579 } | 579 } |
580 | 580 |
581 // If waiting on a different stream, flush pending commands on that stream. | 581 // If waiting on a different stream, flush pending commands on that stream. |
582 const int32_t release_stream_id = sync_token->extra_data_field(); | 582 const int32_t release_stream_id = sync_token->extra_data_field(); |
583 if (release_stream_id == 0) | 583 if (release_stream_id == gpu::GPU_STREAM_INVALID) |
584 return false; | 584 return false; |
585 | 585 |
586 if (release_stream_id != stream_id_) | 586 if (release_stream_id != stream_id_) |
587 channel_->FlushPendingStream(release_stream_id); | 587 channel_->FlushPendingStream(release_stream_id); |
588 | 588 |
589 return true; | 589 return true; |
590 } | 590 } |
591 | 591 |
592 void CommandBufferProxyImpl::SignalQuery(uint32_t query, | 592 void CommandBufferProxyImpl::SignalQuery(uint32_t query, |
593 const base::Closure& callback) { | 593 const base::Closure& callback) { |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 // the client for lost context a single time. | 779 // the client for lost context a single time. |
780 if (!channel_) | 780 if (!channel_) |
781 return; | 781 return; |
782 channel_->DestroyCommandBuffer(this); | 782 channel_->DestroyCommandBuffer(this); |
783 channel_ = nullptr; | 783 channel_ = nullptr; |
784 if (gpu_control_client_) | 784 if (gpu_control_client_) |
785 gpu_control_client_->OnGpuControlLostContext(); | 785 gpu_control_client_->OnGpuControlLostContext(); |
786 } | 786 } |
787 | 787 |
788 } // namespace gpu | 788 } // namespace gpu |
OLD | NEW |