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

Side by Side Diff: chrome/browser/sync_file_system/local/local_file_sync_service.h

Issue 145693005: [FileAPI] Replace default leveldb::Env with leveldb::MemEnv in tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 10 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_LOCAL_LOCAL_FILE_SYNC_SERVICE_H_ 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_SYNC_SERVICE_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_SYNC_SERVICE_H_ 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_SYNC_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/observer_list.h" 16 #include "base/observer_list.h"
17 #include "chrome/browser/sync_file_system/local/local_origin_change_observer.h" 17 #include "chrome/browser/sync_file_system/local/local_origin_change_observer.h"
18 #include "chrome/browser/sync_file_system/remote_change_processor.h" 18 #include "chrome/browser/sync_file_system/remote_change_processor.h"
19 #include "chrome/browser/sync_file_system/sync_callbacks.h" 19 #include "chrome/browser/sync_file_system/sync_callbacks.h"
20 #include "chrome/browser/sync_file_system/sync_status_code.h" 20 #include "chrome/browser/sync_file_system/sync_status_code.h"
21 21
22 class GURL; 22 class GURL;
23 class Profile; 23 class Profile;
24 24
25 namespace fileapi { 25 namespace fileapi {
26 class FileSystemContext; 26 class FileSystemContext;
27 } 27 }
28 28
29 namespace leveldb {
30 class Env;
31 }
32
29 namespace webkit_blob { 33 namespace webkit_blob {
30 class ScopedFile; 34 class ScopedFile;
31 } 35 }
32 36
33 namespace sync_file_system { 37 namespace sync_file_system {
34 38
35 class FileChange; 39 class FileChange;
36 class LocalChangeProcessor; 40 class LocalChangeProcessor;
37 class LocalFileSyncContext; 41 class LocalFileSyncContext;
38 struct LocalFileSyncInfo; 42 struct LocalFileSyncInfo;
(...skipping 20 matching lines...) Expand all
59 virtual void OnLocalChangeAvailable(int64 pending_changes_hint) = 0; 63 virtual void OnLocalChangeAvailable(int64 pending_changes_hint) = 0;
60 64
61 private: 65 private:
62 DISALLOW_COPY_AND_ASSIGN(Observer); 66 DISALLOW_COPY_AND_ASSIGN(Observer);
63 }; 67 };
64 68
65 typedef base::Callback<void(SyncStatusCode status, 69 typedef base::Callback<void(SyncStatusCode status,
66 bool has_pending_changes)> 70 bool has_pending_changes)>
67 HasPendingLocalChangeCallback; 71 HasPendingLocalChangeCallback;
68 72
69 explicit LocalFileSyncService(Profile* profile); 73 static scoped_ptr<LocalFileSyncService> Create(Profile* profile);
74 static scoped_ptr<LocalFileSyncService> CreateForTesting(
75 Profile* profile,
76 leveldb::Env* env_override);
70 virtual ~LocalFileSyncService(); 77 virtual ~LocalFileSyncService();
71 78
72 void Shutdown(); 79 void Shutdown();
73 80
74 void MaybeInitializeFileSystemContext( 81 void MaybeInitializeFileSystemContext(
75 const GURL& app_origin, 82 const GURL& app_origin,
76 fileapi::FileSystemContext* file_system_context, 83 fileapi::FileSystemContext* file_system_context,
77 const SyncStatusCallback& callback); 84 const SyncStatusCallback& callback);
78 85
79 void AddChangeObserver(Observer* observer); 86 void AddChangeObserver(Observer* observer);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 182
176 private: 183 private:
177 // Per-origin changes (cached info, could be stale). 184 // Per-origin changes (cached info, could be stale).
178 Map change_count_map_; 185 Map change_count_map_;
179 Map::iterator next_; 186 Map::iterator next_;
180 187
181 // Holds a set of disabled (but initialized) origins. 188 // Holds a set of disabled (but initialized) origins.
182 std::set<GURL> disabled_origins_; 189 std::set<GURL> disabled_origins_;
183 }; 190 };
184 191
192 LocalFileSyncService(Profile* profile, leveldb::Env* env_override);
193
185 void DidInitializeFileSystemContext( 194 void DidInitializeFileSystemContext(
186 const GURL& app_origin, 195 const GURL& app_origin,
187 fileapi::FileSystemContext* file_system_context, 196 fileapi::FileSystemContext* file_system_context,
188 const SyncStatusCallback& callback, 197 const SyncStatusCallback& callback,
189 SyncStatusCode status); 198 SyncStatusCode status);
190 void DidInitializeForRemoteSync( 199 void DidInitializeForRemoteSync(
191 const fileapi::FileSystemURL& url, 200 const fileapi::FileSystemURL& url,
192 fileapi::FileSystemContext* file_system_context, 201 fileapi::FileSystemContext* file_system_context,
193 const PrepareChangeCallback& callback, 202 const PrepareChangeCallback& callback,
194 SyncStatusCode status); 203 SyncStatusCode status);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 GetLocalChangeProcessorCallback get_local_change_processor_; 251 GetLocalChangeProcessorCallback get_local_change_processor_;
243 252
244 ObserverList<Observer> change_observers_; 253 ObserverList<Observer> change_observers_;
245 254
246 DISALLOW_COPY_AND_ASSIGN(LocalFileSyncService); 255 DISALLOW_COPY_AND_ASSIGN(LocalFileSyncService);
247 }; 256 };
248 257
249 } // namespace sync_file_system 258 } // namespace sync_file_system
250 259
251 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_SYNC_SERVICE_H_ 260 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_SYNC_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698