OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "services/gfx/compositor/graph/scene_label.h" |
| 6 |
| 7 #include "base/strings/stringprintf.h" |
| 8 |
| 9 namespace compositor { |
| 10 |
| 11 SceneLabel::SceneLabel(uint32_t token, const std::string& label) |
| 12 : token_(token), label_(label) {} |
| 13 |
| 14 SceneLabel::SceneLabel(const SceneLabel& other) |
| 15 : token_(other.token_), label_(other.label_) {} |
| 16 |
| 17 SceneLabel::~SceneLabel() {} |
| 18 |
| 19 std::string SceneLabel::FormattedLabel() const { |
| 20 return label_.empty() ? base::StringPrintf("<%d>", token_) |
| 21 : base::StringPrintf("<%d:%s>", token_, label_.c_str()); |
| 22 } |
| 23 |
| 24 std::string SceneLabel::FormattedLabelForVersion(uint32_t version) const { |
| 25 return label_.empty() ? base::StringPrintf("<%d/%d>", token_, version) |
| 26 : base::StringPrintf("<%d:%s/%d>", token_, |
| 27 label_.c_str(), version); |
| 28 } |
| 29 |
| 30 std::string SceneLabel::FormattedLabelForNode(uint32_t version, |
| 31 uint32_t node_id) const { |
| 32 return label_.empty() |
| 33 ? base::StringPrintf("<%d/%d>[%d]", token_, version, node_id) |
| 34 : base::StringPrintf("<%d:%s/%d>[%d]", token_, label_.c_str(), |
| 35 version, node_id); |
| 36 } |
| 37 |
| 38 } // namespace compositor |
OLD | NEW |