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

Issue 283623002: Add support for passing an arbitrary parameter to an IPC message handler. The motivation is for Web… (Closed)

Created:
6 years, 7 months ago by jam
Modified:
6 years, 7 months ago
Reviewers:
Tom Sepez
CC:
chromium-reviews, darin-cc_chromium.org, jdduke+watch_chromium.org, site-isolation-reviews_chromium.org
Visibility:
Public.

Description

Add support for passing an arbitrary parameter to an IPC message handler. The motivation is for WebContentsObserver to pass RenderFrameHost* to message handlers easily. As an example, an observer would look like this: bool FooWebContentsObserver::OnMessageReceived( const IPC::Message& message, RenderFrameHost* render_frame_host) { IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(FooWebContentsObserver, message, RenderFrameHost, render_frame_host) IPC_MESSAGE_HANDLER(FooHostMsg_Bar, OnBar) . . . void FooWebContentsObserver::OnBar(RenderFrameHost* render_frame_host, ... You can of course still have dispatchers without the extra parameter as before. This is generalizing the existing code that allows an IPC message handler to have a "const IPC::Message& message) first parameter to get access to the IPC. Sync IPCs don't support this yet. It's a lot more work because for them we conveniently reuse tuple's DispatchToMethod. This isn't urgent yet, since sync IPCs aren't dispatched on the UI thread for the most part because of NPAPI and Windows, so punting on this for now. BUG=304341 R=tsepez@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=270237

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Patch Set 6 : #

Patch Set 7 : #

Patch Set 8 : #

Patch Set 9 : #

Patch Set 10 : #

Patch Set 11 : #

Patch Set 12 : add tests #

Patch Set 13 : nits #

Patch Set 14 : sync #

Total comments: 8

Patch Set 15 : remove pepper changes #

Patch Set 16 : review comments #

Patch Set 17 : sync #

Unified diffs Side-by-side diffs Delta from patch set Stats (+347 lines, -346 lines) Patch
M chrome/browser/extensions/api/alarms/alarms_api_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +4 lines, -3 lines 0 comments Download
M chrome/browser/search/instant_service_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +4 lines, -3 lines 0 comments Download
M chrome/browser/spellchecker/spellcheck_message_filter_mac_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +4 lines, -3 lines 0 comments Download
M chrome/browser/spellchecker/spellcheck_message_filter_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +12 lines, -18 lines 0 comments Download
M chrome/renderer/spellchecker/spellcheck_provider_mac_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +20 lines, -36 lines 0 comments Download
M chrome/renderer/spellchecker/spellcheck_provider_test.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +2 lines, -2 lines 0 comments Download
M content/browser/browser_plugin/test_browser_plugin_guest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +3 lines, -3 lines 0 comments Download
M content/browser/loader/resource_dispatcher_host_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +1 line, -1 line 0 comments Download
M content/browser/loader/resource_dispatcher_host_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +2 lines, -2 lines 0 comments Download
M content/browser/renderer_host/input/touch_input_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +4 lines, -4 lines 0 comments Download
M content/browser/renderer_host/media/audio_renderer_host_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +9 lines, -11 lines 0 comments Download
M content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 6 chunks +23 lines, -25 lines 0 comments Download
M content/browser/renderer_host/p2p/socket_dispatcher_host.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +2 lines, -3 lines 0 comments Download
M content/browser/renderer_host/p2p/socket_dispatcher_host.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +2 lines, -4 lines 0 comments Download
M content/browser/renderer_host/render_message_filter.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/render_message_filter.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +2 lines, -2 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +6 lines, -10 lines 0 comments Download
M content/browser/shared_worker/shared_worker_host.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +5 lines, -5 lines 0 comments Download
M content/browser/shared_worker/shared_worker_service_impl_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +7 lines, -7 lines 0 comments Download
M content/browser/worker_host/worker_process_host.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +5 lines, -5 lines 0 comments Download
M content/child/resource_dispatcher_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +4 lines, -3 lines 0 comments Download
M content/common/resource_messages.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +2 lines, -1 line 0 comments Download
M content/common/view_messages.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +6 lines, -5 lines 0 comments Download
M content/renderer/browser_plugin/browser_plugin_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +11 lines, -12 lines 0 comments Download
M content/renderer/browser_plugin/browser_plugin_manager_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +1 line, -2 lines 0 comments Download
M content/renderer/browser_plugin/browser_plugin_manager_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +0 lines, -1 line 0 comments Download
M content/renderer/input/input_event_filter.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +5 lines, -5 lines 0 comments Download
M content/renderer/input/input_event_filter_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +12 lines, -19 lines 0 comments Download
M content/renderer/render_view_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 11 chunks +39 lines, -39 lines 0 comments Download
M content/renderer/render_widget_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 6 chunks +10 lines, -12 lines 0 comments Download
M ipc/ipc_message.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +6 lines, -20 lines 0 comments Download
M ipc/ipc_message_macros.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 4 chunks +49 lines, -76 lines 0 comments Download
M ipc/ipc_message_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +80 lines, -0 lines 0 comments Download
M ppapi/proxy/resource_message_test_sink.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +4 lines, -3 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
jam
6 years, 7 months ago (2014-05-13 18:08:28 UTC) #1
jam
btw all the pepper changes are because otherwise I get compiler errors because of unused ...
6 years, 7 months ago (2014-05-13 18:10:21 UTC) #2
Tom Sepez
Wondering if there's some clever way to make it so the additional parameter need not ...
6 years, 7 months ago (2014-05-13 18:36:26 UTC) #3
Tom Sepez
https://codereview.chromium.org/283623002/diff/180090/ipc/ipc_message_macros.h File ipc/ipc_message_macros.h (right): https://codereview.chromium.org/283623002/diff/180090/ipc/ipc_message_macros.h#newcode909 ipc/ipc_message_macros.h:909: { \ nit: just noticed this. Could this be: ...
6 years, 7 months ago (2014-05-13 18:44:11 UTC) #4
Tom Sepez
missed one. https://codereview.chromium.org/283623002/diff/180090/ipc/ipc_message_macros.h File ipc/ipc_message_macros.h (right): https://codereview.chromium.org/283623002/diff/180090/ipc/ipc_message_macros.h#newcode901 ipc/ipc_message_macros.h:901: typedef class_name _IpcMessageHandlerClass; \ nit: maybe #define ...
6 years, 7 months ago (2014-05-13 18:46:36 UTC) #5
Tom Sepez
https://codereview.chromium.org/283623002/diff/180090/chrome/renderer/pepper/pepper_extensions_common_host.cc File chrome/renderer/pepper/pepper_extensions_common_host.cc (right): https://codereview.chromium.org/283623002/diff/180090/chrome/renderer/pepper/pepper_extensions_common_host.cc#newcode81 chrome/renderer/pepper/pepper_extensions_common_host.cc:81: PPAPI_BEGIN_MESSAGE_MAP(PepperExtensionsCommonHost, msg) Could we split this PPAPI_ cleanup into ...
6 years, 7 months ago (2014-05-13 18:48:39 UTC) #6
jam
On 2014/05/13 18:36:26, Tom Sepez wrote: > Wondering if there's some clever way to make ...
6 years, 7 months ago (2014-05-13 20:31:39 UTC) #7
Tom Sepez
6 years, 7 months ago (2014-05-13 20:44:03 UTC) #8
LGTM.

Powered by Google App Engine
This is Rietveld 408576698