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

Review URL: https://codereview.chromium.org/283623002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270237 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: 5636d90f630655abf66427e30d15f615dc939797
3 files changed
tree: 5697748e0af565750e16656e2bb54569eb165e92
  1. base/
  2. build/
  3. components/
  4. dbus/
  5. device/
  6. ipc/
  7. mojo/
  8. testing/
  9. third_party/
  10. ui/