| 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 "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 | 9 |
| 10 namespace base { | 10 namespace base { |
| 11 namespace debug { | 11 namespace trace_event { |
| 12 | 12 |
| 13 TracedValue::TracedValue() : root_(new DictionaryValue()) { | 13 TracedValue::TracedValue() : root_(new DictionaryValue()) { |
| 14 stack_.push_back(root_.get()); | 14 stack_.push_back(root_.get()); |
| 15 } | 15 } |
| 16 | 16 |
| 17 TracedValue::~TracedValue() { | 17 TracedValue::~TracedValue() { |
| 18 DCHECK_EQ(1u, stack_.size()); | 18 DCHECK_EQ(1u, stack_.size()); |
| 19 } | 19 } |
| 20 | 20 |
| 21 void TracedValue::SetInteger(const char* name, int value) { | 21 void TracedValue::SetInteger(const char* name, int value) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 return list; | 106 return list; |
| 107 } | 107 } |
| 108 | 108 |
| 109 void TracedValue::AppendAsTraceFormat(std::string* out) const { | 109 void TracedValue::AppendAsTraceFormat(std::string* out) const { |
| 110 std::string tmp; | 110 std::string tmp; |
| 111 JSONWriter::Write(stack_.front(), &tmp); | 111 JSONWriter::Write(stack_.front(), &tmp); |
| 112 *out += tmp; | 112 *out += tmp; |
| 113 DCHECK_EQ(1u, stack_.size()) << tmp; | 113 DCHECK_EQ(1u, stack_.size()) << tmp; |
| 114 } | 114 } |
| 115 | 115 |
| 116 } // namespace debug | 116 } // namespace trace_event |
| 117 } // namespace base | 117 } // namespace base |
| OLD | NEW |