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

Unified Diff: extensions/browser/extension_function_dispatcher.h

Issue 1880933002: Begin to enable extension APIs in Extension Service Worker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
Index: extensions/browser/extension_function_dispatcher.h
diff --git a/extensions/browser/extension_function_dispatcher.h b/extensions/browser/extension_function_dispatcher.h
index be8132e970e5893ba1a3de9737ab30968a705b0a..50754f9829cd22980b2bd18d75ba1352af082c70 100644
--- a/extensions/browser/extension_function_dispatcher.h
+++ b/extensions/browser/extension_function_dispatcher.h
@@ -96,7 +96,8 @@ class ExtensionFunctionDispatcher
// The response is sent to the corresponding render view in an
// ExtensionMsg_Response message.
void Dispatch(const ExtensionHostMsg_Request_Params& params,
- content::RenderFrameHost* render_frame_host);
+ content::RenderFrameHost* render_frame_host,
+ int render_process_id);
// Called when an ExtensionFunction is done executing, after it has sent
// a response (if any) to the extension.
@@ -122,6 +123,10 @@ class ExtensionFunctionDispatcher
// destroyed automatically when it goes away.
class UIThreadResponseCallbackWrapper;
+ // Same as UIThreadResponseCallbackWrapper above, but applies to an extension
+ // function from an extension Service Worker.
+ class UIThreadWorkerResponseCallbackWrapper;
+
// Helper to check whether an ExtensionFunction has the required permissions.
// This should be called after the function is fully initialized.
// If the check fails, |callback| is run with an access-denied error and false
@@ -152,6 +157,7 @@ class ExtensionFunctionDispatcher
void DispatchWithCallbackInternal(
const ExtensionHostMsg_Request_Params& params,
content::RenderFrameHost* render_frame_host,
+ int render_process_id,
const ExtensionFunction::ResponseCallback& callback);
content::BrowserContext* browser_context_;
@@ -164,6 +170,15 @@ class ExtensionFunctionDispatcher
typedef std::map<content::RenderFrameHost*, UIThreadResponseCallbackWrapper*>
UIThreadResponseCallbackWrapperMap;
UIThreadResponseCallbackWrapperMap ui_thread_response_callback_wrappers_;
+
+ typedef std::pair<int, int> UIThreadWorkerResponseCallbackWrapperMapKey;
Devlin 2016/04/13 19:46:31 comment indicating what the two ints that make up
Devlin 2016/04/13 19:46:31 usings in new code
lazyboy 2016/04/14 02:07:52 Done.
lazyboy 2016/04/14 02:07:52 Done.
+ typedef std::map<UIThreadWorkerResponseCallbackWrapperMapKey,
+ std::unique_ptr<UIThreadWorkerResponseCallbackWrapper>>
+ UIThreadWorkerResponseCallbackWrapperMap;
+ // TODO(lazyboy): The map entries are cleared upon RenderProcessHost shutown,
+ // we should really be clearing it on service worker shutdown.
+ UIThreadWorkerResponseCallbackWrapperMap
+ ui_thread_response_callback_wrappers_for_worker_;
};
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698