Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Side by Side Diff: ui/compositor/test/in_process_context_provider.cc

Issue 1317743002: cc: Implement shared worker contexts. (v1) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: invalidate weak ptrs when detaching context from thread Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "ui/compositor/test/in_process_context_provider.h" 5 #include "ui/compositor/test/in_process_context_provider.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/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 const LostContextCallback& lost_context_callback) { 211 const LostContextCallback& lost_context_callback) {
212 lost_context_callback_ = lost_context_callback; 212 lost_context_callback_ = lost_context_callback;
213 } 213 }
214 214
215 void InProcessContextProvider::SetMemoryPolicyChangedCallback( 215 void InProcessContextProvider::SetMemoryPolicyChangedCallback(
216 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { 216 const MemoryPolicyChangedCallback& memory_policy_changed_callback) {
217 // There's no memory manager for the in-process implementation. 217 // There's no memory manager for the in-process implementation.
218 } 218 }
219 219
220 void InProcessContextProvider::OnLostContext() { 220 void InProcessContextProvider::OnLostContext() {
221 DCHECK(context_thread_checker_.CalledOnValidThread()); 221 // Note: no thread check here as this should not change the thread for which
222 // this context is currently bound. e.g. a worker context might be unbound
223 // and this should not result in it being bound to the current thread.
222 { 224 {
223 base::AutoLock lock(destroyed_lock_); 225 base::AutoLock lock(destroyed_lock_);
224 if (destroyed_) 226 if (destroyed_)
225 return; 227 return;
226 destroyed_ = true; 228 destroyed_ = true;
227 } 229 }
228 if (!lost_context_callback_.is_null()) 230 if (!lost_context_callback_.is_null())
229 base::ResetAndReturn(&lost_context_callback_).Run(); 231 base::ResetAndReturn(&lost_context_callback_).Run();
230 if (gr_context_) 232 if (gr_context_)
231 gr_context_->abandonContext(); 233 gr_context_->abandonContext();
232 } 234 }
233 235
234 } // namespace ui 236 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698