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

Side by Side Diff: components/policy/core/common/remote_commands/remote_command_job.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 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 "components/policy/core/common/remote_commands/remote_command_job.h" 5 #include "components/policy/core/common/remote_commands/remote_command_job.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/logging.h" 10 #include "base/logging.h"
9 11
10 namespace policy { 12 namespace policy {
11 13
12 namespace { 14 namespace {
13 15
14 const int kDefaultCommandTimeoutInMinutes = 3; 16 const int kDefaultCommandTimeoutInMinutes = 3;
15 17
16 } // namespace 18 } // namespace
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 return status_ == SUCCEEDED || status_ == FAILED || status_ == TERMINATED; 115 return status_ == SUCCEEDED || status_ == FAILED || status_ == TERMINATED;
114 } 116 }
115 117
116 scoped_ptr<std::string> RemoteCommandJob::GetResultPayload() const { 118 scoped_ptr<std::string> RemoteCommandJob::GetResultPayload() const {
117 DCHECK(thread_checker_.CalledOnValidThread()); 119 DCHECK(thread_checker_.CalledOnValidThread());
118 DCHECK(status_ == SUCCEEDED || status_ == FAILED); 120 DCHECK(status_ == SUCCEEDED || status_ == FAILED);
119 121
120 if (!result_payload_) 122 if (!result_payload_)
121 return nullptr; 123 return nullptr;
122 124
123 return result_payload_->Serialize().Pass(); 125 return result_payload_->Serialize();
124 } 126 }
125 127
126 RemoteCommandJob::RemoteCommandJob() 128 RemoteCommandJob::RemoteCommandJob()
127 : status_(NOT_INITIALIZED), weak_factory_(this) { 129 : status_(NOT_INITIALIZED), weak_factory_(this) {
128 } 130 }
129 131
130 bool RemoteCommandJob::ParseCommandPayload(const std::string& command_payload) { 132 bool RemoteCommandJob::ParseCommandPayload(const std::string& command_payload) {
131 return true; 133 return true;
132 } 134 }
133 135
134 bool RemoteCommandJob::IsExpired(base::TimeTicks now) { 136 bool RemoteCommandJob::IsExpired(base::TimeTicks now) {
135 return false; 137 return false;
136 } 138 }
137 139
138 void RemoteCommandJob::TerminateImpl() { 140 void RemoteCommandJob::TerminateImpl() {
139 } 141 }
140 142
141 void RemoteCommandJob::OnCommandExecutionFinishedWithResult( 143 void RemoteCommandJob::OnCommandExecutionFinishedWithResult(
142 bool succeeded, 144 bool succeeded,
143 scoped_ptr<RemoteCommandJob::ResultPayload> result_payload) { 145 scoped_ptr<RemoteCommandJob::ResultPayload> result_payload) {
144 DCHECK(thread_checker_.CalledOnValidThread()); 146 DCHECK(thread_checker_.CalledOnValidThread());
145 DCHECK_EQ(RUNNING, status_); 147 DCHECK_EQ(RUNNING, status_);
146 status_ = succeeded ? SUCCEEDED : FAILED; 148 status_ = succeeded ? SUCCEEDED : FAILED;
147 149
148 result_payload_ = result_payload.Pass(); 150 result_payload_ = std::move(result_payload);
149 151
150 if (!finished_callback_.is_null()) 152 if (!finished_callback_.is_null())
151 finished_callback_.Run(); 153 finished_callback_.Run();
152 } 154 }
153 155
154 } // namespace policy 156 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698