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

Side by Side Diff: components/sync/driver/glue/sync_backend_host_impl.cc

Issue 2576203004: [Sync] Remove SyncEngine::UnregisterInvalidationIds (Closed)
Patch Set: Created 4 years 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
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 #include "components/sync/driver/glue/sync_backend_host_impl.h" 5 #include "components/sync/driver/glue/sync_backend_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 core_->ShutdownOnUIThread(); 178 core_->ShutdownOnUIThread();
179 } 179 }
180 180
181 void SyncBackendHostImpl::Shutdown(ShutdownReason reason) { 181 void SyncBackendHostImpl::Shutdown(ShutdownReason reason) {
182 // StopSyncingForShutdown() (which nulls out |host_|) should be 182 // StopSyncingForShutdown() (which nulls out |host_|) should be
183 // called first. 183 // called first.
184 DCHECK(!host_); 184 DCHECK(!host_);
185 185
186 if (invalidation_handler_registered_) { 186 if (invalidation_handler_registered_) {
187 if (reason == DISABLE_SYNC) { 187 CHECK(invalidator_->UpdateRegisteredInvalidationIds(this, ObjectIdSet()));
188 UnregisterInvalidationIds();
189 }
190 invalidator_->UnregisterInvalidationHandler(this); 188 invalidator_->UnregisterInvalidationHandler(this);
191 invalidator_ = nullptr; 189 invalidator_ = nullptr;
192 } 190 }
193 invalidation_handler_registered_ = false; 191 invalidation_handler_registered_ = false;
194 192
195 model_type_connector_.reset(); 193 model_type_connector_.reset();
196 194
197 // Shut down and destroy SyncManager. SyncManager holds a pointer to 195 // Shut down and destroy SyncManager. SyncManager holds a pointer to
198 // |registrar_| so its destruction must be sequenced before the destruction of 196 // |registrar_| so its destruction must be sequenced before the destruction of
199 // |registrar_|. 197 // |registrar_|.
200 sync_task_runner_->PostTask( 198 sync_task_runner_->PostTask(
201 FROM_HERE, base::Bind(&SyncBackendHostCore::DoShutdown, core_, reason)); 199 FROM_HERE, base::Bind(&SyncBackendHostCore::DoShutdown, core_, reason));
202 core_ = nullptr; 200 core_ = nullptr;
203 registrar_ = nullptr; 201 registrar_ = nullptr;
204 } 202 }
205 203
206 void SyncBackendHostImpl::UnregisterInvalidationIds() {
207 if (invalidation_handler_registered_) {
208 CHECK(invalidator_->UpdateRegisteredInvalidationIds(this, ObjectIdSet()));
209 }
210 }
211
212 ModelTypeSet SyncBackendHostImpl::ConfigureDataTypes( 204 ModelTypeSet SyncBackendHostImpl::ConfigureDataTypes(
213 ConfigureReason reason, 205 ConfigureReason reason,
214 const DataTypeConfigStateMap& config_state_map, 206 const DataTypeConfigStateMap& config_state_map,
215 const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task, 207 const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task,
216 const base::Callback<void()>& retry_callback) { 208 const base::Callback<void()>& retry_callback) {
217 // Only one configure is allowed at a time. This is guaranteed by our 209 // Only one configure is allowed at a time. This is guaranteed by our
218 // callers. The SyncBackendHostImpl requests one configure as the backend is 210 // callers. The SyncBackendHostImpl requests one configure as the backend is
219 // initializing and waits for it to complete. After initialization, all 211 // initializing and waits for it to complete. After initialization, all
220 // configurations will pass through the DataTypeManager, which is careful to 212 // configurations will pass through the DataTypeManager, which is careful to
221 // never send a new configure request until the current request succeeds. 213 // never send a new configure request until the current request succeeds.
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 const SyncManager::ClearServerDataCallback& frontend_callback) { 687 const SyncManager::ClearServerDataCallback& frontend_callback) {
696 DCHECK(thread_checker_.CalledOnValidThread()); 688 DCHECK(thread_checker_.CalledOnValidThread());
697 frontend_callback.Run(); 689 frontend_callback.Run();
698 } 690 }
699 691
700 } // namespace syncer 692 } // namespace syncer
701 693
702 #undef SDVLOG 694 #undef SDVLOG
703 695
704 #undef SLOG 696 #undef SLOG
OLDNEW
« no previous file with comments | « components/sync/driver/glue/sync_backend_host_impl.h ('k') | components/sync/engine/fake_sync_engine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698