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

Unified Diff: extensions/renderer/dispatcher.cc

Issue 2162983002: [Extensions] Ensure ordering of extension [un]loaded, activated messages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ready for review Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: extensions/renderer/dispatcher.cc
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc
index 13fadad7df52f354a67f706cdad60bcd96cb0787..5af58837e85a496a82cf6dd4a2172358564945e6 100644
--- a/extensions/renderer/dispatcher.cc
+++ b/extensions/renderer/dispatcher.cc
@@ -997,6 +997,7 @@ void Dispatcher::OnActivateExtension(const std::string& extension_id) {
const Extension* extension =
RendererExtensionRegistry::Get()->GetByID(extension_id);
if (!extension) {
+ NOTREACHED();
// Extension was activated but was never loaded. This probably means that
// the renderer failed to load it (or the browser failed to tell us when it
// did). Failures shouldn't happen, but instead of crashing there (which
@@ -1092,6 +1093,9 @@ void Dispatcher::OnLoaded(
// Dispatcher is attached to a RenderThread. Presumably there is a
// mismatch there. In theory one would think it's possible for the
// browser to figure this out itself - but again, cost/benefit.
+ // TODO(devlin): This may be fixed by crbug.com/528026. Monitor, and
+ // consider making this a release CHECK.
+ DCHECK(!extension_registry->Contains(extension->id()));
lazyboy 2016/07/22 00:29:31 Change these to: if (!extension_registry->Insert(e
Devlin 2016/07/26 03:45:09 Done.
if (!extension_registry->Contains(extension->id()))
extension_registry->Insert(extension);
}
@@ -1160,8 +1164,12 @@ void Dispatcher::OnTransferBlobs(const std::vector<std::string>& blob_uuids) {
void Dispatcher::OnUnloaded(const std::string& id) {
// See comment in OnLoaded for why it would be nice, but perhaps incorrect,
// to CHECK here rather than guarding.
- if (!RendererExtensionRegistry::Get()->Remove(id))
+ // TODO(devlin): This may be fixed by crbug.com/528026. Monitor, and
+ // consider making this a release CHECK.
+ if (!RendererExtensionRegistry::Get()->Remove(id)) {
+ NOTREACHED();
return;
+ }
active_extension_ids_.erase(id);

Powered by Google App Engine
This is Rietveld 408576698