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

Unified Diff: ui/views/view.h

Issue 2591323002: [views] Changes iteration over |children_| to use range-based for loops (reland) (Closed)
Patch Set: [views] Changes iteration over |children_| to use range-based for loops (comments) Created 4 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 | ui/views/view.cc » ('j') | ui/views/view.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/view.h
diff --git a/ui/views/view.h b/ui/views/view.h
index a6811afca8a5c084b0d81d5ab375e483cc46c006..5c88e2c98852c1d693499e330ba4a4f9243fc89c 100644
--- a/ui/views/view.h
+++ b/ui/views/view.h
@@ -84,6 +84,10 @@ class PostEventDispatchHandler;
class RootView;
}
+namespace {
+class ScopedChildrenLock;
+}
sadrul 2016/12/24 00:13:11 Oh, missed this, sorry. This should not be in anon
+
/////////////////////////////////////////////////////////////////////////////
//
// View class
@@ -1230,6 +1234,7 @@ class VIEWS_EXPORT View : public ui::LayerDelegate,
friend class internal::PostEventDispatchHandler;
friend class internal::RootView;
friend class FocusManager;
+ friend class ScopedChildrenLock;
friend class ViewLayerTest;
friend class Widget;
@@ -1466,6 +1471,12 @@ class VIEWS_EXPORT View : public ui::LayerDelegate,
// This view's children.
Views children_;
+#if DCHECK_IS_ON()
+ // True while iterating over |children_|. Used to detect and DCHECK when
+ // |children_| is mutated during iteration.
+ mutable bool iterating_;
+#endif
+
// Size and disposition ------------------------------------------------------
// This View's bounds in the parent coordinate system.
« no previous file with comments | « no previous file | ui/views/view.cc » ('j') | ui/views/view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698