Chromium Code Reviews| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 | 126 |
| 127 class GrContext* ContextProviderCommandBuffer::GrContext() { | 127 class GrContext* ContextProviderCommandBuffer::GrContext() { |
| 128 DCHECK(lost_context_callback_proxy_); // Is bound to thread. | 128 DCHECK(lost_context_callback_proxy_); // Is bound to thread. |
| 129 DCHECK(context_thread_checker_.CalledOnValidThread()); | 129 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 130 | 130 |
| 131 if (gr_context_) | 131 if (gr_context_) |
| 132 return gr_context_->get(); | 132 return gr_context_->get(); |
| 133 | 133 |
| 134 gr_context_.reset( | 134 gr_context_.reset( |
| 135 new webkit::gpu::GrContextForWebGraphicsContext3D(context3d_.get())); | 135 new webkit::gpu::GrContextForWebGraphicsContext3D(context3d_.get())); |
| 136 | |
| 137 // If GlContext is already lost, also abandon the new GrContext. | |
| 138 if (gr_context_ && IsContextLost()) | |
|
piman
2015/03/09 22:22:05
nit: no need to test for gr_contex_, it's !NULL he
vmiura
2015/03/09 22:39:01
Ok, I'll remove the check.
I think lost context s
vmiura
2015/03/09 23:10:01
Extra NULL check remove Done.
| |
| 139 gr_context_->OnLostContext(); | |
|
no sievers
2015/03/09 21:25:48
Can abandonContext() safely be called more than on
vmiura
2015/03/09 21:42:52
bsalomon@: Is it safe to call abandonContext() mor
vmiura
2015/03/09 23:10:01
Calling abandonContext() directly Done.
| |
| 140 | |
| 136 return gr_context_->get(); | 141 return gr_context_->get(); |
| 137 } | 142 } |
| 138 | 143 |
| 139 void ContextProviderCommandBuffer::SetupLock() { | 144 void ContextProviderCommandBuffer::SetupLock() { |
| 140 DCHECK(context3d_); | 145 DCHECK(context3d_); |
| 141 context3d_->GetCommandBufferProxy()->SetLock(&context_lock_); | 146 context3d_->GetCommandBufferProxy()->SetLock(&context_lock_); |
| 142 } | 147 } |
| 143 | 148 |
| 144 base::Lock* ContextProviderCommandBuffer::GetLock() { | 149 base::Lock* ContextProviderCommandBuffer::GetLock() { |
| 145 return &context_lock_; | 150 return &context_lock_; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 | 233 |
| 229 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( | 234 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( |
| 230 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { | 235 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { |
| 231 DCHECK(context_thread_checker_.CalledOnValidThread()); | 236 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 232 DCHECK(memory_policy_changed_callback_.is_null() || | 237 DCHECK(memory_policy_changed_callback_.is_null() || |
| 233 memory_policy_changed_callback.is_null()); | 238 memory_policy_changed_callback.is_null()); |
| 234 memory_policy_changed_callback_ = memory_policy_changed_callback; | 239 memory_policy_changed_callback_ = memory_policy_changed_callback; |
| 235 } | 240 } |
| 236 | 241 |
| 237 } // namespace content | 242 } // namespace content |
| OLD | NEW |