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

Unified Diff: extensions/renderer/module_system.h

Issue 1074273002: Move the event attach/detach logic on unload from event.js to (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: being process of relanding - more test assertions Created 5 years, 8 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
« no previous file with comments | « extensions/renderer/event_unittest.cc ('k') | extensions/renderer/module_system.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/module_system.h
diff --git a/extensions/renderer/module_system.h b/extensions/renderer/module_system.h
index 8b4a35ca45a1be49567df776c7f00924c16802c8..ad89524e54ec83c6bec4a23d904929201f64c32e 100644
--- a/extensions/renderer/module_system.h
+++ b/extensions/renderer/module_system.h
@@ -142,6 +142,7 @@ class ModuleSystem : public ObjectBackedNativeHandler,
}
protected:
+ friend class ModuleSystemTestEnvironment;
friend class ScriptContext;
void Invalidate() override;
@@ -205,6 +206,10 @@ class ModuleSystem : public ObjectBackedNativeHandler,
const std::string& id,
const std::vector<std::string>& dependencies) override;
+ // Marks any existing NativeHandler named |name| as clobbered.
+ // See |clobbered_native_handlers_|.
+ void ClobberExistingNativeHandler(const std::string& name);
+
ScriptContext* context_;
// A map from module names to the JS source for that module. GetSource()
@@ -222,8 +227,16 @@ class ModuleSystem : public ObjectBackedNativeHandler,
// tests.
scoped_ptr<ExceptionHandler> exception_handler_;
+ // A set of native handlers that should actually be require()d as non-native
+ // handlers. This is used for tests to mock out native handlers in JS.
std::set<std::string> overridden_native_handlers_;
+ // A list of NativeHandlers that have been clobbered, either due to
+ // registering a NativeHandler when one was already registered with the same
+ // name, or due to OverrideNativeHandlerForTest. This is needed so that they
+ // can be later Invalidated. It should only happen in tests.
+ std::vector<linked_ptr<NativeHandler>> clobbered_native_handlers_;
+
base::WeakPtrFactory<ModuleSystem> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ModuleSystem);
« no previous file with comments | « extensions/renderer/event_unittest.cc ('k') | extensions/renderer/module_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698