| 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 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_TASK_TOKEN_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_TASK_TOKEN_H_ |
| 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_TASK_TOKEN_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_TASK_TOKEN_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "chrome/browser/sync_file_system/sync_callbacks.h" | 12 #include "chrome/browser/sync_file_system/sync_callbacks.h" |
| 13 #include "chrome/browser/sync_file_system/task_logger.h" |
| 13 | 14 |
| 14 namespace sync_file_system { | 15 namespace sync_file_system { |
| 15 namespace drive_backend { | 16 namespace drive_backend { |
| 16 | 17 |
| 17 class SyncTaskManager; | 18 class SyncTaskManager; |
| 18 struct BlockingFactor; | 19 struct BlockingFactor; |
| 19 | 20 |
| 20 // Represents a running sequence of SyncTasks. Owned by a callback chain that | 21 // Represents a running sequence of SyncTasks. Owned by a callback chain that |
| 21 // should run exclusively, and held by SyncTaskManager when no task is running. | 22 // should run exclusively, and held by SyncTaskManager when no task is running. |
| 22 class SyncTaskToken { | 23 class SyncTaskToken { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 46 | 47 |
| 47 const SyncStatusCallback& callback() const { return callback_; } | 48 const SyncStatusCallback& callback() const { return callback_; } |
| 48 void clear_callback() { callback_.Reset(); } | 49 void clear_callback() { callback_.Reset(); } |
| 49 | 50 |
| 50 void set_blocking_factor(scoped_ptr<BlockingFactor> blocking_factor); | 51 void set_blocking_factor(scoped_ptr<BlockingFactor> blocking_factor); |
| 51 const BlockingFactor* blocking_factor() const; | 52 const BlockingFactor* blocking_factor() const; |
| 52 void clear_blocking_factor(); | 53 void clear_blocking_factor(); |
| 53 | 54 |
| 54 int64 token_id() const { return token_id_; } | 55 int64 token_id() const { return token_id_; } |
| 55 | 56 |
| 57 void InitializeTaskLog(const std::string& task_description); |
| 58 void FinalizeTaskLog(const std::string& result_description); |
| 59 void RecordLog(const std::string& message); |
| 60 |
| 61 void SetTaskLog(scoped_ptr<TaskLogger::TaskLog> task_log); |
| 62 scoped_ptr<TaskLogger::TaskLog> PassTaskLog(); |
| 63 |
| 56 private: | 64 private: |
| 57 SyncTaskToken(const base::WeakPtr<SyncTaskManager>& manager, | 65 SyncTaskToken(const base::WeakPtr<SyncTaskManager>& manager, |
| 58 int64 token_id, | 66 int64 token_id, |
| 59 scoped_ptr<BlockingFactor> blocking_factor, | 67 scoped_ptr<BlockingFactor> blocking_factor, |
| 60 const SyncStatusCallback& callback); | 68 const SyncStatusCallback& callback); |
| 61 | 69 |
| 62 base::WeakPtr<SyncTaskManager> manager_; | 70 base::WeakPtr<SyncTaskManager> manager_; |
| 63 tracked_objects::Location location_; | 71 tracked_objects::Location location_; |
| 64 int64 token_id_; | 72 int64 token_id_; |
| 65 SyncStatusCallback callback_; | 73 SyncStatusCallback callback_; |
| 66 | 74 |
| 75 scoped_ptr<TaskLogger::TaskLog> task_log_; |
| 67 scoped_ptr<BlockingFactor> blocking_factor_; | 76 scoped_ptr<BlockingFactor> blocking_factor_; |
| 68 | 77 |
| 69 DISALLOW_COPY_AND_ASSIGN(SyncTaskToken); | 78 DISALLOW_COPY_AND_ASSIGN(SyncTaskToken); |
| 70 }; | 79 }; |
| 71 | 80 |
| 72 } // namespace drive_backend | 81 } // namespace drive_backend |
| 73 } // namespace sync_file_system | 82 } // namespace sync_file_system |
| 74 | 83 |
| 75 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_TASK_TOKEN_H_ | 84 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_TASK_TOKEN_H_ |
| OLD | NEW |