| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 void ContextProviderInProcess::OnLostContext() { | 167 void ContextProviderInProcess::OnLostContext() { |
| 168 DCHECK(context_thread_checker_.CalledOnValidThread()); | 168 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 169 { | 169 { |
| 170 base::AutoLock lock(destroyed_lock_); | 170 base::AutoLock lock(destroyed_lock_); |
| 171 if (destroyed_) | 171 if (destroyed_) |
| 172 return; | 172 return; |
| 173 destroyed_ = true; | 173 destroyed_ = true; |
| 174 } | 174 } |
| 175 if (!lost_context_callback_.is_null()) | 175 if (!lost_context_callback_.is_null()) |
| 176 base::ResetAndReturn(&lost_context_callback_).Run(); | 176 base::ResetAndReturn(&lost_context_callback_).Run(); |
| 177 if (gr_context_) |
| 178 gr_context_->OnLostContext(); |
| 177 } | 179 } |
| 178 | 180 |
| 179 bool ContextProviderInProcess::DestroyedOnMainThread() { | 181 bool ContextProviderInProcess::DestroyedOnMainThread() { |
| 180 DCHECK(main_thread_checker_.CalledOnValidThread()); | 182 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 181 | 183 |
| 182 base::AutoLock lock(destroyed_lock_); | 184 base::AutoLock lock(destroyed_lock_); |
| 183 return destroyed_; | 185 return destroyed_; |
| 184 } | 186 } |
| 185 | 187 |
| 186 void ContextProviderInProcess::SetLostContextCallback( | 188 void ContextProviderInProcess::SetLostContextCallback( |
| 187 const LostContextCallback& lost_context_callback) { | 189 const LostContextCallback& lost_context_callback) { |
| 188 DCHECK(context_thread_checker_.CalledOnValidThread()); | 190 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 189 DCHECK(lost_context_callback_.is_null() || | 191 DCHECK(lost_context_callback_.is_null() || |
| 190 lost_context_callback.is_null()); | 192 lost_context_callback.is_null()); |
| 191 lost_context_callback_ = lost_context_callback; | 193 lost_context_callback_ = lost_context_callback; |
| 192 } | 194 } |
| 193 | 195 |
| 194 void ContextProviderInProcess::SetMemoryPolicyChangedCallback( | 196 void ContextProviderInProcess::SetMemoryPolicyChangedCallback( |
| 195 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { | 197 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { |
| 196 // There's no memory manager for the in-process implementation. | 198 // There's no memory manager for the in-process implementation. |
| 197 } | 199 } |
| 198 | 200 |
| 199 } // namespace gpu | 201 } // namespace gpu |
| 200 } // namespace webkit | 202 } // namespace webkit |
| OLD | NEW |