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

Side by Side Diff: base/debug/activity_tracker_unittest.cc

Issue 2258713003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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
« no previous file with comments | « base/debug/activity_tracker.cc ('k') | base/files/important_file_writer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/debug/activity_tracker.h" 5 #include "base/debug/activity_tracker.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 ~ActivityTrackerTest() override { 52 ~ActivityTrackerTest() override {
53 GlobalActivityTracker* global_tracker = GlobalActivityTracker::Get(); 53 GlobalActivityTracker* global_tracker = GlobalActivityTracker::Get();
54 if (global_tracker) { 54 if (global_tracker) {
55 global_tracker->ReleaseTrackerForCurrentThreadForTesting(); 55 global_tracker->ReleaseTrackerForCurrentThreadForTesting();
56 delete global_tracker; 56 delete global_tracker;
57 } 57 }
58 } 58 }
59 59
60 std::unique_ptr<ThreadActivityTracker> CreateActivityTracker() { 60 std::unique_ptr<ThreadActivityTracker> CreateActivityTracker() {
61 std::unique_ptr<char[]> memory(new char[kStackSize]); 61 std::unique_ptr<char[]> memory(new char[kStackSize]);
62 return WrapUnique(new TestActivityTracker(std::move(memory), kStackSize)); 62 return MakeUnique<TestActivityTracker>(std::move(memory), kStackSize);
63 } 63 }
64 64
65 size_t GetGlobalActiveTrackerCount() { 65 size_t GetGlobalActiveTrackerCount() {
66 GlobalActivityTracker* global_tracker = GlobalActivityTracker::Get(); 66 GlobalActivityTracker* global_tracker = GlobalActivityTracker::Get();
67 if (!global_tracker) 67 if (!global_tracker)
68 return 0; 68 return 0;
69 return global_tracker->thread_tracker_count_.load( 69 return global_tracker->thread_tracker_count_.load(
70 std::memory_order_relaxed); 70 std::memory_order_relaxed);
71 } 71 }
72 72
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 EXPECT_EQ(starting_inactive, GetGlobalInactiveTrackerCount()); 281 EXPECT_EQ(starting_inactive, GetGlobalInactiveTrackerCount());
282 282
283 t2.Exit(); 283 t2.Exit();
284 t2.Join(); 284 t2.Join();
285 EXPECT_EQ(starting_active, GetGlobalActiveTrackerCount()); 285 EXPECT_EQ(starting_active, GetGlobalActiveTrackerCount());
286 EXPECT_EQ(starting_inactive + 1, GetGlobalInactiveTrackerCount()); 286 EXPECT_EQ(starting_inactive + 1, GetGlobalInactiveTrackerCount());
287 } 287 }
288 288
289 } // namespace debug 289 } // namespace debug
290 } // namespace base 290 } // namespace base
OLDNEW
« no previous file with comments | « base/debug/activity_tracker.cc ('k') | base/files/important_file_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698