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

Side by Side Diff: components/sessions/core/base_session_service.cc

Issue 2889683003: Rename TaskRunner::RunsTasksOnCurrentThread() in //components (Closed)
Patch Set: Created 3 years, 7 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "components/sessions/core/base_session_service.h" 5 #include "components/sessions/core/base_session_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 16 matching lines...) Expand all
27 std::vector<std::unique_ptr<SessionCommand>> commands) { 27 std::vector<std::unique_ptr<SessionCommand>> commands) {
28 if (is_canceled.Run()) 28 if (is_canceled.Run())
29 return; 29 return;
30 callback.Run(std::move(commands)); 30 callback.Run(std::move(commands));
31 } 31 }
32 32
33 void PostOrRunInternalGetCommandsCallback( 33 void PostOrRunInternalGetCommandsCallback(
34 base::TaskRunner* task_runner, 34 base::TaskRunner* task_runner,
35 const BaseSessionService::GetCommandsCallback& callback, 35 const BaseSessionService::GetCommandsCallback& callback,
36 std::vector<std::unique_ptr<SessionCommand>> commands) { 36 std::vector<std::unique_ptr<SessionCommand>> commands) {
37 if (task_runner->RunsTasksOnCurrentThread()) { 37 if (task_runner->RunsTasksInCurrentSequence()) {
38 callback.Run(std::move(commands)); 38 callback.Run(std::move(commands));
39 } else { 39 } else {
40 task_runner->PostTask(FROM_HERE, 40 task_runner->PostTask(FROM_HERE,
41 base::Bind(callback, base::Passed(&commands))); 41 base::Bind(callback, base::Passed(&commands)));
42 } 42 }
43 } 43 }
44 44
45 } // namespace 45 } // namespace
46 46
47 // Delay between when a command is received, and when we save it to the 47 // Delay between when a command is received, and when we save it to the
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 pool->PostSequencedWorkerTask(sequence_token_, from_here, task); 182 pool->PostSequencedWorkerTask(sequence_token_, from_here, task);
183 } else { 183 } else {
184 // Fall back to executing on the main thread if the sequence 184 // Fall back to executing on the main thread if the sequence
185 // worker pool has been requested to shutdown (around shutdown 185 // worker pool has been requested to shutdown (around shutdown
186 // time). 186 // time).
187 task.Run(); 187 task.Run();
188 } 188 }
189 } 189 }
190 190
191 } // namespace sessions 191 } // namespace sessions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698