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: components/sessions/core/base_session_service.cc

Issue 1548203002: Convert Pass()→std::move() in //components/[n-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad headers Created 4 years, 11 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>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/location.h" 10 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 12 #include "base/thread_task_runner_handle.h"
11 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
12 #include "components/sessions/core/base_session_service_delegate.h" 14 #include "components/sessions/core/base_session_service_delegate.h"
13 #include "components/sessions/core/session_backend.h" 15 #include "components/sessions/core/session_backend.h"
14 16
15 // BaseSessionService --------------------------------------------------------- 17 // BaseSessionService ---------------------------------------------------------
16 18
17 namespace sessions { 19 namespace sessions {
18 namespace { 20 namespace {
19 21
20 // Helper used by ScheduleGetLastSessionCommands. It runs callback on TaskRunner 22 // Helper used by ScheduleGetLastSessionCommands. It runs callback on TaskRunner
21 // thread if it's not canceled. 23 // thread if it's not canceled.
22 void RunIfNotCanceled( 24 void RunIfNotCanceled(
23 const base::CancelableTaskTracker::IsCanceledCallback& is_canceled, 25 const base::CancelableTaskTracker::IsCanceledCallback& is_canceled,
24 const BaseSessionService::GetCommandsCallback& callback, 26 const BaseSessionService::GetCommandsCallback& callback,
25 ScopedVector<SessionCommand> commands) { 27 ScopedVector<SessionCommand> commands) {
26 if (is_canceled.Run()) 28 if (is_canceled.Run())
27 return; 29 return;
28 callback.Run(commands.Pass()); 30 callback.Run(std::move(commands));
29 } 31 }
30 32
31 void PostOrRunInternalGetCommandsCallback( 33 void PostOrRunInternalGetCommandsCallback(
32 base::TaskRunner* task_runner, 34 base::TaskRunner* task_runner,
33 const BaseSessionService::GetCommandsCallback& callback, 35 const BaseSessionService::GetCommandsCallback& callback,
34 ScopedVector<SessionCommand> commands) { 36 ScopedVector<SessionCommand> commands) {
35 if (task_runner->RunsTasksOnCurrentThread()) { 37 if (task_runner->RunsTasksOnCurrentThread()) {
36 callback.Run(commands.Pass()); 38 callback.Run(std::move(commands));
37 } else { 39 } else {
38 task_runner->PostTask(FROM_HERE, 40 task_runner->PostTask(FROM_HERE,
39 base::Bind(callback, base::Passed(&commands))); 41 base::Bind(callback, base::Passed(&commands)));
40 } 42 }
41 } 43 }
42 44
43 } // namespace 45 } // namespace
44 46
45 // 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
46 // backend. 48 // backend.
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 pool->PostSequencedWorkerTask(sequence_token_, from_here, task); 178 pool->PostSequencedWorkerTask(sequence_token_, from_here, task);
177 } else { 179 } else {
178 // Fall back to executing on the main thread if the sequence 180 // Fall back to executing on the main thread if the sequence
179 // worker pool has been requested to shutdown (around shutdown 181 // worker pool has been requested to shutdown (around shutdown
180 // time). 182 // time).
181 task.Run(); 183 task.Run();
182 } 184 }
183 } 185 }
184 186
185 } // namespace sessions 187 } // namespace sessions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698