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 |