summaryrefslogtreecommitdiffstats
path: root/content/child/resource_dispatcher_unittest.cc
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-13 23:19:10 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-13 23:19:10 +0000
commit5636d90f630655abf66427e30d15f615dc939797 (patch)
tree434691134b27d5f98aaff57635b05bcdba98e1b7 /content/child/resource_dispatcher_unittest.cc
parent07243f95c726fb67abefa8a19fb9c46e2d63d8f8 (diff)
downloadchromium_src-5636d90f630655abf66427e30d15f615dc939797.zip
chromium_src-5636d90f630655abf66427e30d15f615dc939797.tar.gz
chromium_src-5636d90f630655abf66427e30d15f615dc939797.tar.bz2
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
Diffstat (limited to 'content/child/resource_dispatcher_unittest.cc')
-rw-r--r--content/child/resource_dispatcher_unittest.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/content/child/resource_dispatcher_unittest.cc b/content/child/resource_dispatcher_unittest.cc
index b12db6b..9dfb43e 100644
--- a/content/child/resource_dispatcher_unittest.cc
+++ b/content/child/resource_dispatcher_unittest.cc
@@ -112,10 +112,11 @@ class ResourceDispatcherTest : public testing::Test, public IPC::Sender {
// returning the hardcoded file contents.
void ProcessMessages() {
while (!message_queue_.empty()) {
- int request_id;
- ResourceHostMsg_Request request;
+ ResourceHostMsg_RequestResource::Param params;
ASSERT_TRUE(ResourceHostMsg_RequestResource::Read(
- &message_queue_[0], &request_id, &request));
+ &message_queue_[0], &params));
+ int request_id = params.b;
+ ResourceHostMsg_Request request = params.c;
// check values
EXPECT_EQ(test_page_url, request.url.spec());