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

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

Issue 1931793002: Stop using nested message loop for alert() and other JS dialogs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2111 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 return; 2122 return;
2123 } 2123 }
2124 2124
2125 Send(new FrameHostMsg_TextSurroundingSelectionResponse( 2125 Send(new FrameHostMsg_TextSurroundingSelectionResponse(
2126 routing_id_, 2126 routing_id_,
2127 surroundingText.textContent(), 2127 surroundingText.textContent(),
2128 surroundingText.startOffsetInTextContent(), 2128 surroundingText.startOffsetInTextContent(),
2129 surroundingText.endOffsetInTextContent())); 2129 surroundingText.endOffsetInTextContent()));
2130 } 2130 }
2131 2131
2132 bool RenderFrameImpl::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) { 2132 bool RenderFrameImpl::SendSyncMessage(IPC::SyncMessage* message) {
2133 // Before Blink asks us to show an alert (etc.), it takes care of doing the 2133 // Before Blink asks us to show an alert (etc.), it takes care of doing the
2134 // equivalent of WebView::willEnterModalLoop. In this case it is particularly 2134 // equivalent of WebView::willEnterModalLoop. In this case it is particularly
aelias_OOO_until_Jul13 2016/04/29 05:50:38 Could you track down what this "equivalent" is and
Changwan Ryu 2016/04/29 08:44:13 Currently, FlashMessageLoop and PrintWebViewHelper
2135 // important that we do not call willEnterModalLoop as that would defer 2135 // important that we do not call willEnterModalLoop as that would defer
2136 // resource loads for the dialog itself. 2136 // resource loads for the dialog itself.
2137 if (RenderThreadImpl::current()) // Will be NULL during unit tests. 2137 if (RenderThreadImpl::current()) // Will be NULL during unit tests.
2138 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop(); 2138 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop();
aelias_OOO_until_Jul13 2016/04/29 05:50:38 This is now unneeded, and there is some more code
Changwan Ryu 2016/04/29 08:44:13 Removed notify_webkit_of_modal_loop and related fu
2139 2139
2140 message->EnableMessagePumping(); // Runs a nested message loop.
2141 return Send(message); 2140 return Send(message);
2142 } 2141 }
2143 2142
2144 bool RenderFrameImpl::RunJavaScriptMessage(JavaScriptMessageType type, 2143 bool RenderFrameImpl::RunJavaScriptMessage(JavaScriptMessageType type,
2145 const base::string16& message, 2144 const base::string16& message,
2146 const base::string16& default_value, 2145 const base::string16& default_value,
2147 const GURL& frame_url, 2146 const GURL& frame_url,
2148 base::string16* result) { 2147 base::string16* result) {
2149 // Don't allow further dialogs if we are waiting to swap out, since the 2148 // Don't allow further dialogs if we are waiting to swap out, since the
2150 // ScopedPageLoadDeferrer in our stack prevents it. 2149 // ScopedPageLoadDeferrer in our stack prevents it.
2151 if (suppress_further_dialogs_) 2150 if (suppress_further_dialogs_)
2152 return false; 2151 return false;
2153 2152
2154 bool success = false; 2153 bool success = false;
2155 base::string16 result_temp; 2154 base::string16 result_temp;
2156 if (!result) 2155 if (!result)
2157 result = &result_temp; 2156 result = &result_temp;
2158 2157
2159 SendAndRunNestedMessageLoop(new FrameHostMsg_RunJavaScriptMessage( 2158 SendSyncMessage(new FrameHostMsg_RunJavaScriptMessage(
2160 routing_id_, message, default_value, frame_url, type, &success, result)); 2159 routing_id_, message, default_value, frame_url, type, &success, result));
2161 return success; 2160 return success;
2162 } 2161 }
2163 2162
2164 void RenderFrameImpl::LoadNavigationErrorPage( 2163 void RenderFrameImpl::LoadNavigationErrorPage(
2165 const WebURLRequest& failed_request, 2164 const WebURLRequest& failed_request,
2166 const WebURLError& error, 2165 const WebURLError& error,
2167 bool replace) { 2166 bool replace) {
2168 std::string error_html; 2167 std::string error_html;
2169 GetContentClient()->renderer()->GetNavigationErrorStrings( 2168 GetContentClient()->renderer()->GetNavigationErrorStrings(
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after
3628 bool RenderFrameImpl::runModalBeforeUnloadDialog(bool is_reload) { 3627 bool RenderFrameImpl::runModalBeforeUnloadDialog(bool is_reload) {
3629 // Don't allow further dialogs if we are waiting to swap out, since the 3628 // Don't allow further dialogs if we are waiting to swap out, since the
3630 // ScopedPageLoadDeferrer in our stack prevents it. 3629 // ScopedPageLoadDeferrer in our stack prevents it.
3631 if (suppress_further_dialogs_) 3630 if (suppress_further_dialogs_)
3632 return false; 3631 return false;
3633 3632
3634 bool success = false; 3633 bool success = false;
3635 // This is an ignored return value, but is included so we can accept the same 3634 // This is an ignored return value, but is included so we can accept the same
3636 // response as RunJavaScriptMessage. 3635 // response as RunJavaScriptMessage.
3637 base::string16 ignored_result; 3636 base::string16 ignored_result;
3638 SendAndRunNestedMessageLoop(new FrameHostMsg_RunBeforeUnloadConfirm( 3637 SendSyncMessage(new FrameHostMsg_RunBeforeUnloadConfirm(
3639 routing_id_, frame_->document().url(), is_reload, &success, 3638 routing_id_, frame_->document().url(), is_reload, &success,
3640 &ignored_result)); 3639 &ignored_result));
3641 return success; 3640 return success;
3642 } 3641 }
3643 3642
3644 void RenderFrameImpl::showContextMenu(const blink::WebContextMenuData& data) { 3643 void RenderFrameImpl::showContextMenu(const blink::WebContextMenuData& data) {
3645 ContextMenuParams params = ContextMenuParamsBuilder::Build(data); 3644 ContextMenuParams params = ContextMenuParamsBuilder::Build(data);
3646 blink::WebRect position_in_window(params.x, params.y, 0, 0); 3645 blink::WebRect position_in_window(params.x, params.y, 0, 0);
3647 GetRenderWidget()->convertViewportToWindow(&position_in_window); 3646 GetRenderWidget()->convertViewportToWindow(&position_in_window);
3648 params.x = position_in_window.x; 3647 params.x = position_in_window.x;
(...skipping 2387 matching lines...) Expand 10 before | Expand all | Expand 10 after
6036 int match_count, 6035 int match_count,
6037 int ordinal, 6036 int ordinal,
6038 const WebRect& selection_rect, 6037 const WebRect& selection_rect,
6039 bool final_status_update) { 6038 bool final_status_update) {
6040 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6039 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6041 selection_rect, ordinal, 6040 selection_rect, ordinal,
6042 final_status_update)); 6041 final_status_update));
6043 } 6042 }
6044 6043
6045 } // namespace content 6044 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698