| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 (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) { |
| 147 if (gr_context_) { |
| 148 DCHECK(lost_context_callback_proxy_); // Is bound to thread. |
| 149 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 150 gr_context_->get()->resetContext(state); |
| 151 } |
| 152 } |
| 153 |
| 146 void ContextProviderCommandBuffer::SetupLock() { | 154 void ContextProviderCommandBuffer::SetupLock() { |
| 147 DCHECK(context3d_); | 155 DCHECK(context3d_); |
| 148 context3d_->GetCommandBufferProxy()->SetLock(&context_lock_); | 156 context3d_->GetCommandBufferProxy()->SetLock(&context_lock_); |
| 149 } | 157 } |
| 150 | 158 |
| 151 base::Lock* ContextProviderCommandBuffer::GetLock() { | 159 base::Lock* ContextProviderCommandBuffer::GetLock() { |
| 152 return &context_lock_; | 160 return &context_lock_; |
| 153 } | 161 } |
| 154 | 162 |
| 155 cc::ContextProvider::Capabilities | 163 cc::ContextProvider::Capabilities |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 243 |
| 236 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( | 244 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( |
| 237 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { | 245 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { |
| 238 DCHECK(context_thread_checker_.CalledOnValidThread()); | 246 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 239 DCHECK(memory_policy_changed_callback_.is_null() || | 247 DCHECK(memory_policy_changed_callback_.is_null() || |
| 240 memory_policy_changed_callback.is_null()); | 248 memory_policy_changed_callback.is_null()); |
| 241 memory_policy_changed_callback_ = memory_policy_changed_callback; | 249 memory_policy_changed_callback_ = memory_policy_changed_callback; |
| 242 } | 250 } |
| 243 | 251 |
| 244 } // namespace content | 252 } // namespace content |
| OLD | NEW |