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

Side by Side Diff: chrome/browser/sync/profile_sync_service.h

Issue 7655055: [Sync] Make BackendMigrator not wait for full sync cycles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup Created 9 years, 3 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_PROFILE_SYNC_SERVICE_H_ 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.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 "base/string16.h" 17 #include "base/string16.h"
18 #include "base/task.h" 18 #include "base/task.h"
19 #include "base/time.h" 19 #include "base/time.h"
20 #include "base/timer.h" 20 #include "base/timer.h"
21 #include "base/tracked.h" 21 #include "base/tracked.h"
22 #include "chrome/browser/prefs/pref_member.h" 22 #include "chrome/browser/prefs/pref_member.h"
23 #include "chrome/browser/sync/backend_migrator.h"
23 #include "chrome/browser/sync/engine/model_safe_worker.h" 24 #include "chrome/browser/sync/engine/model_safe_worker.h"
24 #include "chrome/browser/sync/glue/data_type_controller.h" 25 #include "chrome/browser/sync/glue/data_type_controller.h"
25 #include "chrome/browser/sync/glue/sync_backend_host.h" 26 #include "chrome/browser/sync/glue/sync_backend_host.h"
26 #include "chrome/browser/sync/internal_api/sync_manager.h" 27 #include "chrome/browser/sync/internal_api/sync_manager.h"
27 #include "chrome/browser/sync/profile_sync_service_observer.h" 28 #include "chrome/browser/sync/profile_sync_service_observer.h"
28 #include "chrome/browser/sync/syncable/model_type.h" 29 #include "chrome/browser/sync/syncable/model_type.h"
29 #include "chrome/browser/sync/sync_js_controller.h" 30 #include "chrome/browser/sync/sync_js_controller.h"
30 #include "chrome/browser/sync/sync_setup_wizard.h" 31 #include "chrome/browser/sync/sync_setup_wizard.h"
31 #include "chrome/browser/sync/unrecoverable_error_handler.h" 32 #include "chrome/browser/sync/unrecoverable_error_handler.h"
32 #include "chrome/common/net/gaia/google_service_auth_error.h" 33 #include "chrome/common/net/gaia/google_service_auth_error.h"
33 #include "content/common/content_notification_types.h" 34 #include "content/common/content_notification_types.h"
34 #include "content/common/notification_observer.h" 35 #include "content/common/notification_observer.h"
35 #include "content/common/notification_registrar.h" 36 #include "content/common/notification_registrar.h"
36 #include "googleurl/src/gurl.h" 37 #include "googleurl/src/gurl.h"
37 38
38 class NotificationDetails; 39 class NotificationDetails;
39 class NotificationSource; 40 class NotificationSource;
40 class Profile; 41 class Profile;
41 class ProfileSyncFactory; 42 class ProfileSyncFactory;
42 class SigninManager; 43 class SigninManager;
43 struct ChromeCookieDetails; 44 struct ChromeCookieDetails;
44 45
45 namespace browser_sync { 46 namespace browser_sync {
46 class BackendMigrator;
47 class ChangeProcessor; 47 class ChangeProcessor;
48 class DataTypeManager; 48 class DataTypeManager;
49 class JsController; 49 class JsController;
50 class SessionModelAssociator; 50 class SessionModelAssociator;
51 namespace sessions { struct SyncSessionSnapshot; } 51 namespace sessions { struct SyncSessionSnapshot; }
52 } 52 }
53 53
54 namespace sync_api { 54 namespace sync_api {
55 class BaseTransaction; 55 class BaseTransaction;
56 struct SyncCredentials; 56 struct SyncCredentials;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // actively installed ChangeProcessor that listens for changes to this 94 // actively installed ChangeProcessor that listens for changes to this
95 // datatype, propagating such changes into and out of the sync backend 95 // datatype, propagating such changes into and out of the sync backend
96 // as necessary. 96 // as necessary.
97 // 97 //
98 // When a datatype is in the process of becoming active, it may be 98 // When a datatype is in the process of becoming active, it may be
99 // in some intermediate state. Those finer-grained intermediate states 99 // in some intermediate state. Those finer-grained intermediate states
100 // are differentiated by the DataTypeController state. 100 // are differentiated by the DataTypeController state.
101 // 101 //
102 class ProfileSyncService : public browser_sync::SyncFrontend, 102 class ProfileSyncService : public browser_sync::SyncFrontend,
103 public browser_sync::UnrecoverableErrorHandler, 103 public browser_sync::UnrecoverableErrorHandler,
104 public browser_sync::MigrationObserver,
104 public NotificationObserver { 105 public NotificationObserver {
105 public: 106 public:
106 typedef ProfileSyncServiceObserver Observer; 107 typedef ProfileSyncServiceObserver Observer;
107 typedef browser_sync::SyncBackendHost::Status Status; 108 typedef browser_sync::SyncBackendHost::Status Status;
108 109
109 enum SyncEventCodes { 110 enum SyncEventCodes {
110 MIN_SYNC_EVENT_CODE = 0, 111 MIN_SYNC_EVENT_CODE = 0,
111 112
112 // Events starting the sync service. 113 // Events starting the sync service.
113 START_FROM_NTP = 1, // Sync was started from the ad in NTP 114 START_FROM_NTP = 1, // Sync was started from the ad in NTP
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 // command-line switches). 346 // command-line switches).
346 static bool IsSyncEnabled(); 347 static bool IsSyncEnabled();
347 348
348 // Returns whether sync is managed, i.e. controlled by configuration 349 // Returns whether sync is managed, i.e. controlled by configuration
349 // management. If so, the user is not allowed to configure sync. 350 // management. If so, the user is not allowed to configure sync.
350 bool IsManaged(); 351 bool IsManaged();
351 352
352 // UnrecoverableErrorHandler implementation. 353 // UnrecoverableErrorHandler implementation.
353 virtual void OnUnrecoverableError( 354 virtual void OnUnrecoverableError(
354 const tracked_objects::Location& from_here, 355 const tracked_objects::Location& from_here,
355 const std::string& message); 356 const std::string& message) OVERRIDE;
357
358 // MigrationObserver implementation.
359 virtual void OnMigrationStateChange() OVERRIDE;
356 360
357 // The functions below (until ActivateDataType()) should only be 361 // The functions below (until ActivateDataType()) should only be
358 // called if sync_initialized() is true. 362 // called if sync_initialized() is true.
359 363
360 // TODO(akalin): This is called mostly by ModelAssociators and 364 // TODO(akalin): This is called mostly by ModelAssociators and
361 // tests. Figure out how to pass the handle to the ModelAssociators 365 // tests. Figure out how to pass the handle to the ModelAssociators
362 // directly, figure out how to expose this to tests, and remove this 366 // directly, figure out how to expose this to tests, and remove this
363 // function. 367 // function.
364 sync_api::UserShare* GetUserShare() const; 368 sync_api::UserShare* GetUserShare() const;
365 369
366 // TODO(akalin): These two functions are used only by 370 // TODO(akalin): These two functions are used only by
367 // ProfileSyncServiceHarness. Figure out a different way to expose 371 // ProfileSyncServiceHarness. Figure out a different way to expose
368 // this info to that class, and remove these functions. 372 // this info to that class, and remove these functions.
369 373
370 virtual const browser_sync::sessions::SyncSessionSnapshot* 374 virtual const browser_sync::sessions::SyncSessionSnapshot*
371 GetLastSessionSnapshot() const; 375 GetLastSessionSnapshot() const;
372 376
373 // Returns whether or not the underlying sync engine has made any 377 // Returns whether or not the underlying sync engine has made any
374 // local changes to items that have not yet been synced with the 378 // local changes to items that have not yet been synced with the
375 // server. 379 // server.
376 bool HasUnsyncedItems() const; 380 bool HasUnsyncedItems() const;
377 381
378 // Logs the current unsynced items in the sync database. Useful for debugging. 382 // Logs the current unsynced items in the sync database. Useful for debugging.
379 void LogUnsyncedItems(int level) const; 383 void LogUnsyncedItems(int level) const;
380 384
381 // Returns whether or not the sync service is reconfiguring due 385 // Returns whether or not the sync service is reconfiguring due
382 // to server-initiated resynchronization. 386 // to server-initiated resynchronization.
383 bool HasPendingBackendMigration() const; 387 bool HasPendingBackendMigration() const;
384 388
389 // Returns the types that are currently pending migration. Used by
390 // tests.
391 syncable::ModelTypeSet GetPendingMigrationTypesForTest() const;
392
385 // Get the current routing information for all enabled model types. 393 // Get the current routing information for all enabled model types.
386 // If a model type is not enabled (that is, if the syncer should not 394 // If a model type is not enabled (that is, if the syncer should not
387 // be trying to sync it), it is not in this map. 395 // be trying to sync it), it is not in this map.
388 // 396 //
389 // TODO(akalin): This function is used by 397 // TODO(akalin): This function is used by
390 // sync_ui_util::ConstructAboutInformation() and by some test 398 // sync_ui_util::ConstructAboutInformation() and by some test
391 // classes. Figure out a different way to expose this info and 399 // classes. Figure out a different way to expose this info and
392 // remove this function. 400 // remove this function.
393 void GetModelSafeRoutingInfo( 401 void GetModelSafeRoutingInfo(
394 browser_sync::ModelSafeRoutingInfo* out) const; 402 browser_sync::ModelSafeRoutingInfo* out) const;
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 // (OnEncryptionComplete) or the user cancels. 669 // (OnEncryptionComplete) or the user cancels.
662 syncable::ModelTypeSet pending_types_for_encryption_; 670 syncable::ModelTypeSet pending_types_for_encryption_;
663 bool set_backend_encrypted_types_; 671 bool set_backend_encrypted_types_;
664 672
665 scoped_ptr<browser_sync::BackendMigrator> migrator_; 673 scoped_ptr<browser_sync::BackendMigrator> migrator_;
666 674
667 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); 675 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService);
668 }; 676 };
669 677
670 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 678 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698