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

Unified Diff: trunk/src/mojo/services/public/cpp/view_manager/lib/view_tree_node.cc

Issue 286653003: Revert 270122 "Synchronizes View instances across clients." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: trunk/src/mojo/services/public/cpp/view_manager/lib/view_tree_node.cc
===================================================================
--- trunk/src/mojo/services/public/cpp/view_manager/lib/view_tree_node.cc (revision 270124)
+++ trunk/src/mojo/services/public/cpp/view_manager/lib/view_tree_node.cc (working copy)
@@ -6,17 +6,13 @@
#include "mojo/services/public/cpp/view_manager/lib/view_manager_private.h"
#include "mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h"
-#include "mojo/services/public/cpp/view_manager/lib/view_private.h"
#include "mojo/services/public/cpp/view_manager/lib/view_tree_node_private.h"
-#include "mojo/services/public/cpp/view_manager/view.h"
#include "mojo/services/public/cpp/view_manager/view_tree_node_observer.h"
namespace mojo {
namespace services {
namespace view_manager {
-namespace {
-
void NotifyViewTreeChangeAtReceiver(
ViewTreeNode* receiver,
const ViewTreeNodeObserver::TreeChangeParams& params) {
@@ -91,64 +87,6 @@
}
}
-class ScopedSetActiveViewNotifier {
- public:
- ScopedSetActiveViewNotifier(ViewTreeNode* node,
- View* old_view,
- View* new_view)
- : node_(node),
- old_view_(old_view),
- new_view_(new_view) {
- FOR_EACH_OBSERVER(
- ViewTreeNodeObserver,
- *ViewTreeNodePrivate(node).observers(),
- OnNodeActiveViewChange(node_,
- old_view_,
- new_view_,
- ViewTreeNodeObserver::DISPOSITION_CHANGING));
- }
- ~ScopedSetActiveViewNotifier() {
- FOR_EACH_OBSERVER(
- ViewTreeNodeObserver,
- *ViewTreeNodePrivate(node_).observers(),
- OnNodeActiveViewChange(node_,
- old_view_,
- new_view_,
- ViewTreeNodeObserver::DISPOSITION_CHANGED));
- }
-
- private:
- ViewTreeNode* node_;
- View* old_view_;
- View* new_view_;
-
- DISALLOW_COPY_AND_ASSIGN(ScopedSetActiveViewNotifier);
-};
-
-class ScopedDestructionNotifier {
- public:
- explicit ScopedDestructionNotifier(ViewTreeNode* node)
- : node_(node) {
- FOR_EACH_OBSERVER(
- ViewTreeNodeObserver,
- *ViewTreeNodePrivate(node_).observers(),
- OnNodeDestroy(node_, ViewTreeNodeObserver::DISPOSITION_CHANGING));
- }
- ~ScopedDestructionNotifier() {
- FOR_EACH_OBSERVER(
- ViewTreeNodeObserver,
- *ViewTreeNodePrivate(node_).observers(),
- OnNodeDestroy(node_, ViewTreeNodeObserver::DISPOSITION_CHANGED));
- }
-
- private:
- ViewTreeNode* node_;
-
- DISALLOW_COPY_AND_ASSIGN(ScopedDestructionNotifier);
-};
-
-} // namespace
-
////////////////////////////////////////////////////////////////////////////////
// ViewTreeNode, public:
@@ -176,24 +114,18 @@
}
void ViewTreeNode::AddChild(ViewTreeNode* child) {
- if (manager_)
- CHECK_EQ(ViewTreeNodePrivate(child).view_manager(), manager_);
LocalAddChild(child);
if (manager_)
ViewManagerPrivate(manager_).synchronizer()->AddChild(child->id(), id_);
}
void ViewTreeNode::RemoveChild(ViewTreeNode* child) {
- if (manager_)
- CHECK_EQ(ViewTreeNodePrivate(child).view_manager(), manager_);
LocalRemoveChild(child);
if (manager_)
ViewManagerPrivate(manager_).synchronizer()->RemoveChild(child->id(), id_);
}
bool ViewTreeNode::Contains(ViewTreeNode* child) const {
- if (manager_)
- CHECK_EQ(ViewTreeNodePrivate(child).view_manager(), manager_);
for (ViewTreeNode* p = child->parent(); p; p = p->parent()) {
if (p == this)
return true;
@@ -214,29 +146,25 @@
return NULL;
}
-void ViewTreeNode::SetActiveView(View* view) {
- if (manager_)
- CHECK_EQ(ViewPrivate(view).view_manager(), manager_);
- LocalSetActiveView(view);
- if (manager_) {
- ViewManagerPrivate(manager_).synchronizer()->SetActiveView(
- id_, active_view_->id());
- }
-}
-
////////////////////////////////////////////////////////////////////////////////
// ViewTreeNode, protected:
ViewTreeNode::ViewTreeNode()
: manager_(NULL),
id_(-1),
- parent_(NULL),
- active_view_(NULL) {}
+ parent_(NULL) {}
ViewTreeNode::~ViewTreeNode() {
- ScopedDestructionNotifier notifier(this);
+ FOR_EACH_OBSERVER(
+ ViewTreeNodeObserver,
+ observers_,
+ OnNodeDestroy(this, ViewTreeNodeObserver::DISPOSITION_CHANGING));
if (parent_)
parent_->LocalRemoveChild(this);
+ FOR_EACH_OBSERVER(
+ ViewTreeNodeObserver,
+ observers_,
+ OnNodeDestroy(this, ViewTreeNodeObserver::DISPOSITION_CHANGED));
if (manager_)
ViewManagerPrivate(manager_).RemoveNode(id_);
}
@@ -247,8 +175,7 @@
ViewTreeNode::ViewTreeNode(ViewManager* manager)
: manager_(manager),
id_(ViewManagerPrivate(manager).synchronizer()->CreateViewTreeNode()),
- parent_(NULL),
- active_view_(NULL) {}
+ parent_(NULL) {}
void ViewTreeNode::LocalDestroy() {
delete this;
@@ -268,15 +195,6 @@
RemoveChildImpl(child, &children_);
}
-void ViewTreeNode::LocalSetActiveView(View* view) {
- ScopedSetActiveViewNotifier notifier(this, active_view_, view);
- if (active_view_)
- ViewPrivate(active_view_).set_node(NULL);
- active_view_ = view;
- if (active_view_)
- ViewPrivate(active_view_).set_node(this);
-}
-
} // namespace view_manager
} // namespace services
} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698