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

Side by Side Diff: cc/test/thread_blocker.h

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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CC_TEST_THREAD_BLOCKER_H_
6 #define CC_TEST_THREAD_BLOCKER_H_
7
8 #include "base/synchronization/lock.h"
9 #include "base/synchronization/waitable_event.h"
10
11 namespace cc {
12
13 // This class will block inside the Wait() function after BlockWait() has been
14 // called until UnblockWait() is called. Because Wait() blocks, the
15 // UnblockWait() call must be done from another thread, so this class is safe to
16 // use on multiple threads.
17 class ThreadBlocker {
18 public:
19 ThreadBlocker();
20 ~ThreadBlocker();
21
22 // This will block if BlockWait() has been called until UnblockWait() is
23 // called.
24 void Wait();
25
26 // Makes future calls to Wait() block.
27 void BlockWait();
28 // Unblocks any current calls to Wait() and prevents future calls from
29 // blocking.
30 void UnblockWait();
31
32 private:
33 base::Lock lock_;
34 bool should_delay_;
35 base::WaitableEvent waiter_;
36
37 DISALLOW_COPY_AND_ASSIGN(ThreadBlocker);
38 };
39
40 } // namespace cc
41
42 #endif // CC_TEST_THREAD_BLOCKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698