| 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 <cinttypes> |
| 8 |
| 7 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 8 | 10 |
| 9 namespace compositor { | 11 namespace compositor { |
| 10 | 12 |
| 11 SceneLabel::SceneLabel(uint32_t token, const std::string& label) | 13 SceneLabel::SceneLabel(uint32_t token, const std::string& label) |
| 12 : token_(token), label_(label) {} | 14 : token_(token), label_(label) {} |
| 13 | 15 |
| 14 SceneLabel::SceneLabel(const SceneLabel& other) | 16 SceneLabel::SceneLabel(const SceneLabel& other) |
| 15 : token_(other.token_), label_(other.label_) {} | 17 : token_(other.token_), label_(other.label_) {} |
| 16 | 18 |
| 17 SceneLabel::~SceneLabel() {} | 19 SceneLabel::~SceneLabel() {} |
| 18 | 20 |
| 19 std::string SceneLabel::FormattedLabel() const { | 21 std::string SceneLabel::FormattedLabel() const { |
| 20 return label_.empty() | 22 return label_.empty() |
| 21 ? base::StringPrintf("<S%d>", token_) | 23 ? base::StringPrintf("<S%d>", token_) |
| 22 : base::StringPrintf("<S%d:%s>", token_, label_.c_str()); | 24 : base::StringPrintf("<S%d:%s>", token_, label_.c_str()); |
| 23 } | 25 } |
| 24 | 26 |
| 25 std::string SceneLabel::FormattedLabelForVersion(uint32_t version) const { | 27 std::string SceneLabel::FormattedLabelForVersion( |
| 26 return label_.empty() ? base::StringPrintf("<S%d/%d>", token_, version) | 28 uint32_t version, |
| 27 : base::StringPrintf("<S%d:%s/%d>", token_, | 29 int64_t presentation_time) const { |
| 28 label_.c_str(), version); | 30 return label_.empty() |
| 31 ? base::StringPrintf("<S%d/v%d@%" PRId64 ">", token_, version, |
| 32 presentation_time) |
| 33 : base::StringPrintf("<S%d:%s/v%d@%" PRId64 ">", token_, |
| 34 label_.c_str(), version, presentation_time); |
| 29 } | 35 } |
| 30 | 36 |
| 31 std::string SceneLabel::FormattedLabelForNode(uint32_t version, | 37 std::string SceneLabel::FormattedLabelForNode(uint32_t version, |
| 38 int64_t presentation_time, |
| 32 uint32_t node_id) const { | 39 uint32_t node_id) const { |
| 33 return label_.empty() | 40 return label_.empty() |
| 34 ? base::StringPrintf("<S%d/%d>[%d]", token_, version, node_id) | 41 ? base::StringPrintf("<S%d/v%d@%" PRId64 ">[#%d]", token_, version, |
| 35 : base::StringPrintf("<S%d:%s/%d>[%d]", token_, label_.c_str(), | 42 presentation_time, node_id) |
| 36 version, node_id); | 43 : base::StringPrintf("<S%d:%s/v%d@%" PRId64 ">[#%d]", token_, |
| 44 label_.c_str(), version, presentation_time, |
| 45 node_id); |
| 37 } | 46 } |
| 38 | 47 |
| 39 } // namespace compositor | 48 } // namespace compositor |
| OLD | NEW |