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

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

Issue 15682009: Eliminate SwapOut message parameters, keeping state in RVHM instead. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to get Android build fix Created 7 years, 6 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 | 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // Whether this RenderViewHost has been swapped out to be displayed by a 287 // Whether this RenderViewHost has been swapped out to be displayed by a
288 // different process. 288 // different process.
289 bool is_swapped_out() const { return is_swapped_out_; } 289 bool is_swapped_out() const { return is_swapped_out_; }
290 290
291 // Tells the renderer that this RenderView is being swapped out for one in a 291 // Tells the renderer that this RenderView is being swapped out for one in a
292 // different renderer process. It should run its unload handler and move to 292 // different renderer process. It should run its unload handler and move to
293 // a blank document. The renderer should preserve the Frame object until it 293 // a blank document. The renderer should preserve the Frame object until it
294 // exits, in case we come back. The renderer can exit if it has no other 294 // exits, in case we come back. The renderer can exit if it has no other
295 // active RenderViews, but not until WasSwappedOut is called (when it is no 295 // active RenderViews, but not until WasSwappedOut is called (when it is no
296 // longer visible). 296 // longer visible).
297 // 297 void SwapOut();
298 // Please see ViewMsg_SwapOut_Params in view_messages.h for a description
299 // of the parameters.
300 void SwapOut(int new_render_process_host_id, int new_request_id);
301 298
302 // Called by ResourceDispatcherHost after the SwapOutACK is received or the 299 // Called when either the SwapOut request has been acknowledged or has timed
303 // response times out. 300 // out.
304 void OnSwapOutACK(bool timed_out); 301 void OnSwappedOut(bool timed_out);
305 302
306 // Called to notify the renderer that it has been visibly swapped out and 303 // Called to notify the renderer that it has been visibly swapped out and
307 // replaced by another RenderViewHost, after an earlier call to SwapOut. 304 // replaced by another RenderViewHost, after an earlier call to SwapOut.
308 // It is now safe for the process to exit if there are no other active 305 // It is now safe for the process to exit if there are no other active
309 // RenderViews. 306 // RenderViews.
310 void WasSwappedOut(); 307 void WasSwappedOut();
311 308
312 // Close the page ignoring whether it has unload events registers. 309 // Close the page ignoring whether it has unload events registers.
313 // This is called after the beforeunload and unload events have fired 310 // This is called after the beforeunload and unload events have fired
314 // and the user has agreed to continue with closing the page. 311 // and the user has agreed to continue with closing the page.
315 void ClosePageIgnoringUnloadEvents(); 312 void ClosePageIgnoringUnloadEvents();
316 313
314 // Returns whether this RenderViewHost has an outstanding cross-site request.
315 // Cleared when we hear the response and start to swap out the old
316 // RenderViewHost, or if we hear a commit here without a network request.
317 bool HasPendingCrossSiteRequest();
318
317 // Sets whether this RenderViewHost has an outstanding cross-site request, 319 // Sets whether this RenderViewHost has an outstanding cross-site request,
318 // for which another renderer will need to run an onunload event handler. 320 // for which another renderer will need to run an onunload event handler.
319 // This is called before the first navigation event for this RenderViewHost, 321 // This is called before the first navigation event for this RenderViewHost,
320 // and again after the corresponding OnCrossSiteResponse. 322 // and cleared when we hear the response or commit.
321 void SetHasPendingCrossSiteRequest(bool has_pending_request, int request_id); 323 void SetHasPendingCrossSiteRequest(bool has_pending_request);
322
323 // Returns the request_id for the pending cross-site request.
324 // This is just needed in case the unload of the current page
325 // hangs, in which case we need to swap to the pending RenderViewHost.
326 int GetPendingRequestId();
327 324
328 // Notifies the RenderView that the JavaScript message that was shown was 325 // Notifies the RenderView that the JavaScript message that was shown was
329 // closed by the user. 326 // closed by the user.
330 void JavaScriptDialogClosed(IPC::Message* reply_msg, 327 void JavaScriptDialogClosed(IPC::Message* reply_msg,
331 bool success, 328 bool success,
332 const string16& user_input); 329 const string16& user_input);
333 330
334 // Tells the renderer view to focus the first (last if reverse is true) node. 331 // Tells the renderer view to focus the first (last if reverse is true) node.
335 void SetInitialFocus(bool reverse); 332 void SetInitialFocus(bool reverse);
336 333
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 } 422 }
426 423
427 // Set accessibility callbacks. 424 // Set accessibility callbacks.
428 void SetAccessibilityLayoutCompleteCallbackForTesting( 425 void SetAccessibilityLayoutCompleteCallbackForTesting(
429 const base::Closure& callback); 426 const base::Closure& callback);
430 void SetAccessibilityLoadCompleteCallbackForTesting( 427 void SetAccessibilityLoadCompleteCallbackForTesting(
431 const base::Closure& callback); 428 const base::Closure& callback);
432 void SetAccessibilityOtherCallbackForTesting( 429 void SetAccessibilityOtherCallbackForTesting(
433 const base::Closure& callback); 430 const base::Closure& callback);
434 431
435 bool is_waiting_for_unload_ack_for_testing() { 432 bool is_waiting_for_beforeunload_ack() {
433 return is_waiting_for_beforeunload_ack_;
434 }
435
436 bool is_waiting_for_unload_ack() {
436 return is_waiting_for_unload_ack_; 437 return is_waiting_for_unload_ack_;
437 } 438 }
438 439
439 // Returns whether the given URL is allowed to commit in the current process. 440 // Returns whether the given URL is allowed to commit in the current process.
440 // This is a more conservative check than FilterURL, since it will be used to 441 // This is a more conservative check than FilterURL, since it will be used to
441 // kill processes that commit unauthorized URLs. 442 // kill processes that commit unauthorized URLs.
442 bool CanCommitURL(const GURL& url); 443 bool CanCommitURL(const GURL& url);
443 444
444 // Checks that the given renderer can request |url|, if not it sets it to 445 // Checks that the given renderer can request |url|, if not it sets it to
445 // about:blank. 446 // about:blank.
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 const string16& message, 548 const string16& message,
548 int32 line_no, 549 int32 line_no,
549 const string16& source_id); 550 const string16& source_id);
550 void OnUpdateInspectorSetting(const std::string& key, 551 void OnUpdateInspectorSetting(const std::string& key,
551 const std::string& value); 552 const std::string& value);
552 void OnShouldCloseACK( 553 void OnShouldCloseACK(
553 bool proceed, 554 bool proceed,
554 const base::TimeTicks& renderer_before_unload_start_time, 555 const base::TimeTicks& renderer_before_unload_start_time,
555 const base::TimeTicks& renderer_before_unload_end_time); 556 const base::TimeTicks& renderer_before_unload_end_time);
556 void OnClosePageACK(); 557 void OnClosePageACK();
558 void OnSwapOutACK();
557 void OnAccessibilityNotifications( 559 void OnAccessibilityNotifications(
558 const std::vector<AccessibilityHostMsg_NotificationParams>& params); 560 const std::vector<AccessibilityHostMsg_NotificationParams>& params);
559 void OnScriptEvalResponse(int id, const base::ListValue& result); 561 void OnScriptEvalResponse(int id, const base::ListValue& result);
560 void OnDidZoomURL(double zoom_level, bool remember, const GURL& url); 562 void OnDidZoomURL(double zoom_level, bool remember, const GURL& url);
561 void OnMediaNotification(int64 player_cookie, 563 void OnMediaNotification(int64 player_cookie,
562 bool has_video, 564 bool has_video,
563 bool has_audio, 565 bool has_audio,
564 bool is_playing); 566 bool is_playing);
565 void OnRequestDesktopNotificationPermission(const GURL& origin, 567 void OnRequestDesktopNotificationPermission(const GURL& origin,
566 int callback_id); 568 int callback_id);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 scoped_refptr<SiteInstanceImpl> instance_; 606 scoped_refptr<SiteInstanceImpl> instance_;
605 607
606 // true if we are currently waiting for a response for drag context 608 // true if we are currently waiting for a response for drag context
607 // information. 609 // information.
608 bool waiting_for_drag_context_response_; 610 bool waiting_for_drag_context_response_;
609 611
610 // A bitwise OR of bindings types that have been enabled for this RenderView. 612 // A bitwise OR of bindings types that have been enabled for this RenderView.
611 // See BindingsPolicy for details. 613 // See BindingsPolicy for details.
612 int enabled_bindings_; 614 int enabled_bindings_;
613 615
614 // The request_id for the pending cross-site request. Set to -1 if
615 // there is a pending request, but we have not yet started the unload
616 // for the current page. Set to the request_id value of the pending
617 // request once we have gotten the some data for the pending page
618 // and thus started the unload process.
619 int pending_request_id_;
620
621 // Whether we should buffer outgoing Navigate messages rather than sending 616 // Whether we should buffer outgoing Navigate messages rather than sending
622 // them. This will be true when a RenderViewHost is created for a cross-site 617 // them. This will be true when a RenderViewHost is created for a cross-site
623 // request, until we hear back from the onbeforeunload handler of the old 618 // request, until we hear back from the onbeforeunload handler of the old
624 // RenderViewHost. 619 // RenderViewHost.
625 bool navigations_suspended_; 620 bool navigations_suspended_;
626 621
627 // We only buffer the params for a suspended navigation while we have a 622 // We only buffer the params for a suspended navigation while we have a
628 // pending RVH for a WebContentsImpl. There will only ever be one suspended 623 // pending RVH for a WebContentsImpl. There will only ever be one suspended
629 // navigation, because WebContentsImpl will destroy the pending RVH and create 624 // navigation, because WebContentsImpl will destroy the pending RVH and create
630 // a new one if a second navigation occurs. 625 // a new one if a second navigation occurs.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImpl); 717 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImpl);
723 }; 718 };
724 719
725 #if defined(COMPILER_MSVC) 720 #if defined(COMPILER_MSVC)
726 #pragma warning(pop) 721 #pragma warning(pop)
727 #endif 722 #endif
728 723
729 } // namespace content 724 } // namespace content
730 725
731 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ 726 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_delegate.h ('k') | content/browser/renderer_host/render_view_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698