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

Side by Side 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 3 years, 12 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/view.cc » ('j') | ui/views/view.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_VIEWS_VIEW_H_ 5 #ifndef UI_VIEWS_VIEW_H_
6 #define UI_VIEWS_VIEW_H_ 6 #define UI_VIEWS_VIEW_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 class ViewObserver; 77 class ViewObserver;
78 class Widget; 78 class Widget;
79 class WordLookupClient; 79 class WordLookupClient;
80 80
81 namespace internal { 81 namespace internal {
82 class PreEventDispatchHandler; 82 class PreEventDispatchHandler;
83 class PostEventDispatchHandler; 83 class PostEventDispatchHandler;
84 class RootView; 84 class RootView;
85 } 85 }
86 86
87 namespace {
88 class ScopedChildrenLock;
89 }
sadrul 2016/12/24 00:13:11 Oh, missed this, sorry. This should not be in anon
90
87 ///////////////////////////////////////////////////////////////////////////// 91 /////////////////////////////////////////////////////////////////////////////
88 // 92 //
89 // View class 93 // View class
90 // 94 //
91 // A View is a rectangle within the views View hierarchy. It is the base 95 // A View is a rectangle within the views View hierarchy. It is the base
92 // class for all Views. 96 // class for all Views.
93 // 97 //
94 // A View is a container of other Views (there is no such thing as a Leaf 98 // A View is a container of other Views (there is no such thing as a Leaf
95 // View - makes code simpler, reduces type conversion headaches, design 99 // View - makes code simpler, reduces type conversion headaches, design
96 // mistakes etc) 100 // mistakes etc)
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 // decide which object should be used to obtain the children, but this 1227 // decide which object should be used to obtain the children, but this
1224 // function makes the decision explicit. 1228 // function makes the decision explicit.
1225 std::string DoPrintViewGraph(bool first, View* view_with_children); 1229 std::string DoPrintViewGraph(bool first, View* view_with_children);
1226 #endif 1230 #endif
1227 1231
1228 private: 1232 private:
1229 friend class internal::PreEventDispatchHandler; 1233 friend class internal::PreEventDispatchHandler;
1230 friend class internal::PostEventDispatchHandler; 1234 friend class internal::PostEventDispatchHandler;
1231 friend class internal::RootView; 1235 friend class internal::RootView;
1232 friend class FocusManager; 1236 friend class FocusManager;
1237 friend class ScopedChildrenLock;
1233 friend class ViewLayerTest; 1238 friend class ViewLayerTest;
1234 friend class Widget; 1239 friend class Widget;
1235 1240
1236 // Painting ----------------------------------------------------------------- 1241 // Painting -----------------------------------------------------------------
1237 1242
1238 enum SchedulePaintType { 1243 enum SchedulePaintType {
1239 // Indicates the size is the same (only the origin changed). 1244 // Indicates the size is the same (only the origin changed).
1240 SCHEDULE_PAINT_SIZE_SAME, 1245 SCHEDULE_PAINT_SIZE_SAME,
1241 1246
1242 // Indicates the size changed (and possibly the origin). 1247 // Indicates the size changed (and possibly the origin).
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 int group_; 1464 int group_;
1460 1465
1461 // Tree operations ----------------------------------------------------------- 1466 // Tree operations -----------------------------------------------------------
1462 1467
1463 // This view's parent. 1468 // This view's parent.
1464 View* parent_; 1469 View* parent_;
1465 1470
1466 // This view's children. 1471 // This view's children.
1467 Views children_; 1472 Views children_;
1468 1473
1474 #if DCHECK_IS_ON()
1475 // True while iterating over |children_|. Used to detect and DCHECK when
1476 // |children_| is mutated during iteration.
1477 mutable bool iterating_;
1478 #endif
1479
1469 // Size and disposition ------------------------------------------------------ 1480 // Size and disposition ------------------------------------------------------
1470 1481
1471 // This View's bounds in the parent coordinate system. 1482 // This View's bounds in the parent coordinate system.
1472 gfx::Rect bounds_; 1483 gfx::Rect bounds_;
1473 1484
1474 // Whether this view is visible. 1485 // Whether this view is visible.
1475 bool visible_; 1486 bool visible_;
1476 1487
1477 // Whether this view is enabled. 1488 // Whether this view is enabled.
1478 bool enabled_; 1489 bool enabled_;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1583 // Observers ------------------------------------------------------------- 1594 // Observers -------------------------------------------------------------
1584 1595
1585 base::ObserverList<ViewObserver> observers_; 1596 base::ObserverList<ViewObserver> observers_;
1586 1597
1587 DISALLOW_COPY_AND_ASSIGN(View); 1598 DISALLOW_COPY_AND_ASSIGN(View);
1588 }; 1599 };
1589 1600
1590 } // namespace views 1601 } // namespace views
1591 1602
1592 #endif // UI_VIEWS_VIEW_H_ 1603 #endif // UI_VIEWS_VIEW_H_
OLDNEW
« 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