| 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_token.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/sync_task_token.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "chrome/browser/sync_file_system/drive_backend/sync_task_manager.h" | 10 #include "chrome/browser/sync_file_system/drive_backend/sync_task_manager.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 } | 63 } |
| 64 | 64 |
| 65 SyncTaskToken::~SyncTaskToken() { | 65 SyncTaskToken::~SyncTaskToken() { |
| 66 // All task on Client must hold TaskToken instance to ensure | 66 // All task on Client must hold TaskToken instance to ensure |
| 67 // no other tasks are running. Also, as soon as a task finishes to work, | 67 // no other tasks are running. Also, as soon as a task finishes to work, |
| 68 // it must return the token to TaskManager. | 68 // it must return the token to TaskManager. |
| 69 // Destroying a token with valid |client| indicates the token was | 69 // Destroying a token with valid |client| indicates the token was |
| 70 // dropped by a task without returning. | 70 // dropped by a task without returning. |
| 71 if (task_runner_.get() && task_runner_->RunsTasksOnCurrentThread() && | 71 if (task_runner_.get() && task_runner_->RunsTasksOnCurrentThread() && |
| 72 manager_ && manager_->IsRunningTask(token_id_)) { | 72 manager_ && manager_->IsRunningTask(token_id_)) { |
| 73 if (!manager_->ShouldTrackTaskToken()) |
| 74 return; |
| 75 |
| 73 NOTREACHED() | 76 NOTREACHED() |
| 74 << "Unexpected TaskToken deletion from: " << location_.ToString(); | 77 << "Unexpected TaskToken deletion from: " << location_.ToString(); |
| 75 | 78 |
| 76 // Reinitializes the token. | 79 // Reinitializes the token. |
| 77 SyncTaskManager::NotifyTaskDone( | 80 SyncTaskManager::NotifyTaskDone( |
| 78 make_scoped_ptr(new SyncTaskToken(manager_, | 81 make_scoped_ptr(new SyncTaskToken(manager_, |
| 79 task_runner_.get(), | 82 task_runner_.get(), |
| 80 token_id_, | 83 token_id_, |
| 81 task_blocker_.Pass(), | 84 task_blocker_.Pass(), |
| 82 SyncStatusCallback())), | 85 SyncStatusCallback())), |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 const SyncStatusCallback& callback) | 149 const SyncStatusCallback& callback) |
| 147 : manager_(manager), | 150 : manager_(manager), |
| 148 task_runner_(task_runner), | 151 task_runner_(task_runner), |
| 149 token_id_(token_id), | 152 token_id_(token_id), |
| 150 callback_(callback), | 153 callback_(callback), |
| 151 task_blocker_(task_blocker.Pass()) { | 154 task_blocker_(task_blocker.Pass()) { |
| 152 } | 155 } |
| 153 | 156 |
| 154 } // namespace drive_backend | 157 } // namespace drive_backend |
| 155 } // namespace sync_file_system | 158 } // namespace sync_file_system |
| OLD | NEW |