diff options
5 files changed, 90 insertions, 114 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc index cf451f2..cfe44e6 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/content/browser/browser_plugin/browser_plugin_guest.cc @@ -151,8 +151,9 @@ void BrowserPluginGuest::Initialize( int guest_routing_id = static_cast<WebContentsImpl*>(web_contents())->CreateSwappedOutRenderView( embedder_web_contents()->GetSiteInstance()); - embedder_web_contents_->Send(new BrowserPluginMsg_GuestContentWindowReady( - embedder_web_contents_->GetRoutingID(), instance_id_, guest_routing_id)); + SendMessageToEmbedder( + new BrowserPluginMsg_GuestContentWindowReady(instance_id_, + guest_routing_id)); if (!params.src.empty()) OnNavigateGuest(instance_id_, params.src); @@ -245,9 +246,7 @@ void BrowserPluginGuest::RendererUnresponsive(WebContents* source) { int process_id = web_contents()->GetRenderProcessHost()->GetID(); SendMessageToEmbedder( - new BrowserPluginMsg_GuestUnresponsive(MSG_ROUTING_NONE, - instance_id(), - process_id)); + new BrowserPluginMsg_GuestUnresponsive(instance_id(), process_id)); RecordAction(UserMetricsAction("BrowserPlugin.Guest.Hung")); } @@ -255,9 +254,7 @@ void BrowserPluginGuest::RendererResponsive(WebContents* source) { int process_id = web_contents()->GetRenderProcessHost()->GetID(); SendMessageToEmbedder( - new BrowserPluginMsg_GuestResponsive(MSG_ROUTING_NONE, - instance_id(), - process_id)); + new BrowserPluginMsg_GuestResponsive(instance_id(), process_id)); RecordAction(UserMetricsAction("BrowserPlugin.Guest.Responsive")); } @@ -332,8 +329,7 @@ void BrowserPluginGuest::DidStartProvisionalLoadForFrame( RenderViewHost* render_view_host) { // Inform the embedder of the loadStart. SendMessageToEmbedder( - new BrowserPluginMsg_LoadStart(MSG_ROUTING_NONE, - instance_id(), + new BrowserPluginMsg_LoadStart(instance_id(), validated_url, is_main_frame)); } @@ -350,8 +346,7 @@ void BrowserPluginGuest::DidFailProvisionalLoad( RemoveChars(net::ErrorToString(error_code), "net::", &error_type); // Inform the embedder of the loadAbort. SendMessageToEmbedder( - new BrowserPluginMsg_LoadAbort(MSG_ROUTING_NONE, - instance_id(), + new BrowserPluginMsg_LoadAbort(instance_id(), validated_url, is_main_frame, error_type)); @@ -369,8 +364,7 @@ void BrowserPluginGuest::LoadRedirect( const GURL& new_url, bool is_top_level) { SendMessageToEmbedder( - new BrowserPluginMsg_LoadRedirect(MSG_ROUTING_NONE, - instance_id(), + new BrowserPluginMsg_LoadRedirect(instance_id(), old_url, new_url, is_top_level)); @@ -393,9 +387,7 @@ void BrowserPluginGuest::DidCommitProvisionalLoadForFrame( params.entry_count = web_contents()->GetController().GetEntryCount(); SendMessageToEmbedder( - new BrowserPluginMsg_LoadCommit(MSG_ROUTING_NONE, - instance_id(), - params)); + new BrowserPluginMsg_LoadCommit(instance_id(), params)); RecordAction(UserMetricsAction("BrowserPlugin.Guest.DidNavigate")); } @@ -407,8 +399,7 @@ void BrowserPluginGuest::DidStopLoading(RenderViewHost* render_view_host) { "});"; render_view_host->ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(script)); - SendMessageToEmbedder(new BrowserPluginMsg_LoadStop(MSG_ROUTING_NONE, - instance_id())); + SendMessageToEmbedder(new BrowserPluginMsg_LoadStop(instance_id())); } void BrowserPluginGuest::RenderViewReady() { @@ -427,10 +418,8 @@ void BrowserPluginGuest::RenderViewReady() { void BrowserPluginGuest::RenderViewGone(base::TerminationStatus status) { int process_id = web_contents()->GetRenderProcessHost()->GetID(); - SendMessageToEmbedder(new BrowserPluginMsg_GuestGone(MSG_ROUTING_NONE, - instance_id(), - process_id, - status)); + SendMessageToEmbedder( + new BrowserPluginMsg_GuestGone(instance_id(), process_id, status)); switch (status) { case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: RecordAction(UserMetricsAction("BrowserPlugin.Guest.Killed")); @@ -715,15 +704,11 @@ void BrowserPluginGuest::OnHandleInputEventAck( void BrowserPluginGuest::OnHasTouchEventHandlers(bool accept) { SendMessageToEmbedder( - new BrowserPluginMsg_ShouldAcceptTouchEvents(MSG_ROUTING_NONE, - instance_id(), - accept)); + new BrowserPluginMsg_ShouldAcceptTouchEvents(instance_id(), accept)); } void BrowserPluginGuest::OnSetCursor(const WebCursor& cursor) { - SendMessageToEmbedder(new BrowserPluginMsg_SetCursor(MSG_ROUTING_NONE, - instance_id(), - cursor)); + SendMessageToEmbedder(new BrowserPluginMsg_SetCursor(instance_id(), cursor)); } #if defined(OS_MACOSX) @@ -754,9 +739,7 @@ void BrowserPluginGuest::OnShowWidget(int route_id, void BrowserPluginGuest::OnTakeFocus(bool reverse) { SendMessageToEmbedder( - new BrowserPluginMsg_AdvanceFocus(MSG_ROUTING_NONE, - instance_id(), - reverse)); + new BrowserPluginMsg_AdvanceFocus(instance_id(), reverse)); } void BrowserPluginGuest::OnUpdateDragCursor( @@ -778,10 +761,7 @@ void BrowserPluginGuest::OnUpdateFrameName(int frame_id, return; name_ = name; - SendMessageToEmbedder(new BrowserPluginMsg_UpdatedName( - MSG_ROUTING_NONE, - instance_id_, - name)); + SendMessageToEmbedder(new BrowserPluginMsg_UpdatedName(instance_id_, name)); } void BrowserPluginGuest::OnUpdateRect( @@ -797,11 +777,9 @@ void BrowserPluginGuest::OnUpdateRect( // HW accelerated case, acknowledge resize only if (!params.needs_ack || !damage_buffer_) { relay_params.damage_buffer_sequence_id = 0; - SendMessageToEmbedder(new BrowserPluginMsg_UpdateRect( - MSG_ROUTING_NONE, - instance_id(), - relay_params)); - return; + SendMessageToEmbedder( + new BrowserPluginMsg_UpdateRect(instance_id(), relay_params)); + return; } RenderViewHost* render_view_host = web_contents()->GetRenderViewHost(); @@ -839,9 +817,8 @@ void BrowserPluginGuest::OnUpdateRect( relay_params.scroll_rect = params.scroll_rect; relay_params.copy_rects = params.copy_rects; - SendMessageToEmbedder(new BrowserPluginMsg_UpdateRect(MSG_ROUTING_NONE, - instance_id(), - relay_params)); + SendMessageToEmbedder( + new BrowserPluginMsg_UpdateRect(instance_id(), relay_params)); } } // namespace content diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h index 4eba76c9..9fe993d 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.h +++ b/content/browser/browser_plugin/browser_plugin_guest.h @@ -169,8 +169,6 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, // messages for testing. virtual void SendMessageToEmbedder(IPC::Message* msg); - // Returns the embedder's routing ID. - int embedder_routing_id() const; // Returns the identifier that uniquely identifies a browser plugin guest // within an embedder. int instance_id() const { return instance_id_; } @@ -190,6 +188,9 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, WebContentsImpl* web_contents, const BrowserPluginHostMsg_CreateGuest_Params& params); + // Returns the embedder's routing ID. + int embedder_routing_id() const; + // Schedules this BrowserPluginGuest for deletion if it hasn't already been // scheduled. void Destroy(); diff --git a/content/browser/renderer_host/render_widget_host_view_guest.cc b/content/browser/renderer_host/render_widget_host_view_guest.cc index 99b1616..6fa85d9 100644 --- a/content/browser/renderer_host/render_widget_host_view_guest.cc +++ b/content/browser/renderer_host/render_widget_host_view_guest.cc @@ -110,7 +110,6 @@ void RenderWidgetHostViewGuest::AcceleratedSurfaceBuffersSwapped( if (enable_compositing_) { guest_->SendMessageToEmbedder( new BrowserPluginMsg_BuffersSwapped( - guest_->embedder_routing_id(), guest_->instance_id(), params.size, params.mailbox_name, @@ -126,7 +125,6 @@ void RenderWidgetHostViewGuest::AcceleratedSurfacePostSubBuffer( if (enable_compositing_) { guest_->SendMessageToEmbedder( new BrowserPluginMsg_BuffersSwapped( - guest_->embedder_routing_id(), guest_->instance_id(), params.surface_size, params.mailbox_name, diff --git a/content/common/browser_plugin_messages.h b/content/common/browser_plugin_messages.h index bd9c987..5adfc57 100644 --- a/content/common/browser_plugin_messages.h +++ b/content/common/browser_plugin_messages.h @@ -258,87 +258,87 @@ IPC_MESSAGE_ROUTED2(BrowserPluginMsg_AllocateInstanceID_ACK, // Once the swapped out guest RenderView has been created in the embedder render // process, the browser process informs the embedder of its routing ID. -IPC_MESSAGE_ROUTED2(BrowserPluginMsg_GuestContentWindowReady, - int /* instance_id */, - int /* source_routing_id */) +IPC_MESSAGE_CONTROL2(BrowserPluginMsg_GuestContentWindowReady, + int /* instance_id */, + int /* source_routing_id */) // When the guest begins to load a page, the browser process informs the // embedder through the BrowserPluginMsg_LoadStart message. -IPC_MESSAGE_ROUTED3(BrowserPluginMsg_LoadStart, - int /* instance_id */, - GURL /* url */, - bool /* is_top_level */) +IPC_MESSAGE_CONTROL3(BrowserPluginMsg_LoadStart, + int /* instance_id */, + GURL /* url */, + bool /* is_top_level */) // If the guest fails to commit a page load then it will inform the // embedder through the BrowserPluginMsg_LoadAbort. A description // of the error will be stored in |type|. The list of known error // types can be found in net/base/net_error_list.h. -IPC_MESSAGE_ROUTED4(BrowserPluginMsg_LoadAbort, - int /* instance_id */, - GURL /* url */, - bool /* is_top_level */, - std::string /* type */) +IPC_MESSAGE_CONTROL4(BrowserPluginMsg_LoadAbort, + int /* instance_id */, + GURL /* url */, + bool /* is_top_level */, + std::string /* type */) // When the guest redirects a navigation, the browser process informs the // embedder through the BrowserPluginMsg_LoadRedirect message. -IPC_MESSAGE_ROUTED4(BrowserPluginMsg_LoadRedirect, - int /* instance_id */, - GURL /* old_url */, - GURL /* new_url */, - bool /* is_top_level */) +IPC_MESSAGE_CONTROL4(BrowserPluginMsg_LoadRedirect, + int /* instance_id */, + GURL /* old_url */, + GURL /* new_url */, + bool /* is_top_level */) // When the guest commits a navigation, the browser process informs // the embedder through the BrowserPluginMsg_LoadCommit message. -IPC_MESSAGE_ROUTED2(BrowserPluginMsg_LoadCommit, - int /* instance_id */, - BrowserPluginMsg_LoadCommit_Params) +IPC_MESSAGE_CONTROL2(BrowserPluginMsg_LoadCommit, + int /* instance_id */, + BrowserPluginMsg_LoadCommit_Params) // When the guest page has completed loading (including subframes), the browser // process informs the embedder through the BrowserPluginMsg_LoadStop message. -IPC_MESSAGE_ROUTED1(BrowserPluginMsg_LoadStop, - int /* instance_id */) +IPC_MESSAGE_CONTROL1(BrowserPluginMsg_LoadStop, + int /* instance_id */) // When the guest crashes, the browser process informs the embedder through this // message. -IPC_MESSAGE_ROUTED3(BrowserPluginMsg_GuestGone, - int /* instance_id */, - int /* process_id */, - int /* This is really base::TerminationStatus */) +IPC_MESSAGE_CONTROL3(BrowserPluginMsg_GuestGone, + int /* instance_id */, + int /* process_id */, + int /* This is really base::TerminationStatus */) // When the guest is unresponsive, the browser process informs the embedder // through this message. -IPC_MESSAGE_ROUTED2(BrowserPluginMsg_GuestUnresponsive, - int /* instance_id */, - int /* process_id */) +IPC_MESSAGE_CONTROL2(BrowserPluginMsg_GuestUnresponsive, + int /* instance_id */, + int /* process_id */) // When the guest begins responding again, the browser process informs the // embedder through this message. -IPC_MESSAGE_ROUTED2(BrowserPluginMsg_GuestResponsive, - int /* instance_id */, - int /* process_id */) +IPC_MESSAGE_CONTROL2(BrowserPluginMsg_GuestResponsive, + int /* instance_id */, + int /* process_id */) // When the user tabs to the end of the tab stops of a guest, the browser // process informs the embedder to tab out of the browser plugin. -IPC_MESSAGE_ROUTED2(BrowserPluginMsg_AdvanceFocus, - int /* instance_id */, - bool /* reverse */) +IPC_MESSAGE_CONTROL2(BrowserPluginMsg_AdvanceFocus, + int /* instance_id */, + bool /* reverse */) // When the guest starts/stops listening to touch events, it needs to notify the // plugin in the embedder about it. -IPC_MESSAGE_ROUTED2(BrowserPluginMsg_ShouldAcceptTouchEvents, - int /* instance_id */, - bool /* accept */) +IPC_MESSAGE_CONTROL2(BrowserPluginMsg_ShouldAcceptTouchEvents, + int /* instance_id */, + bool /* accept */) // Inform the embedder of the cursor the guest wishes to display. -IPC_MESSAGE_ROUTED2(BrowserPluginMsg_SetCursor, - int /* instance_id */, - WebCursor /* cursor */) +IPC_MESSAGE_CONTROL2(BrowserPluginMsg_SetCursor, + int /* instance_id */, + WebCursor /* cursor */) // The guest has damage it wants to convey to the embedder so that it can // update its backing store. -IPC_MESSAGE_ROUTED2(BrowserPluginMsg_UpdateRect, - int /* instance_id */, - BrowserPluginMsg_UpdateRect_Params) +IPC_MESSAGE_CONTROL2(BrowserPluginMsg_UpdateRect, + int /* instance_id */, + BrowserPluginMsg_UpdateRect_Params) // Requests the renderer to find out if a browser plugin is at position // (|x|, |y|) within the embedder. @@ -349,17 +349,17 @@ IPC_MESSAGE_ROUTED2(BrowserPluginMsg_PluginAtPositionRequest, gfx::Point /* position */) // Informs BrowserPlugin of a new name set for the top-level guest frame. -IPC_MESSAGE_ROUTED2(BrowserPluginMsg_UpdatedName, - int /* instance_id */, - std::string /* name */) +IPC_MESSAGE_CONTROL2(BrowserPluginMsg_UpdatedName, + int /* instance_id */, + std::string /* name */) // Guest renders into an FBO with textures provided by the embedder. // When HW accelerated buffers are swapped in the guest, the message // is forwarded to the embedder to notify it of a new texture // available for compositing. -IPC_MESSAGE_ROUTED5(BrowserPluginMsg_BuffersSwapped, - int /* instance_id */, - gfx::Size /* size */, - std::string /* mailbox_name */, - int /* route_id */, - int /* gpu_host_id */) +IPC_MESSAGE_CONTROL5(BrowserPluginMsg_BuffersSwapped, + int /* instance_id */, + gfx::Size /* size */, + std::string /* mailbox_name */, + int /* route_id */, + int /* gpu_host_id */) diff --git a/content/renderer/browser_plugin/browser_plugin_browsertest.cc b/content/renderer/browser_plugin/browser_plugin_browsertest.cc index 9fe5598..ac55961 100644 --- a/content/renderer/browser_plugin/browser_plugin_browsertest.cc +++ b/content/renderer/browser_plugin/browser_plugin_browsertest.cc @@ -189,7 +189,7 @@ TEST_F(BrowserPluginTest, InitialResize) { update_rect_params.scale_factor = 1.0f; update_rect_params.is_resize_ack = true; update_rect_params.needs_ack = true; - BrowserPluginMsg_UpdateRect msg(0, instance_id, update_rect_params); + BrowserPluginMsg_UpdateRect msg(instance_id, update_rect_params); browser_plugin->OnMessageReceived(msg); EXPECT_FALSE(browser_plugin->pending_damage_buffer_.get()); } @@ -307,7 +307,7 @@ TEST_F(BrowserPluginTest, ResizeFlowControl) { // received and has begun to use the |pending_damage_buffer_|. update_rect_params.damage_buffer_sequence_id = browser_plugin->damage_buffer_sequence_id_; - BrowserPluginMsg_UpdateRect msg(0, instance_id, update_rect_params); + BrowserPluginMsg_UpdateRect msg(instance_id, update_rect_params); browser_plugin->OnMessageReceived(msg); EXPECT_EQ(NULL, browser_plugin->pending_damage_buffer_.get()); } @@ -347,7 +347,7 @@ TEST_F(BrowserPluginTest, ResizeFlowControl) { update_rect_params.needs_ack = true; update_rect_params.damage_buffer_sequence_id = browser_plugin->damage_buffer_sequence_id_; - BrowserPluginMsg_UpdateRect msg(0, instance_id, update_rect_params); + BrowserPluginMsg_UpdateRect msg(instance_id, update_rect_params); browser_plugin->OnMessageReceived(msg); // This tells us that the BrowserPlugin is still expecting another // UpdateRect with the most recent size. @@ -363,7 +363,7 @@ TEST_F(BrowserPluginTest, ResizeFlowControl) { update_rect_params.needs_ack = true; update_rect_params.damage_buffer_sequence_id = browser_plugin->damage_buffer_sequence_id_; - BrowserPluginMsg_UpdateRect msg(0, instance_id, update_rect_params); + BrowserPluginMsg_UpdateRect msg(instance_id, update_rect_params); browser_plugin->OnMessageReceived(msg); // The BrowserPlugin has finally received an UpdateRect that satisifes // its current size, and so it is happy. @@ -410,7 +410,7 @@ TEST_F(BrowserPluginTest, GuestCrash) { // Pretend that the guest has terminated normally. { BrowserPluginMsg_GuestGone msg( - 0, 0, 0, base::TERMINATION_STATUS_NORMAL_TERMINATION); + 0, 0, base::TERMINATION_STATUS_NORMAL_TERMINATION); browser_plugin->OnMessageReceived(msg); } @@ -420,7 +420,7 @@ TEST_F(BrowserPluginTest, GuestCrash) { // Pretend that the guest has crashed. { BrowserPluginMsg_GuestGone msg( - 0, 0, 0, base::TERMINATION_STATUS_PROCESS_CRASHED); + 0, 0, base::TERMINATION_STATUS_PROCESS_CRASHED); browser_plugin->OnMessageReceived(msg); } @@ -499,7 +499,7 @@ TEST_F(BrowserPluginTest, CustomEvents) { navigate_params.is_top_level = true; navigate_params.url = GURL(kGoogleURL); navigate_params.process_id = 1337; - BrowserPluginMsg_LoadCommit msg(0, instance_id, navigate_params); + BrowserPluginMsg_LoadCommit msg(instance_id, navigate_params); browser_plugin->OnMessageReceived(msg); EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString("url")); EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString(kGetSrc)); @@ -511,7 +511,7 @@ TEST_F(BrowserPluginTest, CustomEvents) { navigate_params.is_top_level = false; navigate_params.url = GURL(kGoogleNewsURL); navigate_params.process_id = 42; - BrowserPluginMsg_LoadCommit msg(0, instance_id, navigate_params); + BrowserPluginMsg_LoadCommit msg(instance_id, navigate_params); browser_plugin->OnMessageReceived(msg); // The URL variable should not change because we've removed the event // listener. @@ -722,7 +722,7 @@ TEST_F(BrowserPluginTest, RemoveEventListenerInEventListener) { BrowserPluginMsg_LoadCommit_Params navigate_params; navigate_params.url = GURL(kGoogleURL); navigate_params.process_id = 1337; - BrowserPluginMsg_LoadCommit msg(0, instance_id, navigate_params); + BrowserPluginMsg_LoadCommit msg(instance_id, navigate_params); browser_plugin->OnMessageReceived(msg); EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString("url")); EXPECT_EQ(1337, ExecuteScriptAndReturnInt(kGetProcessID)); @@ -731,7 +731,7 @@ TEST_F(BrowserPluginTest, RemoveEventListenerInEventListener) { BrowserPluginMsg_LoadCommit_Params navigate_params; navigate_params.url = GURL(kGoogleNewsURL); navigate_params.process_id = 42; - BrowserPluginMsg_LoadCommit msg(0, instance_id, navigate_params); + BrowserPluginMsg_LoadCommit msg(instance_id, navigate_params); browser_plugin->OnMessageReceived(msg); // The URL variable should not change because we've removed the event // listener. @@ -779,7 +779,7 @@ TEST_F(BrowserPluginTest, MultipleEventListeners) { BrowserPluginMsg_LoadCommit_Params navigate_params; navigate_params.url = GURL(kGoogleURL); navigate_params.process_id = 1337; - BrowserPluginMsg_LoadCommit msg(0, instance_id, navigate_params); + BrowserPluginMsg_LoadCommit msg(instance_id, navigate_params); browser_plugin->OnMessageReceived(msg); EXPECT_EQ(2, ExecuteScriptAndReturnInt("count")); EXPECT_EQ(1337, ExecuteScriptAndReturnInt(kGetProcessID)); @@ -819,7 +819,7 @@ TEST_F(BrowserPluginTest, RemoveBrowserPluginOnExit) { // Pretend that the guest has crashed. BrowserPluginMsg_GuestGone msg( - 0, instance_id, 0, base::TERMINATION_STATUS_PROCESS_WAS_KILLED); + instance_id, 0, base::TERMINATION_STATUS_PROCESS_WAS_KILLED); browser_plugin->OnMessageReceived(msg); ProcessPendingMessages(); @@ -890,7 +890,7 @@ TEST_F(BrowserPluginTest, AutoSizeAttributes) { update_rect_params.scale_factor = 1.0f; update_rect_params.is_resize_ack = true; update_rect_params.needs_ack = true; - BrowserPluginMsg_UpdateRect msg(0, instance_id, update_rect_params); + BrowserPluginMsg_UpdateRect msg(instance_id, update_rect_params); browser_plugin->OnMessageReceived(msg); // Verify that the autosize state has been updated. |