| 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_API_SYNCABLE_SERVICE_H_ | 5 #ifndef COMPONENTS_SYNC_API_SYNCABLE_SERVICE_H_ |
| 6 #define COMPONENTS_SYNC_API_SYNCABLE_SERVICE_H_ | 6 #define COMPONENTS_SYNC_API_SYNCABLE_SERVICE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "components/sync/api/attachments/attachment_store.h" | 14 #include "components/sync/api/attachments/attachment_store.h" |
| 15 #include "components/sync/api/sync_change_processor.h" | 15 #include "components/sync/api/sync_change_processor.h" |
| 16 #include "components/sync/api/sync_data.h" | 16 #include "components/sync/api/sync_data.h" |
| 17 #include "components/sync/api/sync_error.h" | 17 #include "components/sync/api/sync_error.h" |
| 18 #include "components/sync/api/sync_merge_result.h" | 18 #include "components/sync/api/sync_merge_result.h" |
| 19 #include "components/sync/base/model_type.h" | 19 #include "components/sync/base/model_type.h" |
| 20 #include "components/sync/base/sync_export.h" | |
| 21 | 20 |
| 22 namespace syncer { | 21 namespace syncer { |
| 23 | 22 |
| 24 class AttachmentService; | 23 class AttachmentService; |
| 25 class SyncErrorFactory; | 24 class SyncErrorFactory; |
| 26 | 25 |
| 27 // TODO(zea): remove SupportsWeakPtr in favor of having all SyncableService | 26 // TODO(zea): remove SupportsWeakPtr in favor of having all SyncableService |
| 28 // implementers provide a way of getting a weak pointer to themselves. | 27 // implementers provide a way of getting a weak pointer to themselves. |
| 29 // See crbug.com/100114. | 28 // See crbug.com/100114. |
| 30 class SYNC_EXPORT SyncableService | 29 class SyncableService : public SyncChangeProcessor, |
| 31 : public SyncChangeProcessor, | 30 public base::SupportsWeakPtr<SyncableService> { |
| 32 public base::SupportsWeakPtr<SyncableService> { | |
| 33 public: | 31 public: |
| 34 // 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 |
| 35 // to start ASAP, typically because a local change event has occurred but | 33 // to start ASAP, typically because a local change event has occurred but |
| 36 // MergeDataAndStartSyncing hasn't been called yet, meaning you don't have a | 34 // MergeDataAndStartSyncing hasn't been called yet, meaning you don't have a |
| 37 // SyncChangeProcessor. The sync subsystem will respond soon after invoking | 35 // SyncChangeProcessor. The sync subsystem will respond soon after invoking |
| 38 // Run() on your flare by calling MergeDataAndStartSyncing. The ModelType | 36 // Run() on your flare by calling MergeDataAndStartSyncing. The ModelType |
| 39 // parameter is included so that the recieving end can track usage and timing | 37 // parameter is included so that the recieving end can track usage and timing |
| 40 // statistics, make optimizations or tradeoffs by type, etc. | 38 // statistics, make optimizations or tradeoffs by type, etc. |
| 41 typedef base::Callback<void(ModelType)> StartSyncFlare; | 39 typedef base::Callback<void(ModelType)> StartSyncFlare; |
| 42 | 40 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 virtual void SetAttachmentService( | 86 virtual void SetAttachmentService( |
| 89 std::unique_ptr<AttachmentService> attachment_service); | 87 std::unique_ptr<AttachmentService> attachment_service); |
| 90 | 88 |
| 91 protected: | 89 protected: |
| 92 ~SyncableService() override; | 90 ~SyncableService() override; |
| 93 }; | 91 }; |
| 94 | 92 |
| 95 } // namespace syncer | 93 } // namespace syncer |
| 96 | 94 |
| 97 #endif // COMPONENTS_SYNC_API_SYNCABLE_SERVICE_H_ | 95 #endif // COMPONENTS_SYNC_API_SYNCABLE_SERVICE_H_ |
| OLD | NEW |