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

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

Issue 304993004: [SyncFS] Add TaskLog tab on chrome://syncfs-internals (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
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 "chrome/browser/sync_file_system/drive_backend/sync_task_manager.h" 5 #include "chrome/browser/sync_file_system/drive_backend/sync_task_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/sync_file_system/drive_backend/sync_task_token.h" 10 #include "chrome/browser/sync_file_system/drive_backend/sync_task_token.h"
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 317
318 void SyncTaskManager::PushPendingTask( 318 void SyncTaskManager::PushPendingTask(
319 const base::Closure& closure, Priority priority) { 319 const base::Closure& closure, Priority priority) {
320 pending_tasks_.push(PendingTask(closure, priority, pending_task_seq_++)); 320 pending_tasks_.push(PendingTask(closure, priority, pending_task_seq_++));
321 } 321 }
322 322
323 void SyncTaskManager::RunTask(scoped_ptr<SyncTaskToken> token, 323 void SyncTaskManager::RunTask(scoped_ptr<SyncTaskToken> token,
324 scoped_ptr<SyncTask> task) { 324 scoped_ptr<SyncTask> task) {
325 DCHECK(!running_foreground_task_); 325 DCHECK(!running_foreground_task_);
326 326
327 token->SetTaskLog(make_scoped_ptr(new TaskLogger::TaskLog));
328
329 running_foreground_task_ = task.Pass(); 327 running_foreground_task_ = task.Pass();
330 running_foreground_task_->RunPreflight(token.Pass()); 328 running_foreground_task_->RunPreflight(token.Pass());
331 } 329 }
332 330
333 void SyncTaskManager::StartNextTask() { 331 void SyncTaskManager::StartNextTask() {
334 if (!pending_backgrounding_task_.is_null()) { 332 if (!pending_backgrounding_task_.is_null()) {
335 base::Closure closure = pending_backgrounding_task_; 333 base::Closure closure = pending_backgrounding_task_;
336 pending_backgrounding_task_.Reset(); 334 pending_backgrounding_task_.Reset();
337 closure.Run(); 335 closure.Run();
338 return; 336 return;
339 } 337 }
340 338
341 if (!pending_tasks_.empty()) { 339 if (!pending_tasks_.empty()) {
342 base::Closure closure = pending_tasks_.top().task; 340 base::Closure closure = pending_tasks_.top().task;
343 pending_tasks_.pop(); 341 pending_tasks_.pop();
344 closure.Run(); 342 closure.Run();
345 return; 343 return;
346 } 344 }
347 345
348 if (client_) 346 if (client_)
349 client_->MaybeScheduleNextTask(); 347 client_->MaybeScheduleNextTask();
350 } 348 }
351 349
352 } // namespace drive_backend 350 } // namespace drive_backend
353 } // namespace sync_file_system 351 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698