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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/sync_engine_initializer.h

Issue 293003002: [SyncFS] Remove using MessageLoop in worker thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RemoteToLocalSyncer Created 6 years, 7 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 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 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_INITIALIZER_H_ 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_INITIALIZER_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_INITIALIZER_H_ 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_INITIALIZER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/sequenced_task_runner.h"
15 #include "chrome/browser/sync_file_system/drive_backend/sync_task.h" 14 #include "chrome/browser/sync_file_system/drive_backend/sync_task.h"
16 #include "chrome/browser/sync_file_system/sync_callbacks.h" 15 #include "chrome/browser/sync_file_system/sync_callbacks.h"
17 #include "google_apis/drive/drive_common_callbacks.h" 16 #include "google_apis/drive/drive_common_callbacks.h"
18 #include "google_apis/drive/gdata_errorcode.h" 17 #include "google_apis/drive/gdata_errorcode.h"
19 18
20 namespace drive { 19 namespace drive {
21 class DriveServiceInterface; 20 class DriveServiceInterface;
22 } 21 }
23 22
24 namespace google_apis { 23 namespace google_apis {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // - Detach the remote sync-root folder from its parent if it has. 59 // - Detach the remote sync-root folder from its parent if it has.
61 // - Fetch the folder contents of the remote sync-root folder. 60 // - Fetch the folder contents of the remote sync-root folder.
62 // The contents are likely registered as app-root folders, but handle them 61 // The contents are likely registered as app-root folders, but handle them
63 // as regular inactive folders until they are registered explicitly. 62 // as regular inactive folders until they are registered explicitly.
64 // - Populate database with the largest change ID, the sync-root folder and 63 // - Populate database with the largest change ID, the sync-root folder and
65 // its contents. 64 // its contents.
66 // 65 //
67 class SyncEngineInitializer : public SyncTask { 66 class SyncEngineInitializer : public SyncTask {
68 public: 67 public:
69 SyncEngineInitializer(SyncEngineContext* sync_context, 68 SyncEngineInitializer(SyncEngineContext* sync_context,
70 base::SequencedTaskRunner* task_runner,
71 const base::FilePath& database_path, 69 const base::FilePath& database_path,
72 leveldb::Env* env_override); 70 leveldb::Env* env_override);
73 virtual ~SyncEngineInitializer(); 71 virtual ~SyncEngineInitializer();
74 virtual void RunPreflight(scoped_ptr<SyncTaskToken> token) OVERRIDE; 72 virtual void RunPreflight(scoped_ptr<SyncTaskToken> token) OVERRIDE;
75 73
76 scoped_ptr<MetadataDatabase> PassMetadataDatabase(); 74 scoped_ptr<MetadataDatabase> PassMetadataDatabase();
77 75
78 private: 76 private:
79 typedef base::Callback<void(const SyncStatusCallback& callback)> Task; 77 typedef base::Callback<void(const SyncStatusCallback& callback)> Task;
80 78
(...skipping 22 matching lines...) Expand all
103 scoped_ptr<SyncTaskToken> token, 101 scoped_ptr<SyncTaskToken> token,
104 google_apis::GDataErrorCode error, 102 google_apis::GDataErrorCode error,
105 scoped_ptr<google_apis::ResourceList> resource_list); 103 scoped_ptr<google_apis::ResourceList> resource_list);
106 void PopulateDatabase(scoped_ptr<SyncTaskToken> token); 104 void PopulateDatabase(scoped_ptr<SyncTaskToken> token);
107 void DidPopulateDatabase(scoped_ptr<SyncTaskToken> token, 105 void DidPopulateDatabase(scoped_ptr<SyncTaskToken> token,
108 SyncStatusCode status); 106 SyncStatusCode status);
109 107
110 SyncEngineContext* sync_context_; // Not owned. 108 SyncEngineContext* sync_context_; // Not owned.
111 leveldb::Env* env_override_; 109 leveldb::Env* env_override_;
112 110
113 scoped_refptr<base::SequencedTaskRunner> task_runner_;
114 google_apis::CancelCallback cancel_callback_; 111 google_apis::CancelCallback cancel_callback_;
115 base::FilePath database_path_; 112 base::FilePath database_path_;
116 113
117 int find_sync_root_retry_count_; 114 int find_sync_root_retry_count_;
118 115
119 scoped_ptr<MetadataDatabase> metadata_database_; 116 scoped_ptr<MetadataDatabase> metadata_database_;
120 ScopedVector<google_apis::ResourceEntry> app_root_folders_; 117 ScopedVector<google_apis::ResourceEntry> app_root_folders_;
121 118
122 int64 largest_change_id_; 119 int64 largest_change_id_;
123 std::string root_folder_id_; 120 std::string root_folder_id_;
124 121
125 scoped_ptr<google_apis::ResourceEntry> sync_root_folder_; 122 scoped_ptr<google_apis::ResourceEntry> sync_root_folder_;
126 123
127 base::WeakPtrFactory<SyncEngineInitializer> weak_ptr_factory_; 124 base::WeakPtrFactory<SyncEngineInitializer> weak_ptr_factory_;
128 125
129 DISALLOW_COPY_AND_ASSIGN(SyncEngineInitializer); 126 DISALLOW_COPY_AND_ASSIGN(SyncEngineInitializer);
130 }; 127 };
131 128
132 } // namespace drive_backend 129 } // namespace drive_backend
133 } // namespace sync_file_system 130 } // namespace sync_file_system
134 131
135 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_INITIALIZER _H_ 132 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_INITIALIZER _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698