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

Unified Diff: services/gfx/compositor/graph/scene_label.cc

Issue 1749063002: Mozart: Improve internal scene graph representation. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-0
Patch Set: avoid unnecessary hashtable lookups Created 4 years, 10 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/gfx/compositor/graph/scene_label.h ('k') | services/gfx/compositor/graph/snapshot.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/gfx/compositor/graph/scene_label.cc
diff --git a/services/gfx/compositor/graph/scene_label.cc b/services/gfx/compositor/graph/scene_label.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e4dfec019179a8d6c334a75077151f07d1d2e0fa
--- /dev/null
+++ b/services/gfx/compositor/graph/scene_label.cc
@@ -0,0 +1,38 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "services/gfx/compositor/graph/scene_label.h"
+
+#include "base/strings/stringprintf.h"
+
+namespace compositor {
+
+SceneLabel::SceneLabel(uint32_t token, const std::string& label)
+ : token_(token), label_(label) {}
+
+SceneLabel::SceneLabel(const SceneLabel& other)
+ : token_(other.token_), label_(other.label_) {}
+
+SceneLabel::~SceneLabel() {}
+
+std::string SceneLabel::FormattedLabel() const {
+ return label_.empty() ? base::StringPrintf("<%d>", token_)
+ : base::StringPrintf("<%d:%s>", token_, label_.c_str());
+}
+
+std::string SceneLabel::FormattedLabelForVersion(uint32_t version) const {
+ return label_.empty() ? base::StringPrintf("<%d/%d>", token_, version)
+ : base::StringPrintf("<%d:%s/%d>", token_,
+ label_.c_str(), version);
+}
+
+std::string SceneLabel::FormattedLabelForNode(uint32_t version,
+ uint32_t node_id) const {
+ return label_.empty()
+ ? base::StringPrintf("<%d/%d>[%d]", token_, version, node_id)
+ : base::StringPrintf("<%d:%s/%d>[%d]", token_, label_.c_str(),
+ version, node_id);
+}
+
+} // namespace compositor
« no previous file with comments | « services/gfx/compositor/graph/scene_label.h ('k') | services/gfx/compositor/graph/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698