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

Unified Diff: base/trace_event/trace_event_argument.h

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 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/trace_event/trace_event_android.cc ('k') | base/trace_event/trace_event_argument.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_event_argument.h
diff --git a/base/trace_event/trace_event_argument.h b/base/trace_event/trace_event_argument.h
index 56f7c617f9e8ea0a6bb83071766a3e73f3e06a62..aab58bc5ba75b1c8933c794502ac9c148af95973 100644
--- a/base/trace_event/trace_event_argument.h
+++ b/base/trace_event/trace_event_argument.h
@@ -9,11 +9,11 @@
#include <vector>
#include "base/memory/scoped_ptr.h"
+#include "base/pickle.h"
#include "base/trace_event/trace_event.h"
namespace base {
-class DictionaryValue;
-class ListValue;
+
class Value;
namespace trace_event {
@@ -21,18 +21,31 @@ namespace trace_event {
class BASE_EXPORT TracedValue : public ConvertableToTraceFormat {
public:
TracedValue();
+ explicit TracedValue(size_t capacity);
void EndDictionary();
void EndArray();
+ // These methods assume that |name| is a long lived "quoted" string.
void SetInteger(const char* name, int value);
void SetDouble(const char* name, double value);
void SetBoolean(const char* name, bool value);
void SetString(const char* name, const std::string& value);
- void SetValue(const char* name, scoped_ptr<Value> value);
+ void SetValue(const char* name, const TracedValue& value);
void BeginDictionary(const char* name);
void BeginArray(const char* name);
+ // These, instead, can be safely passed a temporary string.
+ void SetIntegerWithCopiedName(const std::string& name, int value);
+ void SetDoubleWithCopiedName(const std::string& name, double value);
+ void SetBooleanWithCopiedName(const std::string& name, bool value);
+ void SetStringWithCopiedName(const std::string& name,
+ const std::string& value);
+ void SetValueWithCopiedName(const std::string& name,
+ const TracedValue& value);
+ void BeginDictionaryWithCopiedName(const std::string& name);
+ void BeginArrayWithCopiedName(const std::string& name);
+
void AppendInteger(int);
void AppendDouble(double);
void AppendBoolean(bool);
@@ -40,16 +53,33 @@ class BASE_EXPORT TracedValue : public ConvertableToTraceFormat {
void BeginArray();
void BeginDictionary();
+ // ConvertableToTraceFormat implementation.
void AppendAsTraceFormat(std::string* out) const override;
+ void EstimateTraceMemoryOverhead(TraceEventMemoryOverhead* overhead) override;
+
+ // DEPRECATED: do not use, here only for legacy reasons. These methods causes
+ // a copy-and-translation of the base::Value into the equivalent TracedValue.
+ // TODO(primiano): migrate the (three) existing clients to the cheaper
+ // SetValue(TracedValue) API. crbug.com/495628.
+ void SetValue(const char* name, scoped_ptr<base::Value> value);
+ void SetBaseValueWithCopiedName(const std::string& name,
+ const base::Value& value);
+ void AppendBaseValue(const base::Value& value);
+
+ // Public for tests only.
+ scoped_ptr<base::Value> ToBaseValue() const;
+
private:
~TracedValue() override;
- DictionaryValue* GetCurrentDictionary();
- ListValue* GetCurrentArray();
+ Pickle pickle_;
+
+#ifndef NDEBUG
+ // In debug builds checks the pairings of {Start,End}{Dictionary,Array}
+ std::vector<bool> nesting_stack_;
+#endif
- scoped_ptr<base::Value> root_;
- std::vector<Value*> stack_; // Weak references.
DISALLOW_COPY_AND_ASSIGN(TracedValue);
};
« no previous file with comments | « base/trace_event/trace_event_android.cc ('k') | base/trace_event/trace_event_argument.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698