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