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#ifndef GPU_COMMAND_BUFFER_SERVICE_DEBUG_MARKER_MANAGER_H_
6#define GPU_COMMAND_BUFFER_SERVICE_DEBUG_MARKER_MANAGER_H_
7
8#include <stack>
9#include <string>
10#include "gpu/gpu_export.h"
11
12namespace gpu {
13namespace gles2 {
14
15// Tracks debug marker.
16class GPU_EXPORT DebugMarkerManager {
17 public:
18   DebugMarkerManager();
19   ~DebugMarkerManager();
20
21  // Gets the current marker on the top group.
22  const std::string& GetMarker() const;
23  // Sets the current marker on the top group.
24  void SetMarker(const std::string& marker);
25  // Pushes a new group.
26  void PushGroup(const std::string& name);
27  // Removes the top group. This is safe to call even when stack is empty.
28  void PopGroup(void);
29
30 private:
31  // Info about Buffers currently in the system.
32  class Group {
33   public:
34    explicit Group(const std::string& name);
35    ~Group();
36
37    const std::string& name() const {
38      return name_;
39    }
40
41    void SetMarker(const std::string& marker);
42
43    const std::string& marker() const {
44      return marker_;
45    }
46
47   private:
48    std::string name_;
49    std::string marker_;
50  };
51
52  typedef std::stack<Group> GroupStack;
53
54  GroupStack group_stack_;
55  std::string empty_;
56};
57
58}  // namespace gles2
59}  // namespace gpu
60
61#endif  // GPU_COMMAND_BUFFER_SERVICE_DEBUG_MARKER_MANAGER_H_
62
63