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

Unified Diff: cc/test/thread_blocker.cc

Issue 671653005: SetNeedsRedraw directly when updating a visible tile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pinchblurmerge-test: testfix Created 6 years, 1 month 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
Index: cc/test/thread_blocker.cc
diff --git a/cc/test/thread_blocker.cc b/cc/test/thread_blocker.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f87ca8fd9c0a4e4367c8e6ec087ab1d1c4082f92
--- /dev/null
+++ b/cc/test/thread_blocker.cc
@@ -0,0 +1,39 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/test/thread_blocker.h"
+
+#include "base/bind.h"
+
+namespace cc {
+
+ThreadBlocker::ThreadBlocker()
+ : should_delay_(false),
+ waiter_(false /* manual_reset */, false /* initially_signaled */) {
+}
+
+ThreadBlocker::~ThreadBlocker() {
+}
+
+void ThreadBlocker::Wait() {
+ {
+ base::AutoLock lock(lock_);
+ if (!should_delay_)
+ return;
+ }
+ waiter_.Wait();
+}
+
+void ThreadBlocker::BlockWait() {
+ base::AutoLock lock(lock_);
+ should_delay_ = true;
+}
+
+void ThreadBlocker::UnblockWait() {
+ base::AutoLock lock(lock_);
+ should_delay_ = false;
+ waiter_.Signal();
+}
+
+} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698