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

Side by Side Diff: content/browser/renderer_host/render_view_host_impl.h

Issue 88503002: Have the unload event execute in background on cross-site navigations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Keeping the old rvh alive for up to 1s Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 // page, making it unsafe to show the pending URL. Always false after the 288 // page, making it unsafe to show the pending URL. Always false after the
289 // first commit. 289 // first commit.
290 bool has_accessed_initial_document() { 290 bool has_accessed_initial_document() {
291 return has_accessed_initial_document_; 291 return has_accessed_initial_document_;
292 } 292 }
293 293
294 // Whether this RenderViewHost has been swapped out to be displayed by a 294 // Whether this RenderViewHost has been swapped out to be displayed by a
295 // different process. 295 // different process.
296 bool is_swapped_out() const { return is_swapped_out_; } 296 bool is_swapped_out() const { return is_swapped_out_; }
297 297
298 // Whether this RenderViewHost is waiting for the execution of the unload in
299 // the background, and should not be destroyed on SwapOut, even if it was the
300 // last active in the SiteInstance.
301 bool should_be_preserved_on_swap_out() const {
Charlie Reis 2013/12/09 20:12:29 I don't think we need these.
302 return should_be_preserved_on_swap_out_;
303 }
304
305 // Whether this RenderViewHostImpl needs to perform additional cleanup before
306 // being deleted. This is the case if the renderer was left to execute the
307 // unload event in the background.
308 bool need_to_perform_clean_up_on_swapped_out() const {
309 return need_to_perform_clean_up_on_swapped_out_;
310 }
311
298 // Called on the pending RenderViewHost when the network response is ready to 312 // Called on the pending RenderViewHost when the network response is ready to
299 // commit. We should ensure that the old RenderViewHost runs its unload 313 // commit. We should ensure that the old RenderViewHost runs its unload
300 // handler and determine whether a transfer to a different RenderViewHost is 314 // handler and determine whether a transfer to a different RenderViewHost is
301 // needed. 315 // needed.
302 void OnCrossSiteResponse( 316 void OnCrossSiteResponse(
303 const GlobalRequestID& global_request_id, 317 const GlobalRequestID& global_request_id,
304 bool is_transfer, 318 bool is_transfer,
305 const std::vector<GURL>& transfer_url_chain, 319 const std::vector<GURL>& transfer_url_chain,
306 const Referrer& referrer, 320 const Referrer& referrer,
307 PageTransition page_transition, 321 PageTransition page_transition,
308 int64 frame_id, 322 int64 frame_id,
309 bool should_replace_current_entry); 323 bool should_replace_current_entry);
310 324
311 // Tells the renderer that this RenderView will soon be swapped out, and thus 325 // Tells the renderer that this RenderView will soon be swapped out, and thus
312 // not to create any new modal dialogs until it happens. This must be done 326 // not to create any new modal dialogs until it happens. This must be done
313 // separately so that the PageGroupLoadDeferrers of any current dialogs are no 327 // separately so that the PageGroupLoadDeferrers of any current dialogs are no
314 // longer on the stack when we attempt to swap it out. 328 // longer on the stack when we attempt to swap it out.
315 void SuppressDialogsUntilSwapOut(); 329 void SuppressDialogsUntilSwapOut();
316 330
317 // Tells the renderer that this RenderView is being swapped out for one in a 331 // Tells the renderer that this RenderView is being swapped out for one in a
318 // different renderer process. It should run its unload handler and move to 332 // different renderer process. It should run its unload handler and move to
319 // a blank document. The renderer should preserve the Frame object until it 333 // a blank document. The renderer should preserve the Frame object until it
320 // exits, in case we come back. The renderer can exit if it has no other 334 // exits, in case we come back. The renderer can exit if it has no other
321 // active RenderViews, but not until WasSwappedOut is called (when it is no 335 // active RenderViews, but not until WasSwappedOut is called (when it is no
322 // longer visible). 336 // longer visible).
323 void SwapOut(); 337 void SwapOut();
324 338
325 // Called when either the SwapOut request has been acknowledged or has timed 339 // Called when either the SwapOut request has been acknowledged or has timed
326 // out. 340 // out.
327 void OnSwappedOut(bool timed_out); 341 void OnSwappedOut(bool timed_out, bool preserve_render_view_host);
Charlie Reis 2013/12/09 20:12:29 I think we can get rid of this whole method.
328 342
329 // Called to notify the renderer that it has been visibly swapped out and 343 // Called to notify the renderer that it has been visibly swapped out and
330 // replaced by another RenderViewHost, after an earlier call to SwapOut. 344 // replaced by another RenderViewHost, after an earlier call to SwapOut.
331 // It is now safe for the process to exit if there are no other active 345 // It is now safe for the process to exit if there are no other active
332 // RenderViews. 346 // RenderViews.
333 void WasSwappedOut(); 347 void WasSwappedOut();
334 348
335 // Close the page ignoring whether it has unload events registers. 349 // Close the page ignoring whether it has unload events registers.
336 // This is called after the beforeunload and unload events have fired 350 // This is called after the beforeunload and unload events have fired
337 // and the user has agreed to continue with closing the page. 351 // and the user has agreed to continue with closing the page.
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 // ensures we don't spam the renderer with multiple beforeunload requests. 715 // ensures we don't spam the renderer with multiple beforeunload requests.
702 // When either this value or is_waiting_for_unload_ack_ is true, the value of 716 // When either this value or is_waiting_for_unload_ack_ is true, the value of
703 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a 717 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a
704 // cross-site transition or a tab close attempt. 718 // cross-site transition or a tab close attempt.
705 bool is_waiting_for_beforeunload_ack_; 719 bool is_waiting_for_beforeunload_ack_;
706 720
707 // Set to true when there is a pending ViewMsg_Close message. Also see 721 // Set to true when there is a pending ViewMsg_Close message. Also see
708 // is_waiting_for_beforeunload_ack_, unload_ack_is_for_cross_site_transition_. 722 // is_waiting_for_beforeunload_ack_, unload_ack_is_for_cross_site_transition_.
709 bool is_waiting_for_unload_ack_; 723 bool is_waiting_for_unload_ack_;
710 724
725 // Set to true to prevent |this| to be killed when swapping out
726 // RenderViewHosts. This allows the unload handler to be run into background.
727 bool should_be_preserved_on_swap_out_;
728
729 // Set to true to have the renderer perform additional clean up if it had the
730 // unload handler run into the background previously.
731 bool need_to_perform_clean_up_on_swapped_out_;
732
711 // Set to true when waiting for ViewHostMsg_SwapOut_ACK has timed out. 733 // Set to true when waiting for ViewHostMsg_SwapOut_ACK has timed out.
712 bool has_timed_out_on_unload_; 734 bool has_timed_out_on_unload_;
713 735
714 // Valid only when is_waiting_for_beforeunload_ack_ or 736 // Valid only when is_waiting_for_beforeunload_ack_ or
715 // is_waiting_for_unload_ack_ is true. This tells us if the unload request 737 // is_waiting_for_unload_ack_ is true. This tells us if the unload request
716 // is for closing the entire tab ( = false), or only this RenderViewHost in 738 // is for closing the entire tab ( = false), or only this RenderViewHost in
717 // the case of a cross-site transition ( = true). 739 // the case of a cross-site transition ( = true).
718 bool unload_ack_is_for_cross_site_transition_; 740 bool unload_ack_is_for_cross_site_transition_;
719 741
720 bool are_javascript_messages_suppressed_; 742 bool are_javascript_messages_suppressed_;
(...skipping 26 matching lines...) Expand all
747 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImpl); 769 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImpl);
748 }; 770 };
749 771
750 #if defined(COMPILER_MSVC) 772 #if defined(COMPILER_MSVC)
751 #pragma warning(pop) 773 #pragma warning(pop)
752 #endif 774 #endif
753 775
754 } // namespace content 776 } // namespace content
755 777
756 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ 778 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698