Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "chrome/browser/sync/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 19 #include "base/message_loop.h" | 19 #include "base/message_loop.h" |
| 20 #include "base/metrics/histogram.h" | 20 #include "base/metrics/histogram.h" |
| 21 #include "base/string16.h" | 21 #include "base/string16.h" |
| 22 #include "base/stringprintf.h" | 22 #include "base/stringprintf.h" |
| 23 #include "base/threading/thread_restrictions.h" | 23 #include "base/threading/thread_restrictions.h" |
| 24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
| 25 #include "chrome/browser/about_flags.h" | 25 #include "chrome/browser/about_flags.h" |
| 26 #include "chrome/browser/browser_process.h" | 26 #include "chrome/browser/browser_process.h" |
| 27 #include "chrome/browser/defaults.h" | 27 #include "chrome/browser/defaults.h" |
| 28 #include "chrome/browser/extensions/extension_service.h" | 28 #include "chrome/browser/extensions/api/push_messaging/push_messaging_api.h" |
|
akalin
2012/12/10 20:37:12
remove this too
Joe Thomas
2012/12/10 22:43:58
Done.
| |
| 29 #include "chrome/browser/extensions/extension_system.h" | |
| 30 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 29 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
| 31 #include "chrome/browser/prefs/pref_service.h" | 30 #include "chrome/browser/prefs/pref_service.h" |
| 32 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
| 33 #include "chrome/browser/signin/signin_manager.h" | 32 #include "chrome/browser/signin/signin_manager.h" |
| 34 #include "chrome/browser/signin/signin_manager_factory.h" | 33 #include "chrome/browser/signin/signin_manager_factory.h" |
| 35 #include "chrome/browser/signin/token_service.h" | 34 #include "chrome/browser/signin/token_service.h" |
| 36 #include "chrome/browser/signin/token_service_factory.h" | 35 #include "chrome/browser/signin/token_service_factory.h" |
| 37 #include "chrome/browser/sync/backend_migrator.h" | 36 #include "chrome/browser/sync/backend_migrator.h" |
| 38 #include "chrome/browser/sync/glue/change_processor.h" | 37 #include "chrome/browser/sync/glue/change_processor.h" |
| 39 #include "chrome/browser/sync/glue/chrome_encryptor.h" | 38 #include "chrome/browser/sync/glue/chrome_encryptor.h" |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 510 syncer::ObjectIdSet notify_ids; | 509 syncer::ObjectIdSet notify_ids; |
| 511 notify_ids.insert(id); | 510 notify_ids.insert(id); |
| 512 | 511 |
| 513 const syncer::ObjectIdInvalidationMap& invalidation_map = | 512 const syncer::ObjectIdInvalidationMap& invalidation_map = |
| 514 ObjectIdSetToInvalidationMap(notify_ids, payload); | 513 ObjectIdSetToInvalidationMap(notify_ids, payload); |
| 515 OnIncomingInvalidation(invalidation_map, syncer::REMOTE_INVALIDATION); | 514 OnIncomingInvalidation(invalidation_map, syncer::REMOTE_INVALIDATION); |
| 516 } | 515 } |
| 517 | 516 |
| 518 void ProfileSyncService::Shutdown() { | 517 void ProfileSyncService::Shutdown() { |
| 519 DCHECK(invalidator_registrar_.get()); | 518 DCHECK(invalidator_registrar_.get()); |
| 520 // TODO(akalin): Remove this once http://crbug.com/153827 is fixed. | 519 // TODO(akalin): Remove this once http://crbug.com/153827 is fixed. |
|
akalin
2012/12/10 20:37:12
remove this too
Joe Thomas
2012/12/10 22:43:58
Done.
| |
| 521 ExtensionService* const extension_service = | 520 extensions::PushMessagingAPI* const push_messaging_api = |
| 522 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 521 extensions::PushMessagingAPI::Get(profile_); |
| 523 // |extension_service| may be NULL if it was never initialized | 522 // |push_messaging_api| may be NULL if the service was never initialized. |
| 524 // (e.g., extension sync wasn't enabled in tests). | 523 if (push_messaging_api) |
| 525 if (extension_service) | 524 push_messaging_api->OnProfileSyncServiceShutdown(); |
| 526 extension_service->OnProfileSyncServiceShutdown(); | |
| 527 | 525 |
| 528 // Reset |invalidator_registrar_| first so that ShutdownImpl cannot | 526 // Reset |invalidator_registrar_| first so that ShutdownImpl cannot |
| 529 // use it. | 527 // use it. |
| 530 invalidator_registrar_.reset(); | 528 invalidator_registrar_.reset(); |
| 531 | 529 |
| 532 ShutdownImpl(false); | 530 ShutdownImpl(false); |
| 533 } | 531 } |
| 534 | 532 |
| 535 void ProfileSyncService::ShutdownImpl(bool sync_disabled) { | 533 void ProfileSyncService::ShutdownImpl(bool sync_disabled) { |
| 536 // First, we spin down the backend and wait for it to stop syncing completely | 534 // First, we spin down the backend and wait for it to stop syncing completely |
| (...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1906 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru. | 1904 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru. |
| 1907 ProfileSyncService* old_this = this; | 1905 ProfileSyncService* old_this = this; |
| 1908 this->~ProfileSyncService(); | 1906 this->~ProfileSyncService(); |
| 1909 new(old_this) ProfileSyncService( | 1907 new(old_this) ProfileSyncService( |
| 1910 new ProfileSyncComponentsFactoryImpl(profile, | 1908 new ProfileSyncComponentsFactoryImpl(profile, |
| 1911 CommandLine::ForCurrentProcess()), | 1909 CommandLine::ForCurrentProcess()), |
| 1912 profile, | 1910 profile, |
| 1913 signin, | 1911 signin, |
| 1914 behavior); | 1912 behavior); |
| 1915 } | 1913 } |
| OLD | NEW |