summaryrefslogtreecommitdiffstats
path: root/sync/internal_api/test
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-25 00:29:32 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-25 00:29:32 +0000
commit389f566a8d88ba4849dc1c2179e00bf64b1d1b39 (patch)
treead64c2dbf6b004f43fe3e8a0e7bd539f223a51f4 /sync/internal_api/test
parentccdcf4375d9a79dcea5d92692db30ae199ffff28 (diff)
downloadchromium_src-389f566a8d88ba4849dc1c2179e00bf64b1d1b39.zip
chromium_src-389f566a8d88ba4849dc1c2179e00bf64b1d1b39.tar.gz
chromium_src-389f566a8d88ba4849dc1c2179e00bf64b1d1b39.tar.bz2
Make use of InvalidationService
The InvalidationService was introduced r199520. That commit added the InvalidationService interface and several implementations of it, but made no use of the new code. This commit builds on that work. Up until now, TICL invalidations were handled on the sync thread. The related objects were instantiated and owned by the SyncBackendHost and SyncManager. All requests to update the set of object registrations had to be passed to the sync thread. Components that wanted to receive invalidations but were not part of sync had to route their communication with the invalidations server through ProfileSyncService to get to the sync thread. Things were a bit different on Android, but the system still tried to pretend that invalidations were owned by the sync thread. The new InvalidationService implementation is a ProfileKeyedService that is mostly independent from sync. It still relies on sync to manage sign in and fetch the appropriate auth tokens. However, it's now much easier for components outside of sync to communication with the invalidations server. The new system allows us to remove a lot of invalidations-related code from the ProfileSyncService, SyncBackendHost and SyncManager. Sync is now just one of many clients of the InvalidationService. The SyncBackendHost is responsible for forwarding messages back and forth between the InvalidationService and the sync thread. TBR=sky,erg BUG=124137 Review URL: https://chromiumcodereview.appspot.com/15580002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208315 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/internal_api/test')
-rw-r--r--sync/internal_api/test/fake_sync_manager.cc64
1 files changed, 8 insertions, 56 deletions
diff --git a/sync/internal_api/test/fake_sync_manager.cc b/sync/internal_api/test/fake_sync_manager.cc
index 3a9beca..7a6d6a4 100644
--- a/sync/internal_api/test/fake_sync_manager.cc
+++ b/sync/internal_api/test/fake_sync_manager.cc
@@ -61,25 +61,6 @@ ConfigureReason FakeSyncManager::GetAndResetConfigureReason() {
return reason;
}
-void FakeSyncManager::Invalidate(
- const ObjectIdInvalidationMap& invalidation_map) {
- if (!sync_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&FakeSyncManager::InvalidateOnSyncThread,
- base::Unretained(this), invalidation_map))) {
- NOTREACHED();
- }
-}
-
-void FakeSyncManager::UpdateInvalidatorState(InvalidatorState state) {
- if (!sync_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&FakeSyncManager::UpdateInvalidatorStateOnSyncThread,
- base::Unretained(this), state))) {
- NOTREACHED();
- }
-}
-
void FakeSyncManager::WaitForSyncThread() {
// Post a task to |sync_task_runner_| and block until it runs.
base::RunLoop run_loop;
@@ -103,7 +84,6 @@ void FakeSyncManager::Init(
ExtensionsActivityMonitor* extensions_activity_monitor,
ChangeDelegate* change_delegate,
const SyncCredentials& credentials,
- scoped_ptr<Invalidator> invalidator,
const std::string& invalidator_client_id,
const std::string& restored_key_for_bootstrapping,
const std::string& restored_keystore_key_for_bootstrapping,
@@ -161,31 +141,6 @@ void FakeSyncManager::UpdateCredentials(const SyncCredentials& credentials) {
NOTIMPLEMENTED();
}
-void FakeSyncManager::UpdateEnabledTypes(ModelTypeSet types) {
- enabled_types_ = types;
-}
-
-void FakeSyncManager::RegisterInvalidationHandler(
- InvalidationHandler* handler) {
- registrar_.RegisterHandler(handler);
-}
-
-void FakeSyncManager::UpdateRegisteredInvalidationIds(
- InvalidationHandler* handler,
- const ObjectIdSet& ids) {
- registrar_.UpdateRegisteredIds(handler, ids);
-}
-
-void FakeSyncManager::UnregisterInvalidationHandler(
- InvalidationHandler* handler) {
- registrar_.UnregisterHandler(handler);
-}
-
-void FakeSyncManager::AcknowledgeInvalidation(const invalidation::ObjectId& id,
- const AckHandle& ack_handle) {
- // Do nothing.
-}
-
void FakeSyncManager::StartSyncingNormally(
const ModelSafeRoutingInfo& routing_info) {
// Do nothing.
@@ -201,7 +156,7 @@ void FakeSyncManager::ConfigureSyncer(
const base::Closure& ready_task,
const base::Closure& retry_task) {
last_configure_reason_ = reason;
- ModelTypeSet enabled_types = GetRoutingInfoTypes(new_routing_info);
+ enabled_types_ = GetRoutingInfoTypes(new_routing_info);
ModelTypeSet success_types = to_download;
success_types.RemoveAll(configure_fail_types_);
@@ -291,20 +246,17 @@ void FakeSyncManager::RefreshTypes(ModelTypeSet types) {
last_refresh_request_types_ = types;
}
-void FakeSyncManager::InvalidateOnSyncThread(
- const ObjectIdInvalidationMap& invalidation_map) {
- DCHECK(sync_task_runner_->RunsTasksOnCurrentThread());
- registrar_.DispatchInvalidationsToHandlers(invalidation_map);
-}
-
-void FakeSyncManager::UpdateInvalidatorStateOnSyncThread(
- InvalidatorState state) {
- DCHECK(sync_task_runner_->RunsTasksOnCurrentThread());
- registrar_.UpdateInvalidatorState(state);
+void FakeSyncManager::OnIncomingInvalidation(
+ const ObjectIdInvalidationMap& invalidation_map) {
+ // Do nothing.
}
ModelTypeSet FakeSyncManager::GetLastRefreshRequestTypes() {
return last_refresh_request_types_;
}
+void FakeSyncManager::OnInvalidatorStateChange(InvalidatorState state) {
+ // Do nothing.
+}
+
} // namespace syncer