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

Side by Side Diff: content/child/worker_thread_registry.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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/child/worker_thread_registry.h" 5 #include "content/child/worker_thread_registry.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 20 matching lines...) Expand all
31 31
32 // A task-runner that refuses to run any tasks. 32 // A task-runner that refuses to run any tasks.
33 class DoNothingTaskRunner : public base::TaskRunner { 33 class DoNothingTaskRunner : public base::TaskRunner {
34 public: 34 public:
35 DoNothingTaskRunner() {} 35 DoNothingTaskRunner() {}
36 36
37 private: 37 private:
38 ~DoNothingTaskRunner() override {} 38 ~DoNothingTaskRunner() override {}
39 39
40 bool PostDelayedTask(const tracked_objects::Location& from_here, 40 bool PostDelayedTask(const tracked_objects::Location& from_here,
41 const base::Closure& task, 41 base::OnceClosure task,
42 base::TimeDelta delay) override { 42 base::TimeDelta delay) override {
43 return false; 43 return false;
44 } 44 }
45 45
46 bool RunsTasksOnCurrentThread() const override { return false; } 46 bool RunsTasksOnCurrentThread() const override { return false; }
47 }; 47 };
48 48
49 } // namespace 49 } // namespace
50 50
51 // WorkerThread implementation: 51 // WorkerThread implementation:
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 bool WorkerThreadRegistry::PostTask(int id, const base::Closure& closure) { 127 bool WorkerThreadRegistry::PostTask(int id, const base::Closure& closure) {
128 DCHECK(id > 0); 128 DCHECK(id > 0);
129 base::AutoLock locker(task_runner_map_lock_); 129 base::AutoLock locker(task_runner_map_lock_);
130 IDToTaskRunnerMap::iterator found = task_runner_map_.find(id); 130 IDToTaskRunnerMap::iterator found = task_runner_map_.find(id);
131 if (found == task_runner_map_.end()) 131 if (found == task_runner_map_.end())
132 return false; 132 return false;
133 return found->second->PostTask(FROM_HERE, closure); 133 return found->second->PostTask(FROM_HERE, closure);
134 } 134 }
135 135
136 } // namespace content 136 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/startup_task_runner_unittest.cc ('k') | content/public/browser/browser_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698