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

Side by Side Diff: chrome/browser/sync_file_system/sync_task_manager.cc

Issue 87463002: Only re-enable remote service if the task used the network. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/sync_file_system/sync_task_manager.h" 5 #include "chrome/browser/sync_file_system/sync_task_manager.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "chrome/browser/sync_file_system/sync_file_metadata.h" 9 #include "chrome/browser/sync_file_system/sync_file_metadata.h"
10 10
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 DCHECK(token); 145 DCHECK(token);
146 last_operation_status_ = status; 146 last_operation_status_ = status;
147 token_ = token.Pass(); 147 token_ = token.Pass();
148 scoped_ptr<SyncTask> task = running_task_.Pass(); 148 scoped_ptr<SyncTask> task = running_task_.Pass();
149 TRACE_EVENT_ASYNC_END0("Sync FileSystem", "GetToken", this); 149 TRACE_EVENT_ASYNC_END0("Sync FileSystem", "GetToken", this);
150 150
151 DVLOG(3) << "NotifyTaskDone: " << "finished with status=" << status 151 DVLOG(3) << "NotifyTaskDone: " << "finished with status=" << status
152 << " (" << SyncStatusCodeToString(status) << ")" 152 << " (" << SyncStatusCodeToString(status) << ")"
153 << " " << token_->location().ToString(); 153 << " " << token_->location().ToString();
154 154
155 bool task_used_network = false;
156 if (task)
157 task_used_network = task->used_network();
158
155 if (client_) 159 if (client_)
156 client_->NotifyLastOperationStatus(last_operation_status_); 160 client_->NotifyLastOperationStatus(last_operation_status_,
161 task_used_network);
157 162
158 if (!current_callback_.is_null()) { 163 if (!current_callback_.is_null()) {
159 SyncStatusCallback callback = current_callback_; 164 SyncStatusCallback callback = current_callback_;
160 current_callback_.Reset(); 165 current_callback_.Reset();
161 callback.Run(status); 166 callback.Run(status);
162 } 167 }
163 168
164 if (!pending_tasks_.empty()) { 169 if (!pending_tasks_.empty()) {
165 base::Closure closure = pending_tasks_.top().task; 170 base::Closure closure = pending_tasks_.top().task;
166 pending_tasks_.pop(); 171 pending_tasks_.pop();
(...skipping 24 matching lines...) Expand all
191 return base::Bind(&SyncTaskManager::NotifyTaskDone, 196 return base::Bind(&SyncTaskManager::NotifyTaskDone,
192 AsWeakPtr(), base::Passed(&token)); 197 AsWeakPtr(), base::Passed(&token));
193 } 198 }
194 199
195 void SyncTaskManager::PushPendingTask( 200 void SyncTaskManager::PushPendingTask(
196 const base::Closure& closure, Priority priority) { 201 const base::Closure& closure, Priority priority) {
197 pending_tasks_.push(PendingTask(closure, priority, pending_task_seq_++)); 202 pending_tasks_.push(PendingTask(closure, priority, pending_task_seq_++));
198 } 203 }
199 204
200 } // namespace sync_file_system 205 } // namespace sync_file_system
OLDNEW
« no previous file with comments | « chrome/browser/sync_file_system/sync_task_manager.h ('k') | chrome/browser/sync_file_system/sync_task_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698