1 // Copyright 2014 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.
8 #include "platform/EventTracer.h"
10 #include "wtf/PassRefPtr.h"
11 #include "wtf/text/WTFString.h"
14 class TracedArrayValue
;
15 class TracedDictionaryValue
;
18 // TODO(bashi): Use Allocator which counts allocation size as tracing overhead.
19 typedef Vector
<RefPtr
<InternalValue
>> TracedValueVector
;
20 typedef HashMap
<String
, RefPtr
<InternalValue
>> TracedValueHashMap
;
22 class PLATFORM_EXPORT TracedValue
: public TraceEvent::ConvertableToTraceFormat
{
23 WTF_MAKE_NONCOPYABLE(TracedValue
);
26 static PassRefPtr
<TracedValue
> create();
31 void setInteger(const char* name
, int value
);
32 void setDouble(const char* name
, double);
33 void setBoolean(const char* name
, bool value
);
34 void setString(const char* name
, const String
& value
);
35 void beginArray(const char* name
);
36 void beginDictionary(const char* name
);
38 void pushInteger(int);
39 void pushDouble(double);
40 void pushBoolean(bool);
41 void pushString(const String
&);
43 void beginDictionary();
45 String
asTraceFormat() const override
;
49 ~TracedValue() override
;
51 TracedDictionaryValue
* currentDictionary() const;
52 TracedArrayValue
* currentArray() const;
54 TracedValueVector m_stack
;
59 #endif // TracedValue_h