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

Unified Diff: cc/base/util.h

Issue 807273005: cc: Prevent recursion in *TileTaskWorkerPool methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use DCHECK instead of CHECK. Created 6 years 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 | « no previous file | cc/resources/pixel_buffer_tile_task_worker_pool.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/base/util.h
diff --git a/cc/base/util.h b/cc/base/util.h
index 1d716ae2a42f4b4d25f1bf38e6fb38a4a9c806a3..03eda4572375cadbe8f1b2d07b2d2ee4f52c5044 100644
--- a/cc/base/util.h
+++ b/cc/base/util.h
@@ -8,6 +8,7 @@
#include <limits>
#include "base/basictypes.h"
+#include "base/logging.h"
namespace cc {
@@ -24,6 +25,23 @@ template <typename T> T RoundDown(T n, T mul) {
: ((n - mul + 1) / mul) * mul;
}
+class ScopedSingleEntry {
reveman 2014/12/18 19:24:07 This seems very similar to base::ThreadCollisionWa
vmiura 2014/12/18 21:16:48 DFAKE_SCOPED_LOCK() seems like a superset of what
reveman 2014/12/19 00:03:18 Yes, I think that's better than adding this new cl
+ public:
+ explicit ScopedSingleEntry(bool* single_entry_holder)
+ : single_entry_holder_(single_entry_holder) {
+ DCHECK(!*single_entry_holder_);
+ *single_entry_holder_ = true;
+ }
+
+ ~ScopedSingleEntry() {
+ DCHECK(*single_entry_holder_);
+ *single_entry_holder_ = false;
+ }
+
+ private:
+ bool* single_entry_holder_;
+};
+
} // namespace cc
#endif // CC_BASE_UTIL_H_
« no previous file with comments | « no previous file | cc/resources/pixel_buffer_tile_task_worker_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698