OLD | NEW |
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/drive_file_sync_task_manager.h" | 5 #include "chrome/browser/sync_file_system/drive_file_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/drive_file_sync_service.h" | 9 #include "chrome/browser/sync_file_system/drive_file_sync_service.h" |
10 #include "chrome/browser/sync_file_system/drive_file_sync_util.h" | 10 #include "chrome/browser/sync_file_system/drive_file_sync_util.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 } | 26 } |
27 | 27 |
28 const tracked_objects::Location& location() const { return location_; } | 28 const tracked_objects::Location& location() const { return location_; } |
29 | 29 |
30 ~TaskToken() { | 30 ~TaskToken() { |
31 // All task on DriveFileSyncService must hold TaskToken instance to ensure | 31 // All task on DriveFileSyncService must hold TaskToken instance to ensure |
32 // no other tasks are running. Also, as soon as a task finishes to work, | 32 // no other tasks are running. Also, as soon as a task finishes to work, |
33 // it must return the token to DriveFileSyncService. | 33 // it must return the token to DriveFileSyncService. |
34 // Destroying a token with valid |sync_service_| indicates the token was | 34 // Destroying a token with valid |sync_service_| indicates the token was |
35 // dropped by a task without returning. | 35 // dropped by a task without returning. |
36 if (manager_ && manager_->service_.get()) { | 36 if (manager_.get() && manager_->service_.get()) { |
37 NOTREACHED() << "Unexpected TaskToken deletion from: " | 37 NOTREACHED() |
38 << location_.ToString(); | 38 << "Unexpected TaskToken deletion from: " << location_.ToString(); |
39 | 39 |
40 // Reinitializes the token. | 40 // Reinitializes the token. |
41 manager_->NotifyTaskDone( | 41 manager_->NotifyTaskDone( |
42 make_scoped_ptr(new TaskToken(manager_)), | 42 make_scoped_ptr(new TaskToken(manager_)), |
43 SyncStatusCallback(), | 43 SyncStatusCallback(), |
44 SYNC_STATUS_OK); | 44 SYNC_STATUS_OK); |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 private: | 48 private: |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 SyncStatusCallback DriveFileSyncTaskManager::CreateCompletionCallback( | 138 SyncStatusCallback DriveFileSyncTaskManager::CreateCompletionCallback( |
139 scoped_ptr<TaskToken> token, | 139 scoped_ptr<TaskToken> token, |
140 const SyncStatusCallback& callback) { | 140 const SyncStatusCallback& callback) { |
141 DCHECK(token); | 141 DCHECK(token); |
142 return base::Bind(&DriveFileSyncTaskManager::NotifyTaskDone, | 142 return base::Bind(&DriveFileSyncTaskManager::NotifyTaskDone, |
143 AsWeakPtr(), base::Passed(&token), callback); | 143 AsWeakPtr(), base::Passed(&token), callback); |
144 } | 144 } |
145 | 145 |
146 } // namespace sync_file_system | 146 } // namespace sync_file_system |
OLD | NEW |