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

Issue 7076002: views: Get rid of View::SetParent() method. (Closed)

Created:
9 years, 7 months ago by tfarina
Modified:
9 years, 7 months ago
CC:
chromium-reviews
Visibility:
Public.

Description

views: Get rid of View::SetParent() method. This method is private to View class, and thus can be removed. BUG=72040 TEST=None R=ben@chromium.org Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=86775

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+3 lines, -12 lines) Patch
M views/view.h View 1 chunk +0 lines, -4 lines 0 comments Download
M views/view.cc View 4 chunks +3 lines, -8 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
tfarina
Idea stolen from here http://codereview.chromium.org/7057014/diff/1/views/view.h Please, take a look.
9 years, 7 months ago (2011-05-26 01:41:25 UTC) #1
Ben Goodger (Google)
9 years, 7 months ago (2011-05-26 01:55:29 UTC) #2
LGTM

On Wed, May 25, 2011 at 6:41 PM, <tfarina@chromium.org> wrote:

> Reviewers: Ben Goodger,
>
> Message:
> Idea stolen from here
> http://codereview.chromium.org/7057014/diff/1/views/view.h
>
> Please, take a look.
>
> Description:
> views: Get rid of View::SetParent() method.
>
> This method is private to View class, and thus can be removed.
>
> BUG=None
> TEST=None
>
> R=ben@chromium.org
>
>
> Please review this at http://codereview.chromium.org/7076002/
>
> SVN Base: svn://svn.chromium.org/chrome/trunk/src
>
> Affected files:
>  M views/view.h
>  M views/view.cc
>
>
> Index: views/view.cc
> diff --git a/views/view.cc b/views/view.cc
> index
>
3b409b6e7549c0a1c078d5d6c043b0e8eaf7802e..3fc06c61e7eb08aee85da6f34626b77aaba25f7d
> 100644
> --- a/views/view.cc
> +++ b/views/view.cc
> @@ -126,7 +126,7 @@ View::~View() {
>
>   int c = static_cast<int>(children_.size());
>   while (--c >= 0) {
> -    children_[c]->SetParent(NULL);
> +    children_[c]->parent_ = NULL;
>     if (children_[c]->IsParentOwned())
>       delete children_[c];
>   }
> @@ -164,7 +164,7 @@ void View::AddChildViewAt(View* view, int index) {
>
>   // Let's insert the view.
>   children_.insert(children_.begin() + index, view);
> -  view->SetParent(this);
> +  view->parent_ = this;
>
>   for (View* p = this; p; p = p->parent())
>     p->ViewHierarchyChangedImpl(false, true, this, view);
> @@ -1343,7 +1343,7 @@ void View::DoRemoveChildView(View* view,
>       UnregisterChildrenForVisibleBoundsNotification(view);
>     view->ResetTexture();
>     view->PropagateRemoveNotifications(this);
> -    view->SetParent(NULL);
> +    view->parent_ = NULL;
>
>     if (delete_removed_view && view->IsParentOwned())
>       view_to_be_deleted.reset(view);
> @@ -1358,11 +1358,6 @@ void View::DoRemoveChildView(View* view,
>     layout_manager_->ViewRemoved(this, view);
>  }
>
> -void View::SetParent(View* parent) {
> -  if (parent != parent_)
> -    parent_ = parent;
> -}
> -
>  void View::PropagateRemoveNotifications(View* parent) {
>   for (int i = 0, count = child_count(); i < count; ++i)
>     GetChildViewAt(i)->PropagateRemoveNotifications(parent);
> Index: views/view.h
> diff --git a/views/view.h b/views/view.h
> index
>
a8dd6c95dcf83fe680b9403eb42c5407e04b7b17..0eed99de58a9f4b957b6137da69b485dbe7cd0f1
> 100644
> --- a/views/view.h
> +++ b/views/view.h
> @@ -1163,10 +1163,6 @@ class View : public AcceleratorTarget {
>                          bool update_tool_tip,
>                          bool delete_removed_view);
>
> -  // Sets the parent View. This is called automatically by AddChild and is
> -  // thus private.
> -  void SetParent(View* parent);
> -
>   // Call ViewHierarchyChanged for all child views on all parents
>   void PropagateRemoveNotifications(View* parent);
>
>
>
>

Powered by Google App Engine
This is Rietveld 408576698