OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "base/trace_event/trace_event_argument.h" | 5 #include "base/trace_event/trace_event_argument.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 } break; | 285 } break; |
286 | 286 |
287 case base::Value::Type::LIST: { | 287 case base::Value::Type::LIST: { |
288 const ListValue* list_value; | 288 const ListValue* list_value; |
289 value.GetAsList(&list_value); | 289 value.GetAsList(&list_value); |
290 BeginArrayWithCopiedName(name); | 290 BeginArrayWithCopiedName(name); |
291 for (const auto& base_value : *list_value) | 291 for (const auto& base_value : *list_value) |
292 AppendBaseValue(*base_value); | 292 AppendBaseValue(*base_value); |
293 EndArray(); | 293 EndArray(); |
294 } break; | 294 } break; |
| 295 |
| 296 case base::Value::Type::DELETED: |
| 297 // TODO(crbug.com/697817): This means |value| is used after free. |
| 298 CHECK(false); |
| 299 return; |
295 } | 300 } |
296 } | 301 } |
297 | 302 |
298 void TracedValue::AppendBaseValue(const base::Value& value) { | 303 void TracedValue::AppendBaseValue(const base::Value& value) { |
299 DCHECK_CURRENT_CONTAINER_IS(kStackTypeArray); | 304 DCHECK_CURRENT_CONTAINER_IS(kStackTypeArray); |
300 switch (value.GetType()) { | 305 switch (value.GetType()) { |
301 case base::Value::Type::NONE: | 306 case base::Value::Type::NONE: |
302 case base::Value::Type::BINARY: | 307 case base::Value::Type::BINARY: |
303 NOTREACHED(); | 308 NOTREACHED(); |
304 break; | 309 break; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 } break; | 344 } break; |
340 | 345 |
341 case base::Value::Type::LIST: { | 346 case base::Value::Type::LIST: { |
342 const ListValue* list_value; | 347 const ListValue* list_value; |
343 value.GetAsList(&list_value); | 348 value.GetAsList(&list_value); |
344 BeginArray(); | 349 BeginArray(); |
345 for (const auto& base_value : *list_value) | 350 for (const auto& base_value : *list_value) |
346 AppendBaseValue(*base_value); | 351 AppendBaseValue(*base_value); |
347 EndArray(); | 352 EndArray(); |
348 } break; | 353 } break; |
| 354 |
| 355 case base::Value::Type::DELETED: |
| 356 // TODO(crbug.com/697817): This means |value| is used after free. |
| 357 CHECK(false); |
| 358 return; |
349 } | 359 } |
350 } | 360 } |
351 | 361 |
352 std::unique_ptr<base::Value> TracedValue::ToBaseValue() const { | 362 std::unique_ptr<base::Value> TracedValue::ToBaseValue() const { |
353 std::unique_ptr<DictionaryValue> root(new DictionaryValue); | 363 std::unique_ptr<DictionaryValue> root(new DictionaryValue); |
354 DictionaryValue* cur_dict = root.get(); | 364 DictionaryValue* cur_dict = root.get(); |
355 ListValue* cur_list = nullptr; | 365 ListValue* cur_list = nullptr; |
356 std::vector<Value*> stack; | 366 std::vector<Value*> stack; |
357 PickleIterator it(pickle_); | 367 PickleIterator it(pickle_); |
358 const char* type; | 368 const char* type; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 TraceEventMemoryOverhead* overhead) { | 474 TraceEventMemoryOverhead* overhead) { |
465 overhead->Add("TracedValue", | 475 overhead->Add("TracedValue", |
466 /* allocated size */ | 476 /* allocated size */ |
467 pickle_.GetTotalAllocatedSize(), | 477 pickle_.GetTotalAllocatedSize(), |
468 /* resident size */ | 478 /* resident size */ |
469 pickle_.size()); | 479 pickle_.size()); |
470 } | 480 } |
471 | 481 |
472 } // namespace trace_event | 482 } // namespace trace_event |
473 } // namespace base | 483 } // namespace base |
OLD | NEW |