OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
jar (doing other things)
2012/01/12 00:15:36
You added a lot of macros. Shouldn't there be tes
jbates
2012/01/12 00:52:20
Done.
| |
5 #include "base/debug/trace_event.h" | 5 #include "base/debug/trace_event.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
11 #include "base/memory/ref_counted_memory.h" | 11 #include "base/memory/ref_counted_memory.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
14 #include "base/process_util.h" | 14 #include "base/process_util.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 const scoped_refptr<TraceLog::RefCountedString>& events_str) { | 92 const scoped_refptr<TraceLog::RefCountedString>& events_str) { |
93 AutoLock lock(lock_); | 93 AutoLock lock(lock_); |
94 json_output_.json_output.clear(); | 94 json_output_.json_output.clear(); |
95 trace_buffer_.Start(); | 95 trace_buffer_.Start(); |
96 trace_buffer_.AddFragment(events_str->data); | 96 trace_buffer_.AddFragment(events_str->data); |
97 trace_buffer_.Finish(); | 97 trace_buffer_.Finish(); |
98 | 98 |
99 scoped_ptr<Value> root; | 99 scoped_ptr<Value> root; |
100 root.reset(base::JSONReader::Read(json_output_.json_output, false)); | 100 root.reset(base::JSONReader::Read(json_output_.json_output, false)); |
101 | 101 |
102 if (!root.get()) { | |
103 LOG(ERROR) << json_output_.json_output; | |
104 } | |
105 | |
102 ListValue* root_list = NULL; | 106 ListValue* root_list = NULL; |
103 ASSERT_TRUE(root.get()); | 107 ASSERT_TRUE(root.get()); |
104 ASSERT_TRUE(root->GetAsList(&root_list)); | 108 ASSERT_TRUE(root->GetAsList(&root_list)); |
105 | 109 |
106 // Move items into our aggregate collection | 110 // Move items into our aggregate collection |
107 while (root_list->GetSize()) { | 111 while (root_list->GetSize()) { |
108 Value* item = NULL; | 112 Value* item = NULL; |
109 root_list->Remove(0, &item); | 113 root_list->Remove(0, &item); |
110 trace_parsed_.Append(item); | 114 trace_parsed_.Append(item); |
111 } | 115 } |
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1148 Clear(); | 1152 Clear(); |
1149 | 1153 |
1150 trace_buffer_.Start(); | 1154 trace_buffer_.Start(); |
1151 trace_buffer_.AddFragment("bla1,bla2,bla3,bla4"); | 1155 trace_buffer_.AddFragment("bla1,bla2,bla3,bla4"); |
1152 trace_buffer_.Finish(); | 1156 trace_buffer_.Finish(); |
1153 EXPECT_STREQ(json_output_.json_output.c_str(), "[bla1,bla2,bla3,bla4]"); | 1157 EXPECT_STREQ(json_output_.json_output.c_str(), "[bla1,bla2,bla3,bla4]"); |
1154 } | 1158 } |
1155 | 1159 |
1156 } // namespace debug | 1160 } // namespace debug |
1157 } // namespace base | 1161 } // namespace base |
OLD | NEW |