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

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: 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
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..a0a6e1080fb3274b20ff85f5ae5d37a8f8ebe5af
--- /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 StringValue;
+class Value;
+
+namespace debug {
+
+class BASE_EXPORT TracedValue : public base::debug::ConvertableToTraceFormat {
willchan no longer on Chromium 2014/07/30 15:56:16 Nit: I think it's unnecessary to use base:: and ba
yurys 2014/07/31 12:06:09 Done. Overlooked that. Thanks.
+ 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, base::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();
+
+ base::DictionaryValue* GetCurrentDictionary();
+ base::ListValue* GetCurrentArray();
+
+ std::vector<base::Value*> stack_;
+ DISALLOW_COPY_AND_ASSIGN(TracedValue);
+};
+
+} // namespace debug
+} // namespace base
+
+#endif // BASE_DEBUG_TRACE_EVENT_ARGUMENT_H_

Powered by Google App Engine
This is Rietveld 408576698