Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1689)

Unified Diff: base/debug/trace_event_argument.h

Issue 380763002: Add builders for tracing event's structural arguments (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed memory leak found by Linux ASAN Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/base.gypi ('k') | base/debug/trace_event_argument.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/trace_event_argument.h
diff --git a/base/debug/trace_event_argument.h b/base/debug/trace_event_argument.h
new file mode 100644
index 0000000000000000000000000000000000000000..9d3535880b4e31847dcc8e30de8fde867c35628a
--- /dev/null
+++ b/base/debug/trace_event_argument.h
@@ -0,0 +1,59 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_DEBUG_TRACE_EVENT_ARGUMENT_H_
+#define BASE_DEBUG_TRACE_EVENT_ARGUMENT_H_
+
+#include <string>
+#include <vector>
+
+#include "base/debug/trace_event.h"
+#include "base/memory/scoped_ptr.h"
+
+namespace base {
+class DictionaryValue;
+class ListValue;
+class Value;
+
+namespace debug {
+
+class BASE_EXPORT TracedValue : public ConvertableToTraceFormat {
+ public:
+ TracedValue();
+
+ void EndDictionary();
+ void EndArray();
+
+ void SetInteger(const char* name, int value);
+ void SetDouble(const char* name, double);
+ void SetBoolean(const char* name, bool value);
+ void SetString(const char* name, const std::string& value);
+ void SetValue(const char* name, Value* value);
+ void BeginDictionary(const char* name);
+ void BeginArray(const char* name);
+
+ void AppendInteger(int);
+ void AppendDouble(double);
+ void AppendBoolean(bool);
+ void AppendString(const std::string&);
+ void BeginArray();
+ void BeginDictionary();
+
+ virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE;
+
+ private:
+ virtual ~TracedValue();
+
+ DictionaryValue* GetCurrentDictionary();
+ ListValue* GetCurrentArray();
+
+ scoped_ptr<base::Value> root_;
+ std::vector<Value*> stack_;
+ DISALLOW_COPY_AND_ASSIGN(TracedValue);
+};
+
+} // namespace debug
+} // namespace base
+
+#endif // BASE_DEBUG_TRACE_EVENT_ARGUMENT_H_
« no previous file with comments | « base/base.gypi ('k') | base/debug/trace_event_argument.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698