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

Unified Diff: services/ui/view_manager/view_tree_state.cc

Issue 1552043002: Make Mozart view manager use the new compositor. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-12
Patch Set: apply review feedback Created 4 years, 11 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
« no previous file with comments | « services/ui/view_manager/view_tree_state.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/view_manager/view_tree_state.cc
diff --git a/services/ui/view_manager/view_tree_state.cc b/services/ui/view_manager/view_tree_state.cc
index e236c084f83eedface2abdb0befbf0ac09ca3436..4a69f2c318d7815e7c64c36b37269ce9c66826d3 100644
--- a/services/ui/view_manager/view_tree_state.cc
+++ b/services/ui/view_manager/view_tree_state.cc
@@ -2,19 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/logging.h"
#include "services/ui/view_manager/view_tree_state.h"
+#include "base/logging.h"
+#include "base/strings/stringprintf.h"
+
namespace view_manager {
-ViewTreeState::ViewTreeState(mojo::ui::ViewTreePtr view_tree)
+ViewTreeState::ViewTreeState(mojo::ui::ViewTreePtr view_tree,
+ mojo::ui::ViewTreeTokenPtr view_tree_token,
+ const std::string& label)
: view_tree_(view_tree.Pass()),
- root_(nullptr),
- explicit_root_(false),
- layout_request_pending_(false),
- layout_request_issued_(false),
+ view_tree_token_(view_tree_token.Pass()),
+ label_(label),
weak_factory_(this) {
DCHECK(view_tree_);
+ DCHECK(view_tree_token_);
}
ViewTreeState::~ViewTreeState() {}
@@ -35,4 +38,20 @@ void ViewTreeState::ResetRoot() {
root_ = nullptr;
}
+const std::string& ViewTreeState::FormattedLabel() {
+ if (formatted_label_cache_.empty()) {
+ formatted_label_cache_ =
+ label_.empty() ? base::StringPrintf("<%d>", view_tree_token_->value)
+ : base::StringPrintf("<%d:%s>", view_tree_token_->value,
+ label_.c_str());
+ }
+ return formatted_label_cache_;
+}
+
+std::ostream& operator<<(std::ostream& os, ViewTreeState* view_tree_state) {
+ if (!view_tree_state)
+ return os << "null";
+ return os << view_tree_state->FormattedLabel();
+}
+
} // namespace view_manager
« no previous file with comments | « services/ui/view_manager/view_tree_state.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698