| 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 #include "platform/TracedValue.h" | |
| 6 | |
| 7 #include "wtf/PtrUtil.h" | |
| 8 #include "wtf/text/StringUTF8Adaptor.h" | |
| 9 | |
| 10 namespace blink { | |
| 11 | |
| 12 std::unique_ptr<TracedValue> TracedValue::create() { | |
| 13 return wrapUnique(new TracedValue()); | |
| 14 } | |
| 15 | |
| 16 TracedValue::TracedValue() {} | |
| 17 | |
| 18 TracedValue::~TracedValue() {} | |
| 19 | |
| 20 void TracedValue::setInteger(const char* name, int value) { | |
| 21 m_tracedValue.SetIntegerWithCopiedName(name, value); | |
| 22 } | |
| 23 | |
| 24 void TracedValue::setDouble(const char* name, double value) { | |
| 25 m_tracedValue.SetDoubleWithCopiedName(name, value); | |
| 26 } | |
| 27 | |
| 28 void TracedValue::setBoolean(const char* name, bool value) { | |
| 29 m_tracedValue.SetBooleanWithCopiedName(name, value); | |
| 30 } | |
| 31 | |
| 32 void TracedValue::setString(const char* name, const String& value) { | |
| 33 StringUTF8Adaptor adaptor(value); | |
| 34 m_tracedValue.SetStringWithCopiedName(name, adaptor.asStringPiece()); | |
| 35 } | |
| 36 | |
| 37 void TracedValue::beginDictionary(const char* name) { | |
| 38 m_tracedValue.BeginDictionaryWithCopiedName(name); | |
| 39 } | |
| 40 | |
| 41 void TracedValue::beginArray(const char* name) { | |
| 42 m_tracedValue.BeginArrayWithCopiedName(name); | |
| 43 } | |
| 44 | |
| 45 void TracedValue::endDictionary() { | |
| 46 m_tracedValue.EndDictionary(); | |
| 47 } | |
| 48 | |
| 49 void TracedValue::pushInteger(int value) { | |
| 50 m_tracedValue.AppendInteger(value); | |
| 51 } | |
| 52 | |
| 53 void TracedValue::pushDouble(double value) { | |
| 54 m_tracedValue.AppendDouble(value); | |
| 55 } | |
| 56 | |
| 57 void TracedValue::pushBoolean(bool value) { | |
| 58 m_tracedValue.AppendBoolean(value); | |
| 59 } | |
| 60 | |
| 61 void TracedValue::pushString(const String& value) { | |
| 62 StringUTF8Adaptor adaptor(value); | |
| 63 m_tracedValue.AppendString(adaptor.asStringPiece()); | |
| 64 } | |
| 65 | |
| 66 void TracedValue::beginArray() { | |
| 67 m_tracedValue.BeginArray(); | |
| 68 } | |
| 69 | |
| 70 void TracedValue::beginDictionary() { | |
| 71 m_tracedValue.BeginDictionary(); | |
| 72 } | |
| 73 | |
| 74 void TracedValue::endArray() { | |
| 75 m_tracedValue.EndArray(); | |
| 76 } | |
| 77 | |
| 78 String TracedValue::toString() const { | |
| 79 return String(m_tracedValue.ToString().c_str()); | |
| 80 } | |
| 81 | |
| 82 void TracedValue::AppendAsTraceFormat(std::string* out) const { | |
| 83 m_tracedValue.AppendAsTraceFormat(out); | |
| 84 } | |
| 85 | |
| 86 void TracedValue::EstimateTraceMemoryOverhead( | |
| 87 base::trace_event::TraceEventMemoryOverhead* overhead) { | |
| 88 m_tracedValue.EstimateTraceMemoryOverhead(overhead); | |
| 89 } | |
| 90 | |
| 91 } // namespace blink | |
| OLD | NEW |