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

Unified Diff: content/browser/renderer_host/render_widget_helper.cc

Issue 2821473002: Service CreateNewWindow on the UI thread with a new mojo interface (Closed)
Patch Set: MakeShared goodness Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_helper.cc
diff --git a/content/browser/renderer_host/render_widget_helper.cc b/content/browser/renderer_host/render_widget_helper.cc
index 6cca1d74be9f0cef34276dd3cd10ce604a7e3abd..22c246a1359c9da0196a098b66df807a8f5c20db 100644
--- a/content/browser/renderer_host/render_widget_helper.cc
+++ b/content/browser/renderer_host/render_widget_helper.cc
@@ -10,10 +10,7 @@
#include "base/posix/eintr_wrapper.h"
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
-#include "content/browser/dom_storage/session_storage_namespace_impl.h"
-#include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/browser/loader/resource_dispatcher_host_impl.h"
-#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/common/view_messages.h"
@@ -88,79 +85,6 @@ void RenderWidgetHelper::OnResumeDeferredNavigation(
resource_dispatcher_host_->ResumeDeferredNavigation(request_id);
}
-void RenderWidgetHelper::CreateNewWindow(
- mojom::CreateNewWindowParamsPtr params,
- bool no_javascript_access,
- int32_t* render_view_route_id,
- int32_t* main_frame_route_id,
- int32_t* main_frame_widget_route_id,
- SessionStorageNamespace* session_storage_namespace) {
- if (params->opener_suppressed || no_javascript_access) {
- // If the opener is supppressed or script access is disallowed, we should
- // open the window in a new BrowsingInstance, and thus a new process. That
- // means the current renderer process will not be able to route messages to
- // it. Because of this, we will immediately show and navigate the window
- // in OnCreateNewWindowOnUI, using the params provided here.
- *render_view_route_id = MSG_ROUTING_NONE;
- *main_frame_route_id = MSG_ROUTING_NONE;
- *main_frame_widget_route_id = MSG_ROUTING_NONE;
- } else {
- *render_view_route_id = GetNextRoutingID();
- *main_frame_route_id = GetNextRoutingID();
- // TODO(avi): When RenderViewHostImpl has-a RenderWidgetHostImpl, this
- // should be updated to give the widget a distinct routing ID.
- // https://crbug.com/545684
- *main_frame_widget_route_id = *render_view_route_id;
- // Block resource requests until the frame is created, since the HWND might
- // be needed if a response ends up creating a plugin. We'll only have a
- // single frame at this point. These requests will be resumed either in
- // WebContentsImpl::CreateNewWindow or RenderFrameHost::Init.
- resource_dispatcher_host_->BlockRequestsForRoute(
- GlobalFrameRoutingId(render_process_id_, *main_frame_route_id));
- }
-
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&RenderWidgetHelper::OnCreateNewWindowOnUI, this,
- base::Passed(&params), *render_view_route_id,
- *main_frame_route_id, *main_frame_widget_route_id,
- base::RetainedRef(session_storage_namespace)));
-}
-
-void RenderWidgetHelper::OnCreateNewWindowOnUI(
- mojom::CreateNewWindowParamsPtr params,
- int32_t render_view_route_id,
- int32_t main_frame_route_id,
- int32_t main_frame_widget_route_id,
- SessionStorageNamespace* session_storage_namespace) {
- RenderFrameHostImpl* opener = RenderFrameHostImpl::FromID(
- render_process_id_, params->opener_render_frame_id);
- if (opener && opener->IsRenderFrameLive()) {
- opener->OnCreateNewWindow(render_view_route_id, main_frame_route_id,
- main_frame_widget_route_id, *params,
- session_storage_namespace);
- }
-
- // If we did not create a WebContents to host the renderer-created
- // RenderFrame/RenderView/RenderWidget objects, destroy them.
- RenderProcessHost* rph = RenderProcessHost::FromID(render_process_id_);
- if (main_frame_route_id != MSG_ROUTING_NONE && rph != nullptr) {
- bool succeeded =
- RenderWidgetHost::FromID(render_process_id_,
- main_frame_widget_route_id) != nullptr;
- if (!succeeded) {
- DCHECK(!RenderFrameHost::FromID(render_process_id_, main_frame_route_id));
- DCHECK(!RenderViewHost::FromID(render_process_id_, render_view_route_id));
-
- rph->Send(new ViewMsg_Close(render_view_route_id));
- } else {
- // If a RWH was created, there should also be an RFH and RVH.
- DCHECK(RenderFrameHost::FromID(render_process_id_, main_frame_route_id));
- DCHECK(RenderViewHost::FromID(render_process_id_, render_view_route_id));
- }
- }
-}
-
void RenderWidgetHelper::CreateNewWidget(int opener_id,
blink::WebPopupType popup_type,
int* route_id) {

Powered by Google App Engine
This is Rietveld 408576698