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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 246023007: Chromium-side plumbing for ServiceWorker -> Document postMessage (2/3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: message port threading fix Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 3518 matching lines...) Expand 10 before | Expand all | Expand 10 after
3529 if (!rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance()) && 3529 if (!rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance()) &&
3530 !GetBrowserPluginGuest() && !GetBrowserPluginEmbedder()) 3530 !GetBrowserPluginGuest() && !GetBrowserPluginEmbedder())
3531 return; 3531 return;
3532 3532
3533 ViewMsg_PostMessage_Params new_params(params); 3533 ViewMsg_PostMessage_Params new_params(params);
3534 3534
3535 if (!params.message_port_ids.empty()) { 3535 if (!params.message_port_ids.empty()) {
3536 MessagePortMessageFilter* message_port_message_filter = 3536 MessagePortMessageFilter* message_port_message_filter =
3537 static_cast<RenderProcessHostImpl*>(GetRenderProcessHost()) 3537 static_cast<RenderProcessHostImpl*>(GetRenderProcessHost())
3538 ->message_port_message_filter(); 3538 ->message_port_message_filter();
3539 std::vector<int> new_routing_ids(params.message_port_ids.size()); 3539 message_port_message_filter->UpdateMessagePortsWithNewRoutes(
3540 for (size_t i = 0; i < params.message_port_ids.size(); ++i) { 3540 params.message_port_ids,
3541 new_routing_ids[i] = message_port_message_filter->GetNextRoutingID(); 3541 &new_params.new_routing_ids);
3542 MessagePortService::GetInstance()->UpdateMessagePort(
3543 params.message_port_ids[i],
3544 message_port_message_filter,
3545 new_routing_ids[i]);
3546 }
3547 new_params.new_routing_ids = new_routing_ids;
3548 } 3542 }
3549 3543
3550 // If there is a source_routing_id, translate it to the routing ID for 3544 // If there is a source_routing_id, translate it to the routing ID for
3551 // the equivalent swapped out RVH in the target process. If we need 3545 // the equivalent swapped out RVH in the target process. If we need
3552 // to create a swapped out RVH for the source tab, we create its opener 3546 // to create a swapped out RVH for the source tab, we create its opener
3553 // chain as well, since those will also be accessible to the target page. 3547 // chain as well, since those will also be accessible to the target page.
3554 if (new_params.source_routing_id != MSG_ROUTING_NONE) { 3548 if (new_params.source_routing_id != MSG_ROUTING_NONE) {
3555 // Try to look up the WebContents for the source page. 3549 // Try to look up the WebContents for the source page.
3556 WebContentsImpl* source_contents = NULL; 3550 WebContentsImpl* source_contents = NULL;
3557 RenderViewHostImpl* source_rvh = RenderViewHostImpl::FromID( 3551 RenderViewHostImpl* source_rvh = RenderViewHostImpl::FromID(
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
3980 3974
3981 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { 3975 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) {
3982 if (!delegate_) 3976 if (!delegate_)
3983 return; 3977 return;
3984 const gfx::Size new_size = GetPreferredSize(); 3978 const gfx::Size new_size = GetPreferredSize();
3985 if (new_size != old_size) 3979 if (new_size != old_size)
3986 delegate_->UpdatePreferredSize(this, new_size); 3980 delegate_->UpdatePreferredSize(this, new_size);
3987 } 3981 }
3988 3982
3989 } // namespace content 3983 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698