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

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

Issue 2122543002: Replace Closure in TaskRunner::PostTask with OneShotCallback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@07_oneshot
Patch Set: fix 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/threading/worker_pool_win.cc ('k') | cc/base/delayed_unique_notifier_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 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 <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 : worker_pool_(new SequencedWorkerPool(2 /* max_threads */, 165 : worker_pool_(new SequencedWorkerPool(2 /* max_threads */,
166 "Test Task Runner", 166 "Test Task Runner",
167 base::TaskPriority::USER_VISIBLE)), 167 base::TaskPriority::USER_VISIBLE)),
168 enabled_(true), 168 enabled_(true),
169 num_of_post_tasks_(0) {} 169 num_of_post_tasks_(0) {}
170 170
171 void set_enabled(bool value) { enabled_ = value; } 171 void set_enabled(bool value) { enabled_ = value; }
172 unsigned no_of_post_tasks() const { return num_of_post_tasks_; } 172 unsigned no_of_post_tasks() const { return num_of_post_tasks_; }
173 173
174 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, 174 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here,
175 const Closure& task, 175 OnceClosure task,
176 TimeDelta delay) override { 176 TimeDelta delay) override {
177 NOTREACHED(); 177 NOTREACHED();
178 return false; 178 return false;
179 } 179 }
180 180
181 bool PostDelayedTask(const tracked_objects::Location& from_here, 181 bool PostDelayedTask(const tracked_objects::Location& from_here,
182 const Closure& task, 182 OnceClosure task,
183 TimeDelta delay) override { 183 TimeDelta delay) override {
184 num_of_post_tasks_++; 184 num_of_post_tasks_++;
185 if (enabled_) 185 if (enabled_)
186 return worker_pool_->PostSequencedWorkerTask(token_, from_here, task); 186 return worker_pool_->PostSequencedWorkerTask(token_, from_here,
187 std::move(task));
187 return false; 188 return false;
188 } 189 }
189 190
190 bool RunsTasksOnCurrentThread() const override { 191 bool RunsTasksOnCurrentThread() const override {
191 return worker_pool_->RunsTasksOnCurrentThread(); 192 return worker_pool_->RunsTasksOnCurrentThread();
192 } 193 }
193 194
194 private: 195 private:
195 ~TestSequencedTaskRunner() override {} 196 ~TestSequencedTaskRunner() override {}
196 197
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 MemoryDumpLevelOfDetail::DETAILED); 1187 MemoryDumpLevelOfDetail::DETAILED);
1187 EXPECT_FALSE(last_callback_success_); 1188 EXPECT_FALSE(last_callback_success_);
1188 1189
1189 ASSERT_TRUE(IsPeriodicDumpingEnabled()); 1190 ASSERT_TRUE(IsPeriodicDumpingEnabled());
1190 run_loop.Run(); 1191 run_loop.Run();
1191 DisableTracing(); 1192 DisableTracing();
1192 } 1193 }
1193 1194
1194 } // namespace trace_event 1195 } // namespace trace_event
1195 } // namespace base 1196 } // namespace base
OLDNEW
« no previous file with comments | « base/threading/worker_pool_win.cc ('k') | cc/base/delayed_unique_notifier_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698