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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1973133002: ✀ Remove postMessage plumbing for swappedout:// ✀ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build Created 4 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 } 998 }
999 999
1000 // RenderFrameImpl ---------------------------------------------------------- 1000 // RenderFrameImpl ----------------------------------------------------------
1001 RenderFrameImpl::RenderFrameImpl(const CreateParams& params) 1001 RenderFrameImpl::RenderFrameImpl(const CreateParams& params)
1002 : frame_(NULL), 1002 : frame_(NULL),
1003 is_main_frame_(true), 1003 is_main_frame_(true),
1004 in_browser_initiated_detach_(false), 1004 in_browser_initiated_detach_(false),
1005 in_frame_tree_(false), 1005 in_frame_tree_(false),
1006 render_view_(params.render_view->AsWeakPtr()), 1006 render_view_(params.render_view->AsWeakPtr()),
1007 routing_id_(params.routing_id), 1007 routing_id_(params.routing_id),
1008 render_frame_proxy_(NULL),
1009 is_detaching_(false), 1008 is_detaching_(false),
1010 proxy_routing_id_(MSG_ROUTING_NONE), 1009 proxy_routing_id_(MSG_ROUTING_NONE),
1011 #if defined(ENABLE_PLUGINS) 1010 #if defined(ENABLE_PLUGINS)
1012 plugin_power_saver_helper_(nullptr), 1011 plugin_power_saver_helper_(nullptr),
1013 plugin_find_handler_(nullptr), 1012 plugin_find_handler_(nullptr),
1014 #endif 1013 #endif
1015 cookie_jar_(this), 1014 cookie_jar_(this),
1016 selection_text_offset_(0), 1015 selection_text_offset_(0),
1017 selection_range_(gfx::Range::InvalidRange()), 1016 selection_range_(gfx::Range::InvalidRange()),
1018 handling_select_range_(false), 1017 handling_select_range_(false),
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
1568 // Synchronously run the unload handler before sending the ACK. 1567 // Synchronously run the unload handler before sending the ACK.
1569 // TODO(creis): Call dispatchUnloadEvent unconditionally here to support 1568 // TODO(creis): Call dispatchUnloadEvent unconditionally here to support
1570 // unload on subframes as well. 1569 // unload on subframes as well.
1571 if (is_main_frame_) 1570 if (is_main_frame_)
1572 frame_->dispatchUnloadEvent(); 1571 frame_->dispatchUnloadEvent();
1573 1572
1574 // Swap out and stop sending any IPC messages that are not ACKs. 1573 // Swap out and stop sending any IPC messages that are not ACKs.
1575 if (is_main_frame_) 1574 if (is_main_frame_)
1576 render_view_->SetSwappedOut(true); 1575 render_view_->SetSwappedOut(true);
1577 1576
1578 // Set the proxy here, since OnStop() below could cause an onload event
1579 // handler to execute, which could trigger code such as
1580 // willCheckAndDispatchMessageEvent() that needs the proxy.
1581 set_render_frame_proxy(proxy);
1582
1583 // Transfer settings such as initial drawing parameters to the remote frame, 1577 // Transfer settings such as initial drawing parameters to the remote frame,
1584 // if one is created, that will replace this frame. 1578 // if one is created, that will replace this frame.
1585 if (!is_main_frame_) 1579 if (!is_main_frame_)
1586 proxy->web_frame()->initializeFromFrame(frame_); 1580 proxy->web_frame()->initializeFromFrame(frame_);
1587 1581
1588 // Let WebKit know that this view is hidden so it can drop resources and 1582 // Let WebKit know that this view is hidden so it can drop resources and
1589 // stop compositing. 1583 // stop compositing.
1590 // TODO(creis): Support this for subframes as well. 1584 // TODO(creis): Support this for subframes as well.
1591 if (is_main_frame_) { 1585 if (is_main_frame_) {
1592 render_view_->webview()->setVisibilityState( 1586 render_view_->webview()->setVisibilityState(
(...skipping 2561 matching lines...) Expand 10 before | Expand all | Expand 10 after
4154 } 4148 }
4155 return web_encrypted_media_client_.get(); 4149 return web_encrypted_media_client_.get();
4156 } 4150 }
4157 4151
4158 blink::WebMIDIClient* RenderFrameImpl::webMIDIClient() { 4152 blink::WebMIDIClient* RenderFrameImpl::webMIDIClient() {
4159 if (!midi_dispatcher_) 4153 if (!midi_dispatcher_)
4160 midi_dispatcher_ = new MidiDispatcher(this); 4154 midi_dispatcher_ = new MidiDispatcher(this);
4161 return midi_dispatcher_; 4155 return midi_dispatcher_;
4162 } 4156 }
4163 4157
4164 bool RenderFrameImpl::willCheckAndDispatchMessageEvent(
4165 blink::WebLocalFrame* source_frame,
4166 blink::WebFrame* target_frame,
4167 blink::WebSecurityOrigin target_origin,
4168 blink::WebDOMMessageEvent event) {
4169 DCHECK(!frame_ || frame_ == target_frame);
4170
4171 // TODO(alexmos, nasko): When swapped-out:// disappears, this should be
4172 // cleaned up so that RenderFrameProxy::postMessageEvent is the only path for
4173 // cross-process postMessages.
4174
4175 // It is possible to get here on a swapped-out frame without a
4176 // |render_frame_proxy_|. This happens when:
4177 // - This process only has one active RenderView and is about to go away
4178 // (e.g., due to cross-process navigation).
4179 // - The top frame has a subframe with an unload handler.
4180 // - The subframe sends a postMessage to the top-level frame in its unload
4181 // handler.
4182 // See https://crbug.com/475651 for details. We return false here, since we
4183 // don't want to deliver the message to the new process in this case.
4184 if (!render_frame_proxy_)
4185 return false;
4186
4187 render_frame_proxy_->postMessageEvent(
4188 source_frame, render_frame_proxy_->web_frame(), target_origin, event);
4189 return true;
4190 }
4191
4192 blink::WebString RenderFrameImpl::userAgentOverride() { 4158 blink::WebString RenderFrameImpl::userAgentOverride() {
4193 if (!render_view_->webview() || !render_view_->webview()->mainFrame() || 4159 if (!render_view_->webview() || !render_view_->webview()->mainFrame() ||
4194 render_view_->renderer_preferences_.user_agent_override.empty()) { 4160 render_view_->renderer_preferences_.user_agent_override.empty()) {
4195 return blink::WebString(); 4161 return blink::WebString();
4196 } 4162 }
4197 4163
4198 // TODO(nasko): When the top-level frame is remote, there is no WebDataSource 4164 // TODO(nasko): When the top-level frame is remote, there is no WebDataSource
4199 // associated with it, so the checks below are not valid. Temporarily 4165 // associated with it, so the checks below are not valid. Temporarily
4200 // return early and fix properly as part of https://crbug.com/426555. 4166 // return early and fix properly as part of https://crbug.com/426555.
4201 if (render_view_->webview()->mainFrame()->isWebRemoteFrame()) 4167 if (render_view_->webview()->mainFrame()->isWebRemoteFrame())
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after
6144 // event target. Potentially a Pepper plugin will receive the event. 6110 // event target. Potentially a Pepper plugin will receive the event.
6145 // In order to tell whether a plugin gets the last mouse event and which it 6111 // In order to tell whether a plugin gets the last mouse event and which it
6146 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6112 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6147 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6113 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6148 // |pepper_last_mouse_event_target_|. 6114 // |pepper_last_mouse_event_target_|.
6149 pepper_last_mouse_event_target_ = nullptr; 6115 pepper_last_mouse_event_target_ = nullptr;
6150 #endif 6116 #endif
6151 } 6117 }
6152 6118
6153 } // namespace content 6119 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698