| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef TracedValue_h | |
| 6 #define TracedValue_h | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "platform/EventTracer.h" | |
| 10 #include "wtf/text/WTFString.h" | |
| 11 #include <memory> | |
| 12 | |
| 13 namespace base { | |
| 14 namespace trace_event { | |
| 15 class TracedValue; | |
| 16 } | |
| 17 } | |
| 18 | |
| 19 namespace blink { | |
| 20 | |
| 21 // TracedValue copies all passed names and values and doesn't retain references. | |
| 22 class PLATFORM_EXPORT TracedValue final { | |
| 23 WTF_MAKE_NONCOPYABLE(TracedValue); | |
| 24 | |
| 25 public: | |
| 26 ~TracedValue(); | |
| 27 | |
| 28 static std::unique_ptr<TracedValue> create(); | |
| 29 | |
| 30 void endDictionary(); | |
| 31 void endArray(); | |
| 32 | |
| 33 void setInteger(const char* name, int value); | |
| 34 void setDouble(const char* name, double); | |
| 35 void setBoolean(const char* name, bool value); | |
| 36 void setString(const char* name, const String& value); | |
| 37 void beginArray(const char* name); | |
| 38 void beginDictionary(const char* name); | |
| 39 | |
| 40 void pushInteger(int); | |
| 41 void pushDouble(double); | |
| 42 void pushBoolean(bool); | |
| 43 void pushString(const String&); | |
| 44 void beginArray(); | |
| 45 void beginDictionary(); | |
| 46 | |
| 47 String toString() const; | |
| 48 | |
| 49 private: | |
| 50 TracedValue(); | |
| 51 | |
| 52 // This will be moved (and become null) when TracedValue is passed to | |
| 53 // EventTracer::addTraceEvent(). | |
| 54 std::unique_ptr<base::trace_event::TracedValue> m_tracedValue; | |
| 55 | |
| 56 friend class EventTracer; | |
| 57 }; | |
| 58 | |
| 59 } // namespace blink | |
| 60 | |
| 61 #endif // TracedValue_h | |
| OLD | NEW |