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

Side by Side Diff: content/browser/frame_host/render_frame_host_manager.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: Rebase + addressed some of Nasko's comments Created 6 years, 11 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 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 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "content/browser/renderer_host/render_view_host_delegate.h" 12 #include "content/browser/renderer_host/render_view_host_delegate.h"
13 #include "content/browser/site_instance_impl.h" 13 #include "content/browser/site_instance_impl.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 #include "content/public/browser/global_request_id.h"
15 #include "content/public/browser/notification_observer.h" 16 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h" 17 #include "content/public/browser/notification_registrar.h"
17 #include "content/public/common/referrer.h" 18 #include "content/public/common/referrer.h"
18 19
19 20
20 namespace content { 21 namespace content {
21 class BrowserContext; 22 class BrowserContext;
22 class CrossProcessFrameConnector; 23 class CrossProcessFrameConnector;
23 class InterstitialPageImpl; 24 class InterstitialPageImpl;
24 class FrameTreeNode; 25 class FrameTreeNode;
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 // SiteInstance, if any. 263 // SiteInstance, if any.
263 RenderViewHostImpl* GetSwappedOutRenderViewHost(SiteInstance* instance) const; 264 RenderViewHostImpl* GetSwappedOutRenderViewHost(SiteInstance* instance) const;
264 RenderFrameHostImpl* GetSwappedOutRenderFrameHost( 265 RenderFrameHostImpl* GetSwappedOutRenderFrameHost(
265 SiteInstance* instance) const; 266 SiteInstance* instance) const;
266 267
267 // Runs the unload handler in the current page, when we know that a pending 268 // Runs the unload handler in the current page, when we know that a pending
268 // cross-process navigation is going to commit. We may initiate a transfer 269 // cross-process navigation is going to commit. We may initiate a transfer
269 // to a new process after this completes or times out. 270 // to a new process after this completes or times out.
270 void SwapOutOldPage(); 271 void SwapOutOldPage();
271 272
273 // Deletes a RenderFrameHost that was pending shutdown.
274 void ClearPendingShutdownRFHForSiteInstance(int32 site_instance_id,
275 RenderFrameHostImpl* rfh);
276
272 private: 277 private:
273 friend class RenderFrameHostManagerTest; 278 friend class RenderFrameHostManagerTest;
274 friend class TestWebContents; 279 friend class TestWebContents;
275 280
276 // Tracks information about a navigation while a cross-process transition is 281 // Tracks information about a navigation while a cross-process transition is
277 // in progress, in case we need to transfer it to a new RenderFrameHost. 282 // in progress, in case we need to transfer it to a new RenderFrameHost.
278 struct PendingNavigationParams { 283 struct PendingNavigationParams {
279 PendingNavigationParams(); 284 PendingNavigationParams();
280 PendingNavigationParams(const GlobalRequestID& global_request_id, 285 PendingNavigationParams(const GlobalRequestID& global_request_id,
281 bool is_transfer, 286 bool is_transfer,
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 // used for when they reference the same object. If either is non-NULL, the 435 // used for when they reference the same object. If either is non-NULL, the
431 // other should be NULL. 436 // other should be NULL.
432 scoped_ptr<WebUIImpl> pending_web_ui_; 437 scoped_ptr<WebUIImpl> pending_web_ui_;
433 base::WeakPtr<WebUIImpl> pending_and_current_web_ui_; 438 base::WeakPtr<WebUIImpl> pending_and_current_web_ui_;
434 439
435 // A map of site instance ID to swapped out RenderFrameHosts. This may 440 // A map of site instance ID to swapped out RenderFrameHosts. This may
436 // include pending_render_frame_host_ for navigations to existing entries. 441 // include pending_render_frame_host_ for navigations to existing entries.
437 typedef base::hash_map<int32, RenderFrameHostImpl*> RenderFrameHostMap; 442 typedef base::hash_map<int32, RenderFrameHostImpl*> RenderFrameHostMap;
438 RenderFrameHostMap swapped_out_hosts_; 443 RenderFrameHostMap swapped_out_hosts_;
439 444
445 // A map of RenderFrameHosts pending shutdown.
446 typedef base::hash_map<int32, linked_ptr<RenderFrameHostImpl> >
447 RFHPendingDeleteMap;
448 RFHPendingDeleteMap pending_delete_hosts_;
449
440 // The intersitial page currently shown if any, not own by this class 450 // The intersitial page currently shown if any, not own by this class
441 // (the InterstitialPage is self-owned, it deletes itself when hidden). 451 // (the InterstitialPage is self-owned, it deletes itself when hidden).
442 InterstitialPageImpl* interstitial_page_; 452 InterstitialPageImpl* interstitial_page_;
443 453
444 NotificationRegistrar registrar_; 454 NotificationRegistrar registrar_;
445 455
446 // When |render_frame_host_| is in a different process from its parent in 456 // When |render_frame_host_| is in a different process from its parent in
447 // the frame tree, this class connects its associated RenderWidgetHostView 457 // the frame tree, this class connects its associated RenderWidgetHostView
448 // to the proxy RenderFrameHost for the parent's renderer process. NULL 458 // to the proxy RenderFrameHost for the parent's renderer process. NULL
449 // when |render_frame_host_| is the frame tree root or is in the same 459 // when |render_frame_host_| is the frame tree root or is in the same
450 // process as its parent. 460 // process as its parent.
451 CrossProcessFrameConnector* cross_process_frame_connector_; 461 CrossProcessFrameConnector* cross_process_frame_connector_;
452 462
463 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_;
464
453 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); 465 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager);
454 }; 466 };
455 467
456 } // namespace content 468 } // namespace content
457 469
458 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ 470 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698