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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 1014623002: Revert "Refactor sudden termination" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + fixed compilation error Created 5 years, 9 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/browser/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 delegate_(delegate), 142 delegate_(delegate),
143 site_instance_(static_cast<SiteInstanceImpl*>(site_instance)), 143 site_instance_(static_cast<SiteInstanceImpl*>(site_instance)),
144 process_(site_instance->GetProcess()), 144 process_(site_instance->GetProcess()),
145 cross_process_frame_connector_(NULL), 145 cross_process_frame_connector_(NULL),
146 render_frame_proxy_host_(NULL), 146 render_frame_proxy_host_(NULL),
147 frame_tree_(frame_tree), 147 frame_tree_(frame_tree),
148 frame_tree_node_(frame_tree_node), 148 frame_tree_node_(frame_tree_node),
149 routing_id_(routing_id), 149 routing_id_(routing_id),
150 render_frame_created_(false), 150 render_frame_created_(false),
151 navigations_suspended_(false), 151 navigations_suspended_(false),
152 has_beforeunload_handlers_(false),
153 has_unload_handlers_(false),
154 override_sudden_termination_status_(false),
155 is_waiting_for_beforeunload_ack_(false), 152 is_waiting_for_beforeunload_ack_(false),
156 unload_ack_is_for_navigation_(false), 153 unload_ack_is_for_navigation_(false),
157 is_loading_(false), 154 is_loading_(false),
158 loading_progress_(kLoadingProgressNotStarted), 155 loading_progress_(kLoadingProgressNotStarted),
159 accessibility_reset_token_(0), 156 accessibility_reset_token_(0),
160 accessibility_reset_count_(0), 157 accessibility_reset_count_(0),
161 no_create_browser_accessibility_manager_for_testing_(false), 158 no_create_browser_accessibility_manager_for_testing_(false),
162 weak_ptr_factory_(this) { 159 weak_ptr_factory_(this) {
163 bool is_swapped_out = !!(flags & CREATE_RF_SWAPPED_OUT); 160 bool is_swapped_out = !!(flags & CREATE_RF_SWAPPED_OUT);
164 bool hidden = !!(flags & CREATE_RF_HIDDEN); 161 bool hidden = !!(flags & CREATE_RF_HIDDEN);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 OnDidFailProvisionalLoadWithError) 348 OnDidFailProvisionalLoadWithError)
352 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFailLoadWithError, 349 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFailLoadWithError,
353 OnDidFailLoadWithError) 350 OnDidFailLoadWithError)
354 IPC_MESSAGE_HANDLER_GENERIC(FrameHostMsg_DidCommitProvisionalLoad, 351 IPC_MESSAGE_HANDLER_GENERIC(FrameHostMsg_DidCommitProvisionalLoad,
355 OnDidCommitProvisionalLoad(msg)) 352 OnDidCommitProvisionalLoad(msg))
356 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDropNavigation, OnDidDropNavigation) 353 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDropNavigation, OnDidDropNavigation)
357 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL) 354 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL)
358 IPC_MESSAGE_HANDLER(FrameHostMsg_DocumentOnLoadCompleted, 355 IPC_MESSAGE_HANDLER(FrameHostMsg_DocumentOnLoadCompleted,
359 OnDocumentOnLoadCompleted) 356 OnDocumentOnLoadCompleted)
360 IPC_MESSAGE_HANDLER(FrameHostMsg_BeforeUnload_ACK, OnBeforeUnloadACK) 357 IPC_MESSAGE_HANDLER(FrameHostMsg_BeforeUnload_ACK, OnBeforeUnloadACK)
361 IPC_MESSAGE_HANDLER(FrameHostMsg_BeforeUnloadHandlersPresent,
362 OnBeforeUnloadHandlersPresent)
363 IPC_MESSAGE_HANDLER(FrameHostMsg_UnloadHandlersPresent,
364 OnUnloadHandlersPresent)
365 IPC_MESSAGE_HANDLER(FrameHostMsg_SwapOut_ACK, OnSwapOutACK) 358 IPC_MESSAGE_HANDLER(FrameHostMsg_SwapOut_ACK, OnSwapOutACK)
366 IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu) 359 IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu)
367 IPC_MESSAGE_HANDLER(FrameHostMsg_JavaScriptExecuteResponse, 360 IPC_MESSAGE_HANDLER(FrameHostMsg_JavaScriptExecuteResponse,
368 OnJavaScriptExecuteResponse) 361 OnJavaScriptExecuteResponse)
369 IPC_MESSAGE_HANDLER(FrameHostMsg_VisualStateResponse, 362 IPC_MESSAGE_HANDLER(FrameHostMsg_VisualStateResponse,
370 OnVisualStateResponse) 363 OnVisualStateResponse)
371 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunJavaScriptMessage, 364 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunJavaScriptMessage,
372 OnRunJavaScriptMessage) 365 OnRunJavaScriptMessage)
373 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm, 366 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm,
374 OnRunBeforeUnloadConfirm) 367 OnRunBeforeUnloadConfirm)
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 } 1039 }
1047 return frame_tree_node_->navigator()->IsWaitingForBeforeUnloadACK( 1040 return frame_tree_node_->navigator()->IsWaitingForBeforeUnloadACK(
1048 frame_tree_node_); 1041 frame_tree_node_);
1049 } 1042 }
1050 1043
1051 bool RenderFrameHostImpl::IsWaitingForUnloadACK() const { 1044 bool RenderFrameHostImpl::IsWaitingForUnloadACK() const {
1052 return render_view_host_->is_waiting_for_close_ack_ || 1045 return render_view_host_->is_waiting_for_close_ack_ ||
1053 rfh_state_ == STATE_PENDING_SWAP_OUT; 1046 rfh_state_ == STATE_PENDING_SWAP_OUT;
1054 } 1047 }
1055 1048
1056 bool RenderFrameHostImpl::SuddenTerminationAllowed() const {
1057 return override_sudden_termination_status_ ||
1058 (!has_beforeunload_handlers_ && !has_unload_handlers_);
1059 }
1060
1061 void RenderFrameHostImpl::OnSwapOutACK() { 1049 void RenderFrameHostImpl::OnSwapOutACK() {
1062 OnSwappedOut(); 1050 OnSwappedOut();
1063 } 1051 }
1064 1052
1065 void RenderFrameHostImpl::OnRenderProcessGone(int status, int exit_code) { 1053 void RenderFrameHostImpl::OnRenderProcessGone(int status, int exit_code) {
1066 if (frame_tree_node_->IsMainFrame()) { 1054 if (frame_tree_node_->IsMainFrame()) {
1067 // Keep the termination status so we can get at it later when we 1055 // Keep the termination status so we can get at it later when we
1068 // need to know why it died. 1056 // need to know why it died.
1069 render_view_host_->render_view_termination_status_ = 1057 render_view_host_->render_view_termination_status_ =
1070 static_cast<base::TerminationStatus>(status); 1058 static_cast<base::TerminationStatus>(status);
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 if (enter_fullscreen) 1399 if (enter_fullscreen)
1412 delegate_->EnterFullscreenMode(GetLastCommittedURL().GetOrigin()); 1400 delegate_->EnterFullscreenMode(GetLastCommittedURL().GetOrigin());
1413 else 1401 else
1414 delegate_->ExitFullscreenMode(); 1402 delegate_->ExitFullscreenMode();
1415 1403
1416 // The previous call might change the fullscreen state. We need to make sure 1404 // The previous call might change the fullscreen state. We need to make sure
1417 // the renderer is aware of that, which is done via the resize message. 1405 // the renderer is aware of that, which is done via the resize message.
1418 render_view_host_->WasResized(); 1406 render_view_host_->WasResized();
1419 } 1407 }
1420 1408
1421 void RenderFrameHostImpl::OnBeforeUnloadHandlersPresent(bool present) {
1422 has_beforeunload_handlers_ = present;
1423 }
1424
1425 void RenderFrameHostImpl::OnUnloadHandlersPresent(bool present) {
1426 has_unload_handlers_ = present;
1427 }
1428
1429 #if defined(OS_MACOSX) || defined(OS_ANDROID) 1409 #if defined(OS_MACOSX) || defined(OS_ANDROID)
1430 void RenderFrameHostImpl::OnShowPopup( 1410 void RenderFrameHostImpl::OnShowPopup(
1431 const FrameHostMsg_ShowPopup_Params& params) { 1411 const FrameHostMsg_ShowPopup_Params& params) {
1432 RenderViewHostDelegateView* view = 1412 RenderViewHostDelegateView* view =
1433 render_view_host_->delegate_->GetDelegateView(); 1413 render_view_host_->delegate_->GetDelegateView();
1434 if (view) { 1414 if (view) {
1435 view->ShowPopupMenu(this, 1415 view->ShowPopupMenu(this,
1436 params.bounds, 1416 params.bounds,
1437 params.item_height, 1417 params.item_height,
1438 params.item_font_size, 1418 params.item_font_size,
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
1968 void RenderFrameHostImpl::DidUseGeolocationPermission() { 1948 void RenderFrameHostImpl::DidUseGeolocationPermission() {
1969 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); 1949 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame();
1970 GetContentClient()->browser()->RegisterPermissionUsage( 1950 GetContentClient()->browser()->RegisterPermissionUsage(
1971 PERMISSION_GEOLOCATION, 1951 PERMISSION_GEOLOCATION,
1972 delegate_->GetAsWebContents(), 1952 delegate_->GetAsWebContents(),
1973 GetLastCommittedURL().GetOrigin(), 1953 GetLastCommittedURL().GetOrigin(),
1974 top_frame->GetLastCommittedURL().GetOrigin()); 1954 top_frame->GetLastCommittedURL().GetOrigin());
1975 } 1955 }
1976 1956
1977 } // namespace content 1957 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/renderer_host/render_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698