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

Side by Side Diff: extensions/shell/browser/shell_content_browser_client.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
« no previous file with comments | « extensions/browser/process_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/shell/browser/shell_content_browser_client.h" 5 #include "extensions/shell/browser/shell_content_browser_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "components/guest_view/browser/guest_view_message_filter.h" 14 #include "components/guest_view/browser/guest_view_message_filter.h"
15 #include "content/public/browser/browser_main_runner.h"
15 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/render_process_host.h" 17 #include "content/public/browser/render_process_host.h"
17 #include "content/public/browser/site_instance.h" 18 #include "content/public/browser/site_instance.h"
18 #include "content/public/browser/storage_partition.h" 19 #include "content/public/browser/storage_partition.h"
19 #include "content/public/common/content_descriptors.h" 20 #include "content/public/common/content_descriptors.h"
20 #include "content/public/common/content_switches.h" 21 #include "content/public/common/content_switches.h"
21 #include "content/public/common/url_constants.h" 22 #include "content/public/common/url_constants.h"
22 #include "content/shell/browser/shell_browser_context.h" 23 #include "content/shell/browser/shell_browser_context.h"
23 #include "content/shell/browser/shell_devtools_manager_delegate.h" 24 #include "content/shell/browser/shell_devtools_manager_delegate.h"
24 #include "extensions/browser/extension_message_filter.h" 25 #include "extensions/browser/extension_message_filter.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 FROM_HERE, 173 FROM_HERE,
173 base::Bind(&InfoMap::RegisterExtensionProcess, 174 base::Bind(&InfoMap::RegisterExtensionProcess,
174 browser_main_parts_->extension_system()->info_map(), 175 browser_main_parts_->extension_system()->info_map(),
175 extension->id(), 176 extension->id(),
176 site_instance->GetProcess()->GetID(), 177 site_instance->GetProcess()->GetID(),
177 site_instance->GetId())); 178 site_instance->GetId()));
178 } 179 }
179 180
180 void ShellContentBrowserClient::SiteInstanceDeleting( 181 void ShellContentBrowserClient::SiteInstanceDeleting(
181 content::SiteInstance* site_instance) { 182 content::SiteInstance* site_instance) {
183 // Don't do anything if we're shutting down.
184 if (content::BrowserMainRunner::ExitedMainMessageLoop())
185 return;
186
182 // If this isn't an extension renderer there's nothing to do. 187 // If this isn't an extension renderer there's nothing to do.
183 const Extension* extension = GetExtension(site_instance); 188 const Extension* extension = GetExtension(site_instance);
184 if (!extension) 189 if (!extension)
185 return; 190 return;
186 191
187 ProcessMap::Get(browser_main_parts_->browser_context()) 192 ProcessMap::Get(browser_main_parts_->browser_context())
188 ->Remove(extension->id(), 193 ->Remove(extension->id(),
189 site_instance->GetProcess()->GetID(), 194 site_instance->GetProcess()->GetID(),
190 site_instance->GetId()); 195 site_instance->GetId());
191 196
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 289
285 const Extension* ShellContentBrowserClient::GetExtension( 290 const Extension* ShellContentBrowserClient::GetExtension(
286 content::SiteInstance* site_instance) { 291 content::SiteInstance* site_instance) {
287 ExtensionRegistry* registry = 292 ExtensionRegistry* registry =
288 ExtensionRegistry::Get(site_instance->GetBrowserContext()); 293 ExtensionRegistry::Get(site_instance->GetBrowserContext());
289 return registry->enabled_extensions().GetExtensionOrAppByURL( 294 return registry->enabled_extensions().GetExtensionOrAppByURL(
290 site_instance->GetSiteURL()); 295 site_instance->GetSiteURL());
291 } 296 }
292 297
293 } // namespace extensions 298 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/process_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698