| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/inspector_protocol/Values.h" | 5 #include "platform/inspector_protocol/Values.h" |
| 6 | 6 |
| 7 #include "platform/inspector_protocol/Parser.h" | 7 #include "platform/inspector_protocol/Parser.h" |
| 8 #include "platform/inspector_protocol/String16.h" | 8 #include "platform/inspector_protocol/String16.h" |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 bool Value::asInteger(int*) const | 85 bool Value::asInteger(int*) const |
| 86 { | 86 { |
| 87 return false; | 87 return false; |
| 88 } | 88 } |
| 89 | 89 |
| 90 bool Value::asString(String16*) const | 90 bool Value::asString(String16*) const |
| 91 { | 91 { |
| 92 return false; | 92 return false; |
| 93 } | 93 } |
| 94 | 94 |
| 95 bool Value::asSerialized(String16*) const |
| 96 { |
| 97 return false; |
| 98 } |
| 99 |
| 95 String16 Value::toJSONString() const | 100 String16 Value::toJSONString() const |
| 96 { | 101 { |
| 97 String16Builder result; | 102 String16Builder result; |
| 98 result.reserveCapacity(512); | 103 result.reserveCapacity(512); |
| 99 writeJSON(&result); | 104 writeJSON(&result); |
| 100 return result.toString(); | 105 return result.toString(); |
| 101 } | 106 } |
| 102 | 107 |
| 103 void Value::writeJSON(String16Builder* output) const | 108 void Value::writeJSON(String16Builder* output) const |
| 104 { | 109 { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 { | 186 { |
| 182 DCHECK(type() == TypeString); | 187 DCHECK(type() == TypeString); |
| 183 doubleQuoteStringForJSON(m_stringValue, output); | 188 doubleQuoteStringForJSON(m_stringValue, output); |
| 184 } | 189 } |
| 185 | 190 |
| 186 std::unique_ptr<Value> StringValue::clone() const | 191 std::unique_ptr<Value> StringValue::clone() const |
| 187 { | 192 { |
| 188 return StringValue::create(m_stringValue); | 193 return StringValue::create(m_stringValue); |
| 189 } | 194 } |
| 190 | 195 |
| 196 bool SerializedValue::asSerialized(String16* output) const |
| 197 { |
| 198 *output = m_serializedValue; |
| 199 return true; |
| 200 } |
| 201 |
| 202 void SerializedValue::writeJSON(String16Builder* output) const |
| 203 { |
| 204 DCHECK(type() == TypeSerialized); |
| 205 output->append(m_serializedValue); |
| 206 } |
| 207 |
| 208 std::unique_ptr<Value> SerializedValue::clone() const |
| 209 { |
| 210 return SerializedValue::create(m_serializedValue); |
| 211 } |
| 212 |
| 191 DictionaryValue::~DictionaryValue() | 213 DictionaryValue::~DictionaryValue() |
| 192 { | 214 { |
| 193 } | 215 } |
| 194 | 216 |
| 195 void DictionaryValue::setBoolean(const String16& name, bool value) | 217 void DictionaryValue::setBoolean(const String16& name, bool value) |
| 196 { | 218 { |
| 197 setValue(name, FundamentalValue::create(value)); | 219 setValue(name, FundamentalValue::create(value)); |
| 198 } | 220 } |
| 199 | 221 |
| 200 void DictionaryValue::setInteger(const String16& name, int value) | 222 void DictionaryValue::setInteger(const String16& name, int value) |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 } | 401 } |
| 380 | 402 |
| 381 protocol::Value* ListValue::at(size_t index) | 403 protocol::Value* ListValue::at(size_t index) |
| 382 { | 404 { |
| 383 DCHECK_LT(index, m_data.size()); | 405 DCHECK_LT(index, m_data.size()); |
| 384 return m_data[index].get(); | 406 return m_data[index].get(); |
| 385 } | 407 } |
| 386 | 408 |
| 387 } // namespace protocol | 409 } // namespace protocol |
| 388 } // namespace blink | 410 } // namespace blink |
| OLD | NEW |