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

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: Added unit tests 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 InterstitialPageImpl; 23 class InterstitialPageImpl;
23 class FrameTreeNode; 24 class FrameTreeNode;
24 class NavigationControllerImpl; 25 class NavigationControllerImpl;
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 // SiteInstance, if any. 260 // SiteInstance, if any.
260 RenderViewHostImpl* GetSwappedOutRenderViewHost(SiteInstance* instance) const; 261 RenderViewHostImpl* GetSwappedOutRenderViewHost(SiteInstance* instance) const;
261 RenderFrameHostImpl* GetSwappedOutRenderFrameHost( 262 RenderFrameHostImpl* GetSwappedOutRenderFrameHost(
262 SiteInstance* instance) const; 263 SiteInstance* instance) const;
263 264
264 // Runs the unload handler in the current page, when we know that a pending 265 // Runs the unload handler in the current page, when we know that a pending
265 // cross-process navigation is going to commit. We may initiate a transfer 266 // cross-process navigation is going to commit. We may initiate a transfer
266 // to a new process after this completes or times out. 267 // to a new process after this completes or times out.
267 void SwapOutOldPage(); 268 void SwapOutOldPage();
268 269
270 // Deletes a RenderFrameHost that was pending shutdown.
271 void ClearPendingShutdownRFHForSiteInstance(int32 site_instance_id,
272 RenderFrameHostImpl* rfh);
273
269 private: 274 private:
270 friend class RenderFrameHostManagerTest; 275 friend class RenderFrameHostManagerTest;
271 friend class TestWebContents; 276 friend class TestWebContents;
272 277
273 // Tracks information about a navigation while a cross-process transition is 278 // Tracks information about a navigation while a cross-process transition is
274 // in progress, in case we need to transfer it to a new RenderFrameHost. 279 // in progress, in case we need to transfer it to a new RenderFrameHost.
275 struct PendingNavigationParams { 280 struct PendingNavigationParams {
276 PendingNavigationParams(); 281 PendingNavigationParams();
277 PendingNavigationParams(const GlobalRequestID& global_request_id, 282 PendingNavigationParams(const GlobalRequestID& global_request_id,
278 bool is_transfer, 283 bool is_transfer,
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 // used for when they reference the same object. If either is non-NULL, the 432 // used for when they reference the same object. If either is non-NULL, the
428 // other should be NULL. 433 // other should be NULL.
429 scoped_ptr<WebUIImpl> pending_web_ui_; 434 scoped_ptr<WebUIImpl> pending_web_ui_;
430 base::WeakPtr<WebUIImpl> pending_and_current_web_ui_; 435 base::WeakPtr<WebUIImpl> pending_and_current_web_ui_;
431 436
432 // A map of site instance ID to swapped out RenderFrameHosts. This may 437 // A map of site instance ID to swapped out RenderFrameHosts. This may
433 // include pending_render_frame_host_ for navigations to existing entries. 438 // include pending_render_frame_host_ for navigations to existing entries.
434 typedef base::hash_map<int32, RenderFrameHostImpl*> RenderFrameHostMap; 439 typedef base::hash_map<int32, RenderFrameHostImpl*> RenderFrameHostMap;
435 RenderFrameHostMap swapped_out_hosts_; 440 RenderFrameHostMap swapped_out_hosts_;
436 441
442 // A map of RenderFrameHosts pending shutdown.
443 typedef base::hash_map<int32, linked_ptr<RenderFrameHostImpl> >
444 RFHPendingDeleteMap;
445 RFHPendingDeleteMap pending_delete_hosts_;
446
437 // The intersitial page currently shown if any, not own by this class 447 // The intersitial page currently shown if any, not own by this class
438 // (the InterstitialPage is self-owned, it deletes itself when hidden). 448 // (the InterstitialPage is self-owned, it deletes itself when hidden).
439 InterstitialPageImpl* interstitial_page_; 449 InterstitialPageImpl* interstitial_page_;
440 450
441 NotificationRegistrar registrar_; 451 NotificationRegistrar registrar_;
442 452
453 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_;
454
443 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); 455 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager);
444 }; 456 };
445 457
446 } // namespace content 458 } // namespace content
447 459
448 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ 460 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698