Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: base/trace_event/trace_event_unittest.cc

Issue 2051663003: base::ListValue::Append cleanup: pass unique_ptr instead of the released pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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.h" 5 #include "base/trace_event/trace_event.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <cstdlib> 11 #include <cstdlib>
12 #include <memory> 12 #include <memory>
13 #include <utility>
13 14
14 #include "base/bind.h" 15 #include "base/bind.h"
15 #include "base/command_line.h" 16 #include "base/command_line.h"
16 #include "base/json/json_reader.h" 17 #include "base/json/json_reader.h"
17 #include "base/json/json_writer.h" 18 #include "base/json/json_writer.h"
18 #include "base/location.h" 19 #include "base/location.h"
19 #include "base/macros.h" 20 #include "base/macros.h"
20 #include "base/memory/ref_counted_memory.h" 21 #include "base/memory/ref_counted_memory.h"
21 #include "base/memory/singleton.h" 22 #include "base/memory/singleton.h"
22 #include "base/process/process_handle.h" 23 #include "base/process/process_handle.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 } 199 }
199 200
200 ListValue* root_list = NULL; 201 ListValue* root_list = NULL;
201 ASSERT_TRUE(root.get()); 202 ASSERT_TRUE(root.get());
202 ASSERT_TRUE(root->GetAsList(&root_list)); 203 ASSERT_TRUE(root->GetAsList(&root_list));
203 204
204 // Move items into our aggregate collection 205 // Move items into our aggregate collection
205 while (root_list->GetSize()) { 206 while (root_list->GetSize()) {
206 std::unique_ptr<Value> item; 207 std::unique_ptr<Value> item;
207 root_list->Remove(0, &item); 208 root_list->Remove(0, &item);
208 trace_parsed_.Append(item.release()); 209 trace_parsed_.Append(std::move(item));
209 } 210 }
210 211
211 if (!has_more_events) 212 if (!has_more_events)
212 flush_complete_event->Signal(); 213 flush_complete_event->Signal();
213 } 214 }
214 215
215 static bool CompareJsonValues(const std::string& lhs, 216 static bool CompareJsonValues(const std::string& lhs,
216 const std::string& rhs, 217 const std::string& rhs,
217 CompareOp op) { 218 CompareOp op) {
218 switch (op) { 219 switch (op) {
(...skipping 2902 matching lines...) Expand 10 before | Expand all | Expand 10 after
3121 3122
3122 TEST_F(TraceEventTestFixture, ClockSyncEventsAreAlwaysAddedToTrace) { 3123 TEST_F(TraceEventTestFixture, ClockSyncEventsAreAlwaysAddedToTrace) {
3123 BeginSpecificTrace("-*"); 3124 BeginSpecificTrace("-*");
3124 TRACE_EVENT_CLOCK_SYNC_RECEIVER(1); 3125 TRACE_EVENT_CLOCK_SYNC_RECEIVER(1);
3125 EndTraceAndFlush(); 3126 EndTraceAndFlush();
3126 EXPECT_TRUE(FindNamePhase("clock_sync", "c")); 3127 EXPECT_TRUE(FindNamePhase("clock_sync", "c"));
3127 } 3128 }
3128 3129
3129 } // namespace trace_event 3130 } // namespace trace_event
3130 } // namespace base 3131 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698