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 #include <cmath> | 9 #include <cmath> |
10 | 10 |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 return std::make_pair(key, m_data.get(key)); | 252 return std::make_pair(key, m_data.get(key)); |
253 } | 253 } |
254 | 254 |
255 bool DictionaryValue::booleanProperty(const String16& name, bool defaultValue) c
onst | 255 bool DictionaryValue::booleanProperty(const String16& name, bool defaultValue) c
onst |
256 { | 256 { |
257 bool result = defaultValue; | 257 bool result = defaultValue; |
258 getBoolean(name, &result); | 258 getBoolean(name, &result); |
259 return result; | 259 return result; |
260 } | 260 } |
261 | 261 |
| 262 double DictionaryValue::numberProperty(const String16& name, double defaultValue
) const |
| 263 { |
| 264 double result = defaultValue; |
| 265 getNumber(name, &result); |
| 266 return result; |
| 267 } |
| 268 |
262 void DictionaryValue::remove(const String16& name) | 269 void DictionaryValue::remove(const String16& name) |
263 { | 270 { |
264 m_data.remove(name); | 271 m_data.remove(name); |
265 for (size_t i = 0; i < m_order.size(); ++i) { | 272 for (size_t i = 0; i < m_order.size(); ++i) { |
266 if (m_order[i] == name) { | 273 if (m_order[i] == name) { |
267 m_order.remove(i); | 274 m_order.remove(i); |
268 break; | 275 break; |
269 } | 276 } |
270 } | 277 } |
271 } | 278 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 } | 344 } |
338 | 345 |
339 protocol::Value* ListValue::at(size_t index) | 346 protocol::Value* ListValue::at(size_t index) |
340 { | 347 { |
341 ASSERT_WITH_SECURITY_IMPLICATION(index < m_data.size()); | 348 ASSERT_WITH_SECURITY_IMPLICATION(index < m_data.size()); |
342 return m_data[index].get(); | 349 return m_data[index].get(); |
343 } | 350 } |
344 | 351 |
345 } // namespace protocol | 352 } // namespace protocol |
346 } // namespace blink | 353 } // namespace blink |
OLD | NEW |