| 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 |
| 60 void TracedValue::beginDictionary(const char* name) | 65 void TracedValue::beginDictionary(const char* name) |
| 61 { | 66 { |
| 62 RefPtr<JSONObject> dictionary = JSONObject::create(); | 67 RefPtr<JSONObject> dictionary = JSONObject::create(); |
| 63 currentDictionary()->setObject(name, dictionary); | 68 currentDictionary()->setObject(name, dictionary); |
| 64 m_stack.append(dictionary); | 69 m_stack.append(dictionary); |
| 65 } | 70 } |
| 66 | 71 |
| 67 void TracedValue::beginArray(const char* name) | 72 void TracedValue::beginArray(const char* name) |
| 68 { | 73 { |
| 69 RefPtr<JSONArray> array = JSONArray::create(); | 74 RefPtr<JSONArray> array = JSONArray::create(); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 } | 138 } |
| 134 | 139 |
| 135 JSONArray* TracedValue::currentArray() const | 140 JSONArray* TracedValue::currentArray() const |
| 136 { | 141 { |
| 137 ASSERT(!m_stack.isEmpty()); | 142 ASSERT(!m_stack.isEmpty()); |
| 138 ASSERT(m_stack.last()->type() == JSONValue::TypeArray); | 143 ASSERT(m_stack.last()->type() == JSONValue::TypeArray); |
| 139 return static_cast<JSONArray*>(m_stack.last().get()); | 144 return static_cast<JSONArray*>(m_stack.last().get()); |
| 140 } | 145 } |
| 141 | 146 |
| 142 } | 147 } |
| OLD | NEW |