| OLD | NEW |
| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 RunTask(token.Pass(), task.Pass()); | 117 RunTask(token.Pass(), task.Pass()); |
| 118 return true; | 118 return true; |
| 119 } | 119 } |
| 120 | 120 |
| 121 // static | 121 // static |
| 122 void SyncTaskManager::NotifyTaskDone(scoped_ptr<SyncTaskToken> token, | 122 void SyncTaskManager::NotifyTaskDone(scoped_ptr<SyncTaskToken> token, |
| 123 SyncStatusCode status) { | 123 SyncStatusCode status) { |
| 124 DCHECK(token); | 124 DCHECK(token); |
| 125 | 125 |
| 126 SyncTaskManager* manager = token->manager(); | 126 SyncTaskManager* manager = token->manager(); |
| 127 if (token->token_id() == SyncTaskToken::kTestingTaskTokenID) { |
| 128 DCHECK(!manager); |
| 129 SyncStatusCallback callback = token->callback(); |
| 130 token->clear_callback(); |
| 131 callback.Run(status); |
| 132 return; |
| 133 } |
| 134 |
| 127 if (manager) | 135 if (manager) |
| 128 manager->NotifyTaskDoneBody(token.Pass(), status); | 136 manager->NotifyTaskDoneBody(token.Pass(), status); |
| 129 } | 137 } |
| 130 | 138 |
| 131 // static | 139 // static |
| 132 void SyncTaskManager::UpdateBlockingFactor( | 140 void SyncTaskManager::UpdateBlockingFactor( |
| 133 scoped_ptr<SyncTaskToken> current_task_token, | 141 scoped_ptr<SyncTaskToken> current_task_token, |
| 134 scoped_ptr<BlockingFactor> blocking_factor, | 142 scoped_ptr<BlockingFactor> blocking_factor, |
| 135 const Continuation& continuation) { | 143 const Continuation& continuation) { |
| 136 DCHECK(current_task_token); | 144 DCHECK(current_task_token); |
| 137 | 145 |
| 138 SyncTaskManager* manager = current_task_token->manager(); | 146 SyncTaskManager* manager = current_task_token->manager(); |
| 147 if (current_task_token->token_id() == SyncTaskToken::kTestingTaskTokenID) { |
| 148 DCHECK(!manager); |
| 149 continuation.Run(current_task_token.Pass()); |
| 150 return; |
| 151 } |
| 152 |
| 139 if (!manager) | 153 if (!manager) |
| 140 return; | 154 return; |
| 141 | 155 |
| 142 scoped_ptr<SyncTaskToken> foreground_task_token; | 156 scoped_ptr<SyncTaskToken> foreground_task_token; |
| 143 scoped_ptr<SyncTaskToken> background_task_token; | 157 scoped_ptr<SyncTaskToken> background_task_token; |
| 144 if (current_task_token->token_id() == SyncTaskToken::kForegroundTaskTokenID) | 158 if (current_task_token->token_id() == SyncTaskToken::kForegroundTaskTokenID) |
| 145 foreground_task_token = current_task_token.Pass(); | 159 foreground_task_token = current_task_token.Pass(); |
| 146 else | 160 else |
| 147 background_task_token = current_task_token.Pass(); | 161 background_task_token = current_task_token.Pass(); |
| 148 | 162 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 closure.Run(); | 332 closure.Run(); |
| 319 return; | 333 return; |
| 320 } | 334 } |
| 321 | 335 |
| 322 if (client_) | 336 if (client_) |
| 323 client_->MaybeScheduleNextTask(); | 337 client_->MaybeScheduleNextTask(); |
| 324 } | 338 } |
| 325 | 339 |
| 326 } // namespace drive_backend | 340 } // namespace drive_backend |
| 327 } // namespace sync_file_system | 341 } // namespace sync_file_system |
| OLD | NEW |