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

Side by Side Diff: extensions/browser/api/web_request/web_request_api.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 (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 "extensions/browser/api/web_request/web_request_api.h" 5 #include "extensions/browser/api/web_request/web_request_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 std::string event_name = kWebRequestEvents[i]; 388 std::string event_name = kWebRequestEvents[i];
389 event_router->RegisterObserver(this, event_name); 389 event_router->RegisterObserver(this, event_name);
390 390
391 // Also observe the corresponding webview event. 391 // Also observe the corresponding webview event.
392 event_name.replace( 392 event_name.replace(
393 0, sizeof(kWebRequestEventPrefix) - 1, webview::kWebViewEventPrefix); 393 0, sizeof(kWebRequestEventPrefix) - 1, webview::kWebViewEventPrefix);
394 event_router->RegisterObserver(this, event_name); 394 event_router->RegisterObserver(this, event_name);
395 } 395 }
396 } 396 }
397 397
398 WebRequestAPI::~WebRequestAPI() { 398 WebRequestAPI::~WebRequestAPI() = default;
399
400 void WebRequestAPI::Shutdown() {
399 EventRouter::Get(browser_context_)->UnregisterObserver(this); 401 EventRouter::Get(browser_context_)->UnregisterObserver(this);
400 } 402 }
401 403
402 static base::LazyInstance< 404 static base::LazyInstance<
403 BrowserContextKeyedAPIFactory<WebRequestAPI>>::DestructorAtExit g_factory = 405 BrowserContextKeyedAPIFactory<WebRequestAPI>>::DestructorAtExit g_factory =
404 LAZY_INSTANCE_INITIALIZER; 406 LAZY_INSTANCE_INITIALIZER;
405 407
406 // static 408 // static
407 BrowserContextKeyedAPIFactory<WebRequestAPI>* 409 BrowserContextKeyedAPIFactory<WebRequestAPI>*
408 WebRequestAPI::GetFactoryInstance() { 410 WebRequestAPI::GetFactoryInstance() {
(...skipping 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after
2432 // Since EventListeners are segmented by browser_context, check that 2434 // Since EventListeners are segmented by browser_context, check that
2433 // last, as it is exceedingly unlikely to be different. 2435 // last, as it is exceedingly unlikely to be different.
2434 return extension_id == that.extension_id && 2436 return extension_id == that.extension_id &&
2435 sub_event_name == that.sub_event_name && 2437 sub_event_name == that.sub_event_name &&
2436 web_view_instance_id == that.web_view_instance_id && 2438 web_view_instance_id == that.web_view_instance_id &&
2437 embedder_process_id == that.embedder_process_id && 2439 embedder_process_id == that.embedder_process_id &&
2438 browser_context == that.browser_context; 2440 browser_context == that.browser_context;
2439 } 2441 }
2440 2442
2441 } // namespace extensions 2443 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/web_request/web_request_api.h ('k') | extensions/browser/process_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698