| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 COMPONENTS_SYNC_MODEL_SYNCABLE_SERVICE_H_ | 5 #ifndef COMPONENTS_SYNC_MODEL_SYNCABLE_SERVICE_H_ |
| 6 #define COMPONENTS_SYNC_MODEL_SYNCABLE_SERVICE_H_ | 6 #define COMPONENTS_SYNC_MODEL_SYNCABLE_SERVICE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class AttachmentService; | 23 class AttachmentService; |
| 24 class SyncErrorFactory; | 24 class SyncErrorFactory; |
| 25 | 25 |
| 26 // TODO(zea): remove SupportsWeakPtr in favor of having all SyncableService | 26 // TODO(zea): remove SupportsWeakPtr in favor of having all SyncableService |
| 27 // implementers provide a way of getting a weak pointer to themselves. | 27 // implementers provide a way of getting a weak pointer to themselves. |
| 28 // See crbug.com/100114. | 28 // See crbug.com/100114. |
| 29 class SyncableService : public SyncChangeProcessor, | 29 class SyncableService : public SyncChangeProcessor, |
| 30 public base::SupportsWeakPtr<SyncableService> { | 30 public base::SupportsWeakPtr<SyncableService> { |
| 31 public: | 31 public: |
| 32 // A StartSyncFlare is useful when your SyncableService has a need for sync | 32 // A StartSyncFlare is useful when your SyncableService has a need for sync |
| 33 // to start ASAP, typically because a local change event has occurred but | 33 // to start ASAP. This is typically for one of three reasons: |
| 34 // MergeDataAndStartSyncing hasn't been called yet, meaning you don't have a | 34 // 1) Because a local change event has occurred but MergeDataAndStartSyncing |
| 35 // SyncChangeProcessor. The sync subsystem will respond soon after invoking | 35 // hasn't been called yet, meaning you don't have a SyncChangeProcessor. The |
| 36 // Run() on your flare by calling MergeDataAndStartSyncing. The ModelType | 36 // sync subsystem will respond soon after invoking Run() on your flare by |
| 37 // parameter is included so that the recieving end can track usage and timing | 37 // calling MergeDataAndStartSyncing. |
| 38 // statistics, make optimizations or tradeoffs by type, etc. | 38 // 2) You want remote data to be visible immediately; for example if the |
| 39 // history page is open, you want remote sessions data to be available there. |
| 40 // 3) You want to signal to sync that it's safe to start now that the |
| 41 // browser's IO-intensive startup process is over. The ModelType parameter is |
| 42 // included so that the recieving end can track usage and timing statistics, |
| 43 // make pptimizations or tradeoffs by type, etc. |
| 39 using StartSyncFlare = base::Callback<void(ModelType)>; | 44 using StartSyncFlare = base::Callback<void(ModelType)>; |
| 40 | 45 |
| 41 // Informs the service to begin syncing the specified synced datatype |type|. | 46 // Informs the service to begin syncing the specified synced datatype |type|. |
| 42 // The service should then merge |initial_sync_data| into it's local data, | 47 // The service should then merge |initial_sync_data| into it's local data, |
| 43 // calling |sync_processor|'s ProcessSyncChanges as necessary to reconcile the | 48 // calling |sync_processor|'s ProcessSyncChanges as necessary to reconcile the |
| 44 // two. After this, the SyncableService's local data should match the server | 49 // two. After this, the SyncableService's local data should match the server |
| 45 // data, and the service should be ready to receive and process any further | 50 // data, and the service should be ready to receive and process any further |
| 46 // SyncChange's as they occur. | 51 // SyncChange's as they occur. |
| 47 // Returns: a SyncMergeResult whose error field reflects whether an error | 52 // Returns: a SyncMergeResult whose error field reflects whether an error |
| 48 // was encountered while merging the two models. The merge result | 53 // was encountered while merging the two models. The merge result |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 virtual void SetAttachmentService( | 91 virtual void SetAttachmentService( |
| 87 std::unique_ptr<AttachmentService> attachment_service); | 92 std::unique_ptr<AttachmentService> attachment_service); |
| 88 | 93 |
| 89 protected: | 94 protected: |
| 90 ~SyncableService() override; | 95 ~SyncableService() override; |
| 91 }; | 96 }; |
| 92 | 97 |
| 93 } // namespace syncer | 98 } // namespace syncer |
| 94 | 99 |
| 95 #endif // COMPONENTS_SYNC_MODEL_SYNCABLE_SERVICE_H_ | 100 #endif // COMPONENTS_SYNC_MODEL_SYNCABLE_SERVICE_H_ |
| OLD | NEW |