OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "gpu/command_buffer/common/debug_marker_manager.h" | 5 #include "gpu/command_buffer/common/debug_marker_manager.h" |
6 | 6 |
7 namespace gpu { | 7 namespace gpu { |
8 namespace gles2 { | 8 namespace gles2 { |
9 | 9 |
10 DebugMarkerManager::Group::Group(const std::string& name) | 10 DebugMarkerManager::Group::Group(const std::string& name) |
11 : name_(name), | 11 : name_(name), |
12 marker_(name) { | 12 marker_(name) { |
13 } | 13 } |
14 | 14 |
15 DebugMarkerManager::Group::~Group() { | 15 DebugMarkerManager::Group::~Group() { |
16 } | 16 } |
17 | 17 |
18 void DebugMarkerManager::Group::SetMarker(const std::string& marker) { | 18 void DebugMarkerManager::Group::SetMarker(const std::string& marker) { |
19 marker_ = name_ + "." + marker; | 19 marker_ = name_ + "." + marker; |
20 } | 20 } |
21 | 21 |
22 DebugMarkerManager::DebugMarkerManager() { | 22 DebugMarkerManager::DebugMarkerManager() { |
23 // Push root group. | 23 // Push root group. |
24 group_stack_.push(Group(std::string(""))); | 24 group_stack_.push(Group(std::string(""))); |
25 }; | 25 } |
26 | 26 |
27 DebugMarkerManager::~DebugMarkerManager() { | 27 DebugMarkerManager::~DebugMarkerManager() { |
28 } | 28 } |
29 | 29 |
30 void DebugMarkerManager::SetMarker(const std::string& marker) { | 30 void DebugMarkerManager::SetMarker(const std::string& marker) { |
31 group_stack_.top().SetMarker(marker); | 31 group_stack_.top().SetMarker(marker); |
32 } | 32 } |
33 | 33 |
34 const std::string& DebugMarkerManager::GetMarker() const { | 34 const std::string& DebugMarkerManager::GetMarker() const { |
35 return group_stack_.top().marker(); | 35 return group_stack_.top().marker(); |
36 } | 36 } |
37 | 37 |
38 void DebugMarkerManager::PushGroup(const std::string& name) { | 38 void DebugMarkerManager::PushGroup(const std::string& name) { |
39 group_stack_.push(Group(group_stack_.top().name() + "." + name)); | 39 group_stack_.push(Group(group_stack_.top().name() + "." + name)); |
40 } | 40 } |
41 | 41 |
42 void DebugMarkerManager::PopGroup(void) { | 42 void DebugMarkerManager::PopGroup(void) { |
43 if (group_stack_.size() > 1) { | 43 if (group_stack_.size() > 1) { |
44 group_stack_.pop(); | 44 group_stack_.pop(); |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 } // namespace gles2 | 48 } // namespace gles2 |
49 } // namespace gpu | 49 } // namespace gpu |
50 | 50 |
51 | 51 |
OLD | NEW |