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

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

Issue 6319001: Support window.opener after a process swap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add WasSwappedOut message for clean exit. Created 9 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_view_host.cc
diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc
index 0b7a4a45b1a368411bc3ca5bc1b63e38a47fe56f..0a6a15a7026925a431173e912643fb924d8d52c4 100644
--- a/content/browser/renderer_host/render_view_host.cc
+++ b/content/browser/renderer_host/render_view_host.cc
@@ -97,9 +97,10 @@ RenderViewHost::RenderViewHost(SiteInstance* instance,
delegate_(delegate),
waiting_for_drag_context_response_(false),
enabled_bindings_(0),
- pending_request_id_(0),
+ pending_request_id_(-1),
navigations_suspended_(false),
suspended_nav_message_(NULL),
+ is_swapped_out_(false),
run_modal_reply_msg_(NULL),
is_waiting_for_beforeunload_ack_(false),
is_waiting_for_unload_ack_(false),
@@ -263,11 +264,20 @@ void RenderViewHost::SetNavigationsSuspended(bool suspend) {
navigations_suspended_ = suspend;
if (!suspend && suspended_nav_message_.get()) {
// There's a navigation message waiting to be sent. Now that we're not
- // suspended anymore, resume navigation by sending it.
+ // suspended anymore, resume navigation by sending it. If we were swapped
+ // out, we should also stop filtering out the IPC messages now.
+ is_swapped_out_ = false;
Send(suspended_nav_message_.release());
}
}
+void RenderViewHost::CancelSuspendedNavigations() {
+ // Clear any state if a pending navigation is canceled or pre-empted.
+ if (suspended_nav_message_.get())
+ suspended_nav_message_.reset();
+ navigations_suspended_ = false;
+}
+
void RenderViewHost::FirePageBeforeUnload(bool for_cross_site_transition) {
if (!IsRenderViewLive()) {
// This RenderViewHost doesn't have a live renderer, so just skip running
@@ -300,45 +310,58 @@ void RenderViewHost::FirePageBeforeUnload(bool for_cross_site_transition) {
}
}
-void RenderViewHost::ClosePage(bool for_cross_site_transition,
- int new_render_process_host_id,
- int new_request_id) {
- // This will be set back to false in OnClosePageACK, just before we close the
- // tab or replace it with a pending RVH. There are some cases (such as 204
- // errors) where we'll continue to show this RVH.
+void RenderViewHost::SwapOut(int new_render_process_host_id,
+ int new_request_id) {
+ // Start filtering IPC messages to avoid confusing the delegate. This will
+ // prevent any dialogs from appearing during unload handlers, but we've
+ // already decided to silence them in crbug.com/68780. We will set it back
+ // to false in SetNavigationsSuspended if we swap back in.
+ is_swapped_out_ = true;
+
+ // This will be set back to false in OnSwapOutACK, just before we replace
+ // this RVH with the pending RVH.
is_waiting_for_unload_ack_ = true;
// Start the hang monitor in case the renderer hangs in the unload handler.
StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS));
- ViewMsg_ClosePage_Params params;
+ ViewMsg_SwapOut_Params params;
params.closing_process_id = process()->id();
params.closing_route_id = routing_id();
- params.for_cross_site_transition = for_cross_site_transition;
params.new_render_process_host_id = new_render_process_host_id;
params.new_request_id = new_request_id;
if (IsRenderViewLive()) {
- NotificationService::current()->Notify(
- NotificationType::RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW,
- Source<RenderViewHost>(this),
- NotificationService::NoDetails());
-
- Send(new ViewMsg_ClosePage(routing_id(), params));
+ Send(new ViewMsg_SwapOut(routing_id(), params));
} else {
- // This RenderViewHost doesn't have a live renderer, so just skip closing
- // the page. We must notify the ResourceDispatcherHost on the IO thread,
+ // This RenderViewHost doesn't have a live renderer, so just skip the unload
+ // event. We must notify the ResourceDispatcherHost on the IO thread,
// which we will do through the RenderProcessHost's widget helper.
- process()->CrossSiteClosePageACK(params);
+ process()->CrossSiteSwapOutACK(params);
}
}
-void RenderViewHost::OnClosePageACK(bool for_cross_site_transition) {
+void RenderViewHost::OnSwapOutACK() {
+ // Stop the hang monitor now that the unload handler has finished.
StopHangMonitorTimeout();
is_waiting_for_unload_ack_ = false;
+}
+
+void RenderViewHost::ClosePage() {
+ // Start the hang monitor in case the renderer hangs in the unload handler.
+ is_waiting_for_unload_ack_ = true;
+ StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS));
+
+ if (IsRenderViewLive()) {
+ // TODO(creis): Should this be moved to Shutdown? It may not be called for
+ // RenderViewHosts that have been swapped out.
+ NotificationService::current()->Notify(
+ NotificationType::RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW,
+ Source<RenderViewHost>(this),
+ NotificationService::NoDetails());
- // If this ClosePageACK is not for a cross-site transition, then it is for an
- // attempt to close the tab. We have now finished the unload handler and can
- // proceed with closing the tab.
- if (!for_cross_site_transition) {
+ Send(new ViewMsg_ClosePage(routing_id()));
+ } else {
+ // This RenderViewHost doesn't have a live renderer, so just skip the unload
+ // event and close the page.
ClosePageIgnoringUnloadEvents();
}
}
@@ -753,6 +776,23 @@ bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopLoading, OnMsgDidStopLoading)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeLoadProgress,
OnMsgDidChangeLoadProgress)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartProvisionalLoadForFrame,
+ OnMsgDidStartProvisionalLoadForFrame)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DidRedirectProvisionalLoad,
+ OnMsgDidRedirectProvisionalLoad)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DidFailProvisionalLoadWithError,
+ OnMsgDidFailProvisionalLoadWithError)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache,
+ OnMsgDidLoadResourceFromMemoryCache)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisplayInsecureContent,
+ OnMsgDidDisplayInsecureContent)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DidRunInsecureContent,
+ OnMsgDidRunInsecureContent)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentLoadedInFrame,
+ OnMsgDocumentLoadedInFrame)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DidFinishLoad, OnMsgDidFinishLoad)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateContentRestrictions,
+ OnMsgUpdateContentRestrictions)
IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentAvailableInMainFrame,
OnMsgDocumentAvailableInMainFrame)
IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentOnLoadCompletedInMainFrame,
@@ -776,6 +816,7 @@ bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus)
IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole)
IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnMsgShouldCloseACK)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnMsgClosePageACK)
IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnMsgSelectionChanged)
IPC_MESSAGE_HANDLER(ViewHostMsg_AccessibilityNotifications,
OnAccessibilityNotifications)
@@ -832,13 +873,13 @@ void RenderViewHost::CreateNewWindow(
void RenderViewHost::CreateNewWidget(int route_id,
WebKit::WebPopupType popup_type) {
RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
- if (view)
+ if (view && !is_swapped_out_)
Matt Perry 2011/04/28 22:48:20 rather than adding these checks in every message h
Charlie Reis 2011/04/29 17:53:53 That's a great idea-- thanks. Now there's only a
view->CreateNewWidget(route_id, popup_type);
}
void RenderViewHost::CreateNewFullscreenWidget(int route_id) {
RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
- if (view)
+ if (view && !is_swapped_out_)
view->CreateNewFullscreenWidget(route_id);
}
@@ -848,7 +889,8 @@ void RenderViewHost::OnMsgShowView(int route_id,
bool user_gesture) {
RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
if (view) {
- view->ShowCreatedWindow(route_id, disposition, initial_pos, user_gesture);
+ if (!is_swapped_out_)
+ view->ShowCreatedWindow(route_id, disposition, initial_pos, user_gesture);
Send(new ViewMsg_Move_ACK(route_id));
}
}
@@ -857,7 +899,8 @@ void RenderViewHost::OnMsgShowWidget(int route_id,
const gfx::Rect& initial_pos) {
RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
if (view) {
- view->ShowCreatedWidget(route_id, initial_pos);
+ if (!is_swapped_out_)
+ view->ShowCreatedWidget(route_id, initial_pos);
Send(new ViewMsg_Move_ACK(route_id));
}
}
@@ -865,7 +908,8 @@ void RenderViewHost::OnMsgShowWidget(int route_id,
void RenderViewHost::OnMsgShowFullscreenWidget(int route_id) {
RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
if (view) {
- view->ShowCreatedFullscreenWidget(route_id);
+ if (!is_swapped_out_)
+ view->ShowCreatedFullscreenWidget(route_id);
Send(new ViewMsg_Move_ACK(route_id));
}
}
@@ -944,6 +988,10 @@ void RenderViewHost::OnMsgNavigate(const IPC::Message& msg) {
if (is_waiting_for_unload_ack_)
return;
+ // If this RVH has been swapped out, ignore the navigation.
+ if (is_swapped_out_)
+ return;
+
const int renderer_id = process()->id();
ChildProcessSecurityPolicy* policy =
ChildProcessSecurityPolicy::GetInstance();
@@ -969,11 +1017,15 @@ void RenderViewHost::OnMsgNavigate(const IPC::Message& msg) {
void RenderViewHost::OnMsgUpdateState(int32 page_id,
const std::string& state) {
+ // We allow UpdateState messages even from swapped out renderers.
delegate_->UpdateState(this, page_id, state);
}
void RenderViewHost::OnMsgUpdateTitle(int32 page_id,
const std::wstring& title) {
+ if (is_swapped_out_)
+ return;
+
if (title.length() > content::kMaxTitleChars) {
NOTREACHED() << "Renderer sent too many characters in title.";
return;
@@ -982,12 +1034,14 @@ void RenderViewHost::OnMsgUpdateTitle(int32 page_id,
}
void RenderViewHost::OnMsgUpdateEncoding(const std::string& encoding_name) {
- delegate_->UpdateEncoding(this, encoding_name);
+ if (!is_swapped_out_)
+ delegate_->UpdateEncoding(this, encoding_name);
}
void RenderViewHost::OnMsgUpdateTargetURL(int32 page_id,
const GURL& url) {
- delegate_->UpdateTargetURL(page_id, url);
+ if (!is_swapped_out_)
+ delegate_->UpdateTargetURL(page_id, url);
// Send a notification back to the renderer that we are ready to
// receive more target urls.
@@ -1003,43 +1057,111 @@ void RenderViewHost::OnMsgScreenshot(const SkBitmap& bitmap) {
void RenderViewHost::OnUpdateInspectorSetting(
const std::string& key, const std::string& value) {
- delegate_->UpdateInspectorSetting(key, value);
+ if (!is_swapped_out_)
+ delegate_->UpdateInspectorSetting(key, value);
}
void RenderViewHost::OnMsgClose() {
// If the renderer is telling us to close, it has already run the unload
- // events, and we can take the fast path.
+ // events, and we can take the fast path. We allow this even from swapped
+ // out renderers.
ClosePageIgnoringUnloadEvents();
}
void RenderViewHost::OnMsgRequestMove(const gfx::Rect& pos) {
- delegate_->RequestMove(pos);
+ if (!is_swapped_out_)
+ delegate_->RequestMove(pos);
Send(new ViewMsg_Move_ACK(routing_id()));
}
void RenderViewHost::OnMsgDidStartLoading() {
- delegate_->DidStartLoading();
+ if (!is_swapped_out_)
+ delegate_->DidStartLoading();
}
void RenderViewHost::OnMsgDidStopLoading() {
- delegate_->DidStopLoading();
+ if (!is_swapped_out_)
+ delegate_->DidStopLoading();
}
void RenderViewHost::OnMsgDidChangeLoadProgress(double load_progress) {
- delegate_->DidChangeLoadProgress(load_progress);
+ if (!is_swapped_out_)
+ delegate_->DidChangeLoadProgress(load_progress);
+}
+
+void RenderViewHost::OnMsgDidStartProvisionalLoadForFrame(int64 frame_id,
+ bool is_main_frame,
+ const GURL& url) {
+ if (!is_swapped_out_)
+ delegate_->DidStartProvisionalLoadForFrame(frame_id, is_main_frame, url);
+}
+
+void RenderViewHost::OnMsgDidRedirectProvisionalLoad(int32 page_id,
+ const GURL& source_url,
+ const GURL& target_url) {
+ if (!is_swapped_out_)
+ delegate_->DidRedirectProvisionalLoad(page_id, source_url, target_url);
+}
+
+void RenderViewHost::OnMsgDidFailProvisionalLoadWithError(
+ int64 frame_id,
+ bool is_main_frame,
+ int error_code,
+ const GURL& url,
+ bool showing_repost_interstitial) {
+ if (!is_swapped_out_) {
+ delegate_->DidFailProvisionalLoadWithError(frame_id, is_main_frame,
+ error_code, url,
+ showing_repost_interstitial);
+ }
+}
+
+void RenderViewHost::OnMsgDidLoadResourceFromMemoryCache(
+ const GURL& url,
+ const std::string& security_info) {
+ if (!is_swapped_out_)
+ delegate_->DidLoadResourceFromMemoryCache(url, security_info);
+}
+
+void RenderViewHost::OnMsgDidDisplayInsecureContent() {
+ if (!is_swapped_out_)
+ delegate_->DidDisplayInsecureContent();
+}
+
+void RenderViewHost::OnMsgDidRunInsecureContent(
+ const std::string& security_origin, const GURL& target_url) {
+ if (!is_swapped_out_)
+ delegate_->DidRunInsecureContent(security_origin, target_url);
+}
+
+void RenderViewHost::OnMsgDocumentLoadedInFrame(int64 frame_id) {
+ if (!is_swapped_out_)
+ delegate_->DocumentLoadedInFrame(frame_id);
+}
+
+void RenderViewHost::OnMsgDidFinishLoad(int64 frame_id) {
+ if (!is_swapped_out_)
+ delegate_->DidFinishLoad(frame_id);
+}
+
+void RenderViewHost::OnMsgUpdateContentRestrictions(int restrictions) {
+ if (!is_swapped_out_)
+ delegate_->UpdateContentRestrictions(restrictions);
}
void RenderViewHost::OnMsgDocumentAvailableInMainFrame() {
- delegate_->DocumentAvailableInMainFrame(this);
+ if (!is_swapped_out_)
+ delegate_->DocumentAvailableInMainFrame(this);
}
void RenderViewHost::OnMsgDocumentOnLoadCompletedInMainFrame(int32 page_id) {
- delegate_->DocumentOnLoadCompletedInMainFrame(this, page_id);
+ if (!is_swapped_out_)
+ delegate_->DocumentOnLoadCompletedInMainFrame(this, page_id);
}
void RenderViewHost::OnMsgContextMenu(const ContextMenuParams& params) {
RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
- if (!view)
+ if (!view || is_swapped_out_)
return;
// Validate the URLs in |params|. If the renderer can't request the URLs
@@ -1062,6 +1184,9 @@ void RenderViewHost::OnMsgContextMenu(const ContextMenuParams& params) {
void RenderViewHost::OnMsgOpenURL(const GURL& url,
const GURL& referrer,
WindowOpenDisposition disposition) {
+ if (is_swapped_out_)
+ return;
+
GURL validated_url(url);
FilterURL(ChildProcessSecurityPolicy::GetInstance(),
process()->id(), &validated_url);
@@ -1072,13 +1197,14 @@ void RenderViewHost::OnMsgOpenURL(const GURL& url,
void RenderViewHost::OnMsgDidContentsPreferredSizeChange(
const gfx::Size& new_size) {
RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
- if (!view)
+ if (!view || is_swapped_out_)
return;
view->UpdatePreferredSize(new_size);
}
void RenderViewHost::OnMsgDomOperationResponse(
const std::string& json_string, int automation_id) {
+ // We allow this even when swapped out.
delegate_->DomOperationResponse(json_string, automation_id);
// We also fire a notification for more loosely-coupled use cases.
@@ -1108,6 +1234,9 @@ void RenderViewHost::OnMsgWebUISend(
}
}
+ if (is_swapped_out_)
+ return;
+
ExtensionHostMsg_DomMessage_Params params;
params.name = message;
if (value.get())
@@ -1125,7 +1254,8 @@ void RenderViewHost::OnMsgWebUISend(
void RenderViewHost::OnMsgForwardMessageToExternalHost(
const std::string& message, const std::string& origin,
const std::string& target) {
- delegate_->ProcessExternalHostMessage(message, origin, target);
+ if (!is_swapped_out_)
+ delegate_->ProcessExternalHostMessage(message, origin, target);
}
void RenderViewHost::DisassociateFromPopupCount() {
@@ -1135,6 +1265,9 @@ void RenderViewHost::DisassociateFromPopupCount() {
void RenderViewHost::OnMsgSetTooltipText(
const std::wstring& tooltip_text,
WebTextDirection text_direction_hint) {
+ if (is_swapped_out_)
+ return;
+
// First, add directionality marks around tooltip text if necessary.
// A naive solution would be to simply always wrap the text. However, on
// windows, Unicode directional embedding characters can't be displayed on
@@ -1165,7 +1298,7 @@ void RenderViewHost::OnMsgSetTooltipText(
}
void RenderViewHost::OnMsgSelectionChanged(const std::string& text) {
- if (view())
+ if (view() && !is_swapped_out_)
view()->SelectionChanged(text);
}
@@ -1179,8 +1312,8 @@ void RenderViewHost::OnMsgRunJavaScriptMessage(
// process input events.
process()->set_ignore_input_events(true);
StopHangMonitorTimeout();
- delegate_->RunJavaScriptMessage(message, default_prompt, frame_url, flags,
- reply_msg,
+ delegate_->RunJavaScriptMessage(this, message, default_prompt, frame_url,
+ flags, reply_msg,
&are_javascript_messages_suppressed_);
}
@@ -1191,7 +1324,7 @@ void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const GURL& frame_url,
// shouldn't process input events.
process()->set_ignore_input_events(true);
StopHangMonitorTimeout();
- delegate_->RunBeforeUnloadConfirm(message, reply_msg);
+ delegate_->RunBeforeUnloadConfirm(this, message, reply_msg);
}
void RenderViewHost::MediaPlayerActionAt(const gfx::Point& location,
@@ -1211,19 +1344,19 @@ void RenderViewHost::OnMsgStartDragging(
const SkBitmap& image,
const gfx::Point& image_offset) {
RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
- if (view)
+ if (view && !is_swapped_out_)
view->StartDragging(drop_data, drag_operations_mask, image, image_offset);
}
void RenderViewHost::OnUpdateDragCursor(WebDragOperation current_op) {
RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
- if (view)
+ if (view && !is_swapped_out_)
view->UpdateDragCursor(current_op);
}
void RenderViewHost::OnTakeFocus(bool reverse) {
RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
- if (view)
+ if (view && !is_swapped_out_)
view->TakeFocus(reverse);
}
@@ -1231,6 +1364,9 @@ void RenderViewHost::OnAddMessageToConsole(int32 level,
const std::wstring& message,
int32 line_no,
const std::wstring& source_id) {
+ if (is_swapped_out_)
+ return;
+
// Pass through log level only on WebUI pages to limit console spew.
int32 resolved_level =
BindingsPolicy::is_web_ui_enabled(enabled_bindings_) ? level : 0;
@@ -1261,7 +1397,8 @@ void RenderViewHost::UnhandledKeyboardEvent(
}
void RenderViewHost::OnUserGesture() {
- delegate_->OnUserGesture();
+ if (is_swapped_out_)
+ delegate_->OnUserGesture();
}
void RenderViewHost::GetAllSavableResourceLinksForCurrentPage(
@@ -1283,7 +1420,7 @@ void RenderViewHost::OnMsgShouldCloseACK(bool proceed) {
// If this renderer navigated while the beforeunload request was in flight, we
// may have cleared this state in OnMsgNavigate, in which case we can ignore
// this message.
- if (!is_waiting_for_beforeunload_ack_)
+ if (!is_waiting_for_beforeunload_ack_ || is_swapped_out_)
return;
is_waiting_for_beforeunload_ack_ = false;
@@ -1296,6 +1433,11 @@ void RenderViewHost::OnMsgShouldCloseACK(bool proceed) {
}
}
+void RenderViewHost::OnMsgClosePageACK() {
+ // We allow this even while swapped out.
+ ClosePageIgnoringUnloadEvents();
+}
+
void RenderViewHost::WindowMoveOrResizeStarted() {
Send(new ViewMsg_MoveOrResizeStarted(routing_id()));
}
@@ -1310,18 +1452,19 @@ void RenderViewHost::NotifyRendererResponsive() {
}
void RenderViewHost::OnMsgFocusedNodeChanged(bool is_editable_node) {
- delegate_->FocusedNodeChanged(is_editable_node);
+ if (!is_swapped_out_)
+ delegate_->FocusedNodeChanged(is_editable_node);
}
void RenderViewHost::OnMsgFocus() {
RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
- if (view)
+ if (view && !is_swapped_out_)
view->Activate();
}
void RenderViewHost::OnMsgBlur() {
RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
- if (view)
+ if (view && !is_swapped_out_)
view->Deactivate();
}
@@ -1360,7 +1503,7 @@ void RenderViewHost::ForwardMouseEvent(
void RenderViewHost::OnMouseActivate() {
RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
- if (view)
+ if (view && !is_swapped_out_)
view->HandleMouseActivate();
}
@@ -1478,7 +1621,7 @@ void RenderViewHost::JavaScriptStressTestControl(int cmd, int param) {
void RenderViewHost::OnAccessibilityNotifications(
const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) {
- if (view())
+ if (view() && !is_swapped_out_)
view()->OnAccessibilityNotifications(params);
if (!params.empty()) {
@@ -1507,14 +1650,15 @@ void RenderViewHost::OnAccessibilityNotifications(
}
void RenderViewHost::OnCSSInserted() {
- delegate_->DidInsertCSS();
+ if (!is_swapped_out_)
+ delegate_->DidInsertCSS();
}
void RenderViewHost::OnContentBlocked(ContentSettingsType type,
const std::string& resource_identifier) {
RenderViewHostDelegate::ContentSettings* content_settings_delegate =
delegate_->GetContentSettingsDelegate();
- if (content_settings_delegate)
+ if (content_settings_delegate && !is_swapped_out_)
content_settings_delegate->OnContentBlocked(type, resource_identifier);
}
@@ -1522,7 +1666,7 @@ void RenderViewHost::OnAppCacheAccessed(const GURL& manifest_url,
bool blocked_by_policy) {
RenderViewHostDelegate::ContentSettings* content_settings_delegate =
delegate_->GetContentSettingsDelegate();
- if (content_settings_delegate)
+ if (content_settings_delegate && !is_swapped_out_)
content_settings_delegate->OnAppCacheAccessed(manifest_url,
blocked_by_policy);
}
@@ -1534,7 +1678,7 @@ void RenderViewHost::OnWebDatabaseAccessed(const GURL& url,
bool blocked_by_policy) {
RenderViewHostDelegate::ContentSettings* content_settings_delegate =
delegate_->GetContentSettingsDelegate();
- if (content_settings_delegate)
+ if (content_settings_delegate && !is_swapped_out_)
content_settings_delegate->OnWebDatabaseAccessed(
url, name, display_name, estimated_size, blocked_by_policy);
}
@@ -1542,7 +1686,8 @@ void RenderViewHost::OnWebDatabaseAccessed(const GURL& url,
void RenderViewHost::OnUpdateZoomLimits(int minimum_percent,
int maximum_percent,
bool remember) {
- delegate_->UpdateZoomLimits(minimum_percent, maximum_percent, remember);
+ if (!is_swapped_out_)
+ delegate_->UpdateZoomLimits(minimum_percent, maximum_percent, remember);
}
void RenderViewHost::OnScriptEvalResponse(int id, const ListValue& result) {
@@ -1552,6 +1697,9 @@ void RenderViewHost::OnScriptEvalResponse(int id, const ListValue& result) {
NOTREACHED() << "Got bad arguments for OnScriptEvalResponse";
return;
}
+ if (is_swapped_out_)
+ return;
+
std::pair<int, Value*> details(id, result_value);
NotificationService::current()->Notify(
NotificationType::EXECUTE_JAVASCRIPT_RESULT,
@@ -1563,7 +1711,7 @@ void RenderViewHost::OnScriptEvalResponse(int id, const ListValue& result) {
void RenderViewHost::OnMsgShowPopup(
const ViewHostMsg_ShowPopup_Params& params) {
RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
- if (view) {
+ if (view && !is_swapped_out_) {
view->ShowPopupMenu(params.bounds,
params.item_height,
params.item_font_size,

Powered by Google App Engine
This is Rietveld 408576698