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