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

Side by Side Diff: chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc

Issue 2749823002: Restore KeyedServiceFactory diagnostics for context use-after-destroy. (Closed)
Patch Set: Refactor SiteEngagementService tests. Created 3 years, 9 months 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 "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_mana ger.h" 5 #include "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_mana ger.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 if (router) { 107 if (router) {
108 router->RegisterObserver( 108 router->RegisterObserver(
109 this, api::signed_in_devices::OnDeviceInfoChange::kEventName); 109 this, api::signed_in_devices::OnDeviceInfoChange::kEventName);
110 } 110 }
111 111
112 // Register for unload event so we could clear all our listeners when 112 // Register for unload event so we could clear all our listeners when
113 // extensions have unloaded. 113 // extensions have unloaded.
114 extension_registry_observer_.Add(ExtensionRegistry::Get(profile_)); 114 extension_registry_observer_.Add(ExtensionRegistry::Get(profile_));
115 } 115 }
116 116
117 SignedInDevicesManager::~SignedInDevicesManager() { 117 SignedInDevicesManager::~SignedInDevicesManager() = default;
118
119 void SignedInDevicesManager::Shutdown() {
118 if (profile_) { 120 if (profile_) {
119 EventRouter* router = EventRouter::Get(profile_); 121 EventRouter* router = EventRouter::Get(profile_);
120 if (router) 122 if (router)
121 router->UnregisterObserver(this); 123 router->UnregisterObserver(this);
122 } 124 }
123 } 125 }
124 126
125 void SignedInDevicesManager::OnListenerAdded( 127 void SignedInDevicesManager::OnListenerAdded(
126 const EventListenerInfo& details) { 128 const EventListenerInfo& details) {
127 for (const std::unique_ptr<SignedInDevicesChangeObserver>& observer : 129 for (const std::unique_ptr<SignedInDevicesChangeObserver>& observer :
(...skipping 26 matching lines...) Expand all
154 } 156 }
155 157
156 void SignedInDevicesManager::OnExtensionUnloaded( 158 void SignedInDevicesManager::OnExtensionUnloaded(
157 content::BrowserContext* browser_context, 159 content::BrowserContext* browser_context,
158 const Extension* extension, 160 const Extension* extension,
159 UnloadedExtensionInfo::Reason reason) { 161 UnloadedExtensionInfo::Reason reason) {
160 RemoveChangeObserverForExtension(extension->id()); 162 RemoveChangeObserverForExtension(extension->id());
161 } 163 }
162 164
163 } // namespace extensions 165 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698