OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/context_provider_command_buffer.h" | 5 #include "content/common/gpu/client/context_provider_command_buffer.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 class GrContext* ContextProviderCommandBuffer::GrContext() { | 130 class GrContext* ContextProviderCommandBuffer::GrContext() { |
131 DCHECK(lost_context_callback_proxy_); // Is bound to thread. | 131 DCHECK(lost_context_callback_proxy_); // Is bound to thread. |
132 DCHECK(context_thread_checker_.CalledOnValidThread()); | 132 DCHECK(context_thread_checker_.CalledOnValidThread()); |
133 | 133 |
134 if (gr_context_) | 134 if (gr_context_) |
135 return gr_context_->get(); | 135 return gr_context_->get(); |
136 | 136 |
137 gr_context_.reset(new GrContextForWebGraphicsContext3D(context3d_.get())); | 137 gr_context_.reset(new GrContextForWebGraphicsContext3D(context3d_.get())); |
138 | 138 |
139 // If GlContext is already lost, also abandon the new GrContext. | 139 // If GlContext is already lost, also abandon the new GrContext. |
140 if (IsContextLost()) | 140 if (gr_context_->get() && IsContextLost()) |
141 gr_context_->get()->abandonContext(); | 141 gr_context_->get()->abandonContext(); |
142 | 142 |
143 return gr_context_->get(); | 143 return gr_context_->get(); |
144 } | 144 } |
145 | 145 |
146 void ContextProviderCommandBuffer::InvalidateGrContext(uint32_t state) { | 146 void ContextProviderCommandBuffer::InvalidateGrContext(uint32_t state) { |
147 if (gr_context_) { | 147 if (gr_context_) { |
148 DCHECK(lost_context_callback_proxy_); // Is bound to thread. | 148 DCHECK(lost_context_callback_proxy_); // Is bound to thread. |
149 DCHECK(context_thread_checker_.CalledOnValidThread()); | 149 DCHECK(context_thread_checker_.CalledOnValidThread()); |
150 gr_context_->get()->resetContext(state); | 150 gr_context_->get()->resetContext(state); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 | 243 |
244 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( | 244 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( |
245 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { | 245 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { |
246 DCHECK(context_thread_checker_.CalledOnValidThread()); | 246 DCHECK(context_thread_checker_.CalledOnValidThread()); |
247 DCHECK(memory_policy_changed_callback_.is_null() || | 247 DCHECK(memory_policy_changed_callback_.is_null() || |
248 memory_policy_changed_callback.is_null()); | 248 memory_policy_changed_callback.is_null()); |
249 memory_policy_changed_callback_ = memory_policy_changed_callback; | 249 memory_policy_changed_callback_ = memory_policy_changed_callback; |
250 } | 250 } |
251 | 251 |
252 } // namespace content | 252 } // namespace content |
OLD | NEW |