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

Unified 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: fix tear down 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/compositor/test/in_process_context_provider.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/test/in_process_context_provider.cc
diff --git a/ui/compositor/test/in_process_context_provider.cc b/ui/compositor/test/in_process_context_provider.cc
index 76cd19dc191ff8624982205a2d93b573b0058ecb..57a64ada4e9231c4d73f344b944178d2c284fede 100644
--- a/ui/compositor/test/in_process_context_provider.cc
+++ b/ui/compositor/test/in_process_context_provider.cc
@@ -80,14 +80,19 @@ InProcessContextProvider::InProcessContextProvider(
image_factory_(image_factory),
window_(window),
debug_name_(debug_name),
+ lost_(false),
destroyed_(false) {
DCHECK(main_thread_checker_.CalledOnValidThread());
context_thread_checker_.DetachFromThread();
}
-InProcessContextProvider::~InProcessContextProvider() {
- DCHECK(main_thread_checker_.CalledOnValidThread() ||
- context_thread_checker_.CalledOnValidThread());
+InProcessContextProvider::~InProcessContextProvider() {}
+
+void InProcessContextProvider::Destroy() {
+ DCHECK(main_thread_checker_.CalledOnValidThread());
+ gr_context_ = nullptr;
+ context_.reset();
+ destroyed_ = true;
}
bool InProcessContextProvider::BindToCurrentThread() {
@@ -200,11 +205,11 @@ void InProcessContextProvider::DeleteCachedResources() {
}
}
-bool InProcessContextProvider::DestroyedOnMainThread() {
+bool InProcessContextProvider::HasBeenLostOnMainThread() {
DCHECK(main_thread_checker_.CalledOnValidThread());
- base::AutoLock lock(destroyed_lock_);
- return destroyed_;
+ base::AutoLock lock(lost_lock_);
+ return lost_;
}
void InProcessContextProvider::SetLostContextCallback(
@@ -220,10 +225,10 @@ void InProcessContextProvider::SetMemoryPolicyChangedCallback(
void InProcessContextProvider::OnLostContext() {
DCHECK(context_thread_checker_.CalledOnValidThread());
{
- base::AutoLock lock(destroyed_lock_);
- if (destroyed_)
+ base::AutoLock lock(lost_lock_);
+ if (lost_)
return;
- destroyed_ = true;
+ lost_ = true;
}
if (!lost_context_callback_.is_null())
base::ResetAndReturn(&lost_context_callback_).Run();
@@ -231,4 +236,9 @@ void InProcessContextProvider::OnLostContext() {
gr_context_->abandonContext();
}
+bool InProcessContextProvider::HasBeenDestroyed() {
+ DCHECK(context_thread_checker_.CalledOnValidThread());
+ return destroyed_;
+}
+
} // namespace ui
« no previous file with comments | « ui/compositor/test/in_process_context_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698