| 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 "webkit/common/gpu/context_provider_in_process.h" | 5 #include "webkit/common/gpu/context_provider_in_process.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "cc/output/managed_memory_policy.h" | 10 #include "cc/output/managed_memory_policy.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 DCHECK(lost_context_callback_proxy_); // Is bound to thread. | 153 DCHECK(lost_context_callback_proxy_); // Is bound to thread. |
| 154 DCHECK(context_thread_checker_.CalledOnValidThread()); | 154 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 155 | 155 |
| 156 if (gr_context_) | 156 if (gr_context_) |
| 157 return gr_context_->get(); | 157 return gr_context_->get(); |
| 158 | 158 |
| 159 gr_context_.reset(new GrContextForWebGraphicsContext3D(context3d_.get())); | 159 gr_context_.reset(new GrContextForWebGraphicsContext3D(context3d_.get())); |
| 160 return gr_context_->get(); | 160 return gr_context_->get(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void ContextProviderInProcess::DoInvalidateGrContext(uint32_t state) { |
| 164 if (gr_context_) { |
| 165 DCHECK(lost_context_callback_proxy_); // Is bound to thread. |
| 166 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 167 gr_context_->get()->resetContext(state); |
| 168 } |
| 169 } |
| 170 |
| 163 void ContextProviderInProcess::SetupLock() { | 171 void ContextProviderInProcess::SetupLock() { |
| 164 context3d_->SetLock(&context_lock_); | 172 context3d_->SetLock(&context_lock_); |
| 165 } | 173 } |
| 166 | 174 |
| 167 base::Lock* ContextProviderInProcess::GetLock() { | 175 base::Lock* ContextProviderInProcess::GetLock() { |
| 168 return &context_lock_; | 176 return &context_lock_; |
| 169 } | 177 } |
| 170 | 178 |
| 171 bool ContextProviderInProcess::IsContextLost() { | 179 bool ContextProviderInProcess::IsContextLost() { |
| 172 DCHECK(lost_context_callback_proxy_); // Is bound to thread. | 180 DCHECK(lost_context_callback_proxy_); // Is bound to thread. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 lost_context_callback_ = lost_context_callback; | 227 lost_context_callback_ = lost_context_callback; |
| 220 } | 228 } |
| 221 | 229 |
| 222 void ContextProviderInProcess::SetMemoryPolicyChangedCallback( | 230 void ContextProviderInProcess::SetMemoryPolicyChangedCallback( |
| 223 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { | 231 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { |
| 224 // There's no memory manager for the in-process implementation. | 232 // There's no memory manager for the in-process implementation. |
| 225 } | 233 } |
| 226 | 234 |
| 227 } // namespace gpu | 235 } // namespace gpu |
| 228 } // namespace webkit | 236 } // namespace webkit |
| OLD | NEW |