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

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

Issue 1800743003: base: Remove some unnecessary const scoped_refptr<>&. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/trace_event/memory_dump_manager.cc ('k') | base/trace_event/process_memory_dump.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/memory_dump_manager.h" 5 #include "base/trace_event/memory_dump_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 } 44 }
45 45
46 MATCHER(IsLightDump, "") { 46 MATCHER(IsLightDump, "") {
47 return arg.level_of_detail == MemoryDumpLevelOfDetail::LIGHT; 47 return arg.level_of_detail == MemoryDumpLevelOfDetail::LIGHT;
48 } 48 }
49 49
50 namespace { 50 namespace {
51 51
52 void RegisterDumpProvider( 52 void RegisterDumpProvider(
53 MemoryDumpProvider* mdp, 53 MemoryDumpProvider* mdp,
54 const scoped_refptr<base::SequencedTaskRunner>& task_runner, 54 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
55 const MemoryDumpProvider::Options& options, 55 const MemoryDumpProvider::Options& options) {
56 bool dumps_on_single_thread_task_runner) {
57 MemoryDumpManager* mdm = MemoryDumpManager::GetInstance(); 56 MemoryDumpManager* mdm = MemoryDumpManager::GetInstance();
58 mdm->set_dumper_registrations_ignored_for_testing(false); 57 mdm->set_dumper_registrations_ignored_for_testing(false);
59 const char* kMDPName = "TestDumpProvider"; 58 const char* kMDPName = "TestDumpProvider";
60 if (dumps_on_single_thread_task_runner) { 59 mdm->RegisterDumpProvider(mdp, kMDPName, std::move(task_runner), options);
61 scoped_refptr<base::SingleThreadTaskRunner> single_thread_task_runner =
62 static_cast<base::SingleThreadTaskRunner*>(task_runner.get());
63 mdm->RegisterDumpProvider(mdp, kMDPName,
64 std::move(single_thread_task_runner), options);
65 } else {
66 mdm->RegisterDumpProviderWithSequencedTaskRunner(mdp, kMDPName, task_runner,
67 options);
68 }
69 mdm->set_dumper_registrations_ignored_for_testing(true); 60 mdm->set_dumper_registrations_ignored_for_testing(true);
70 } 61 }
71 62
72 void RegisterDumpProvider(
73 MemoryDumpProvider* mdp,
74 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
75 const MemoryDumpProvider::Options& options) {
76 RegisterDumpProvider(mdp, task_runner, options,
77 true /* dumps_on_single_thread_task_runner */);
78 }
79
80 void RegisterDumpProvider(MemoryDumpProvider* mdp) { 63 void RegisterDumpProvider(MemoryDumpProvider* mdp) {
81 RegisterDumpProvider(mdp, nullptr, MemoryDumpProvider::Options()); 64 RegisterDumpProvider(mdp, nullptr, MemoryDumpProvider::Options());
82 } 65 }
83 66
84 void RegisterDumpProviderWithSequencedTaskRunner( 67 void RegisterDumpProviderWithSequencedTaskRunner(
85 MemoryDumpProvider* mdp, 68 MemoryDumpProvider* mdp,
86 const scoped_refptr<base::SequencedTaskRunner>& task_runner, 69 scoped_refptr<base::SequencedTaskRunner> task_runner,
87 const MemoryDumpProvider::Options& options) { 70 const MemoryDumpProvider::Options& options) {
88 RegisterDumpProvider(mdp, task_runner, options, 71 MemoryDumpManager* mdm = MemoryDumpManager::GetInstance();
89 false /* dumps_on_single_thread_task_runner */); 72 mdm->set_dumper_registrations_ignored_for_testing(false);
73 const char* kMDPName = "TestDumpProvider";
Primiano Tucci (use gerrit) 2016/03/15 15:58:11 Why are we re-duplicating the code here? The point
vmpstr 2016/03/15 18:57:38 The part that was a bit awkward was on lines 61-62
74 mdm->RegisterDumpProviderWithSequencedTaskRunner(mdp, kMDPName, task_runner,
danakj 2016/03/15 18:27:36 move the task runner?
75 options);
76 mdm->set_dumper_registrations_ignored_for_testing(true);
90 } 77 }
91 78
92 void OnTraceDataCollected(Closure quit_closure, 79 void OnTraceDataCollected(Closure quit_closure,
93 trace_event::TraceResultBuffer* buffer, 80 trace_event::TraceResultBuffer* buffer,
94 const scoped_refptr<RefCountedString>& json, 81 const scoped_refptr<RefCountedString>& json,
95 bool has_more_events) { 82 bool has_more_events) {
96 buffer->AddFragment(json->data()); 83 buffer->AddFragment(json->data());
97 if (!has_more_events) 84 if (!has_more_events)
98 quit_closure.Run(); 85 quit_closure.Run();
99 } 86 }
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 EXPECT_CALL(*delegate_, RequestGlobalMemoryDump(_, _)).Times(2); 1072 EXPECT_CALL(*delegate_, RequestGlobalMemoryDump(_, _)).Times(2);
1086 for (int i = 0; i < 2; ++i) { 1073 for (int i = 0; i < 2; ++i) {
1087 RequestGlobalDumpAndWait(MemoryDumpType::EXPLICITLY_TRIGGERED, 1074 RequestGlobalDumpAndWait(MemoryDumpType::EXPLICITLY_TRIGGERED,
1088 MemoryDumpLevelOfDetail::DETAILED); 1075 MemoryDumpLevelOfDetail::DETAILED);
1089 } 1076 }
1090 DisableTracing(); 1077 DisableTracing();
1091 } 1078 }
1092 1079
1093 } // namespace trace_event 1080 } // namespace trace_event
1094 } // namespace base 1081 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/memory_dump_manager.cc ('k') | base/trace_event/process_memory_dump.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698