OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "platform/TracedValue.h" | 7 #include "platform/TracedValue.h" |
8 | 8 |
9 #include "platform/JSONValues.h" | 9 #include "platform/JSONValues.h" |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 void TracedValue::setBoolean(const char* name, bool value) | 50 void TracedValue::setBoolean(const char* name, bool value) |
51 { | 51 { |
52 currentDictionary()->setBoolean(name, value); | 52 currentDictionary()->setBoolean(name, value); |
53 } | 53 } |
54 | 54 |
55 void TracedValue::setString(const char* name, const String& value) | 55 void TracedValue::setString(const char* name, const String& value) |
56 { | 56 { |
57 currentDictionary()->setString(name, threadSafeCopy(value)); | 57 currentDictionary()->setString(name, threadSafeCopy(value)); |
58 } | 58 } |
59 | 59 |
60 void TracedValue::setArray(const char* name, PassRefPtr<JSONArray> value) | |
61 { | |
62 currentDictionary()->setArray(name, value); | |
63 } | |
64 | |
65 void TracedValue::beginDictionary(const char* name) | 60 void TracedValue::beginDictionary(const char* name) |
66 { | 61 { |
67 RefPtr<JSONObject> dictionary = JSONObject::create(); | 62 RefPtr<JSONObject> dictionary = JSONObject::create(); |
68 currentDictionary()->setObject(name, dictionary); | 63 currentDictionary()->setObject(name, dictionary); |
69 m_stack.append(dictionary); | 64 m_stack.append(dictionary); |
70 } | 65 } |
71 | 66 |
72 void TracedValue::beginArray(const char* name) | 67 void TracedValue::beginArray(const char* name) |
73 { | 68 { |
74 RefPtr<JSONArray> array = JSONArray::create(); | 69 RefPtr<JSONArray> array = JSONArray::create(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 133 } |
139 | 134 |
140 JSONArray* TracedValue::currentArray() const | 135 JSONArray* TracedValue::currentArray() const |
141 { | 136 { |
142 ASSERT(!m_stack.isEmpty()); | 137 ASSERT(!m_stack.isEmpty()); |
143 ASSERT(m_stack.last()->type() == JSONValue::TypeArray); | 138 ASSERT(m_stack.last()->type() == JSONValue::TypeArray); |
144 return static_cast<JSONArray*>(m_stack.last().get()); | 139 return static_cast<JSONArray*>(m_stack.last().get()); |
145 } | 140 } |
146 | 141 |
147 } | 142 } |
OLD | NEW |