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

Side by Side Diff: chrome/browser/sync/profile_sync_service.cc

Issue 11496004: Lazy initialization for PushMessagingEventRouter (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: nit fixed Created 8 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 (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"
29 #include "chrome/browser/extensions/extension_system.h"
30 #include "chrome/browser/net/chrome_cookie_notification_details.h" 28 #include "chrome/browser/net/chrome_cookie_notification_details.h"
31 #include "chrome/browser/prefs/pref_service.h" 29 #include "chrome/browser/prefs/pref_service.h"
32 #include "chrome/browser/profiles/profile.h" 30 #include "chrome/browser/profiles/profile.h"
33 #include "chrome/browser/signin/signin_manager.h" 31 #include "chrome/browser/signin/signin_manager.h"
34 #include "chrome/browser/signin/signin_manager_factory.h" 32 #include "chrome/browser/signin/signin_manager_factory.h"
35 #include "chrome/browser/signin/token_service.h" 33 #include "chrome/browser/signin/token_service.h"
36 #include "chrome/browser/signin/token_service_factory.h" 34 #include "chrome/browser/signin/token_service_factory.h"
37 #include "chrome/browser/sync/backend_migrator.h" 35 #include "chrome/browser/sync/backend_migrator.h"
38 #include "chrome/browser/sync/glue/change_processor.h" 36 #include "chrome/browser/sync/glue/change_processor.h"
39 #include "chrome/browser/sync/glue/chrome_encryptor.h" 37 #include "chrome/browser/sync/glue/chrome_encryptor.h"
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 syncer::ObjectIdSet notify_ids; 521 syncer::ObjectIdSet notify_ids;
524 notify_ids.insert(id); 522 notify_ids.insert(id);
525 523
526 const syncer::ObjectIdInvalidationMap& invalidation_map = 524 const syncer::ObjectIdInvalidationMap& invalidation_map =
527 ObjectIdSetToInvalidationMap(notify_ids, payload); 525 ObjectIdSetToInvalidationMap(notify_ids, payload);
528 OnIncomingInvalidation(invalidation_map, syncer::REMOTE_INVALIDATION); 526 OnIncomingInvalidation(invalidation_map, syncer::REMOTE_INVALIDATION);
529 } 527 }
530 528
531 void ProfileSyncService::Shutdown() { 529 void ProfileSyncService::Shutdown() {
532 DCHECK(invalidator_registrar_.get()); 530 DCHECK(invalidator_registrar_.get());
533 // TODO(akalin): Remove this once http://crbug.com/153827 is fixed.
534 ExtensionService* const extension_service =
535 extensions::ExtensionSystem::Get(profile_)->extension_service();
536 // |extension_service| may be NULL if it was never initialized
537 // (e.g., extension sync wasn't enabled in tests).
538 if (extension_service)
539 extension_service->OnProfileSyncServiceShutdown();
540
541 // Reset |invalidator_registrar_| first so that ShutdownImpl cannot 531 // Reset |invalidator_registrar_| first so that ShutdownImpl cannot
542 // use it. 532 // use it.
543 invalidator_registrar_.reset(); 533 invalidator_registrar_.reset();
544 534
545 ShutdownImpl(false); 535 ShutdownImpl(false);
546 } 536 }
547 537
548 void ProfileSyncService::ShutdownImpl(bool sync_disabled) { 538 void ProfileSyncService::ShutdownImpl(bool sync_disabled) {
549 // First, we spin down the backend and wait for it to stop syncing completely 539 // First, we spin down the backend and wait for it to stop syncing completely
550 // before we Stop the data type manager. This is to avoid a late sync cycle 540 // before we Stop the data type manager. This is to avoid a late sync cycle
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1919 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru. 1909 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru.
1920 ProfileSyncService* old_this = this; 1910 ProfileSyncService* old_this = this;
1921 this->~ProfileSyncService(); 1911 this->~ProfileSyncService();
1922 new(old_this) ProfileSyncService( 1912 new(old_this) ProfileSyncService(
1923 new ProfileSyncComponentsFactoryImpl(profile, 1913 new ProfileSyncComponentsFactoryImpl(profile,
1924 CommandLine::ForCurrentProcess()), 1914 CommandLine::ForCurrentProcess()),
1925 profile, 1915 profile,
1926 signin, 1916 signin,
1927 behavior); 1917 behavior);
1928 } 1918 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_dependency_manager.cc ('k') | chrome/chrome_browser_extensions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698