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

Side by Side Diff: content/browser/frame_host/render_frame_host_manager.h

Issue 143183009: When cross-site navigations are cancelled, delete the request being transferred (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: response to creis's comments Created 6 years, 10 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/global_request_id.h"
16 #include "content/public/browser/notification_observer.h" 16 #include "content/public/browser/notification_observer.h"
17 #include "content/public/browser/notification_registrar.h" 17 #include "content/public/browser/notification_registrar.h"
18 #include "content/public/common/referrer.h" 18 #include "content/public/common/referrer.h"
19 19
20 20
21 namespace content { 21 namespace content {
22 class BrowserContext; 22 class BrowserContext;
23 class CrossProcessFrameConnector; 23 class CrossProcessFrameConnector;
24 class CrossSiteTransferringRequest;
24 class InterstitialPageImpl; 25 class InterstitialPageImpl;
25 class FrameTreeNode; 26 class FrameTreeNode;
26 class NavigationControllerImpl; 27 class NavigationControllerImpl;
27 class NavigationEntry; 28 class NavigationEntry;
28 class NavigationEntryImpl; 29 class NavigationEntryImpl;
29 class RenderFrameHostDelegate; 30 class RenderFrameHostDelegate;
30 class RenderFrameHostImpl; 31 class RenderFrameHostImpl;
31 class RenderFrameHostManagerTest; 32 class RenderFrameHostManagerTest;
32 class RenderViewHost; 33 class RenderViewHost;
33 class RenderViewHostImpl; 34 class RenderViewHostImpl;
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 InterstitialPageImpl* interstitial_page() const { return interstitial_page_; } 233 InterstitialPageImpl* interstitial_page() const { return interstitial_page_; }
233 234
234 // RenderViewHostDelegate::RendererManagement implementation. 235 // RenderViewHostDelegate::RendererManagement implementation.
235 virtual void ShouldClosePage( 236 virtual void ShouldClosePage(
236 bool for_cross_site_transition, 237 bool for_cross_site_transition,
237 bool proceed, 238 bool proceed,
238 const base::TimeTicks& proceed_time) OVERRIDE; 239 const base::TimeTicks& proceed_time) OVERRIDE;
239 virtual void OnCrossSiteResponse( 240 virtual void OnCrossSiteResponse(
240 RenderViewHost* pending_render_view_host, 241 RenderViewHost* pending_render_view_host,
241 const GlobalRequestID& global_request_id, 242 const GlobalRequestID& global_request_id,
242 bool is_transfer, 243 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request,
243 const std::vector<GURL>& transfer_url_chain, 244 const std::vector<GURL>& transfer_url_chain,
244 const Referrer& referrer, 245 const Referrer& referrer,
245 PageTransition page_transition, 246 PageTransition page_transition,
246 int64 frame_id, 247 int64 frame_id,
247 bool should_replace_current_entry) OVERRIDE; 248 bool should_replace_current_entry) OVERRIDE;
248 249
249 // NotificationObserver implementation. 250 // NotificationObserver implementation.
250 virtual void Observe(int type, 251 virtual void Observe(int type,
251 const NotificationSource& source, 252 const NotificationSource& source,
252 const NotificationDetails& details) OVERRIDE; 253 const NotificationDetails& details) OVERRIDE;
(...skipping 20 matching lines...) Expand all
273 // Deletes a RenderFrameHost that was pending shutdown. 274 // Deletes a RenderFrameHost that was pending shutdown.
274 void ClearPendingShutdownRFHForSiteInstance(int32 site_instance_id, 275 void ClearPendingShutdownRFHForSiteInstance(int32 site_instance_id,
275 RenderFrameHostImpl* rfh); 276 RenderFrameHostImpl* rfh);
276 277
277 private: 278 private:
278 friend class RenderFrameHostManagerTest; 279 friend class RenderFrameHostManagerTest;
279 friend class TestWebContents; 280 friend class TestWebContents;
280 281
281 // Tracks information about a navigation while a cross-process transition is 282 // Tracks information about a navigation while a cross-process transition is
282 // in progress, in case we need to transfer it to a new RenderFrameHost. 283 // in progress, in case we need to transfer it to a new RenderFrameHost.
284 // When a request is being transferred, deleting the PendingNavigationParams,
285 // and thus |cross_site_transferring_request|, will cancel the request being
286 // transferred, unless its ReleaseRequest method has been called.
283 struct PendingNavigationParams { 287 struct PendingNavigationParams {
284 PendingNavigationParams(); 288 PendingNavigationParams(
285 PendingNavigationParams(const GlobalRequestID& global_request_id, 289 const GlobalRequestID& global_request_id,
286 bool is_transfer, 290 scoped_ptr<CrossSiteTransferringRequest>
287 const std::vector<GURL>& transfer_url, 291 cross_site_transferring_request,
288 Referrer referrer, 292 const std::vector<GURL>& transfer_url,
289 PageTransition page_transition, 293 Referrer referrer,
290 int64 frame_id, 294 PageTransition page_transition,
291 bool should_replace_current_entry); 295 int64 frame_id,
296 bool should_replace_current_entry);
292 ~PendingNavigationParams(); 297 ~PendingNavigationParams();
293 298
294 // The child ID and request ID for the pending navigation. Present whether 299 // The child ID and request ID for the pending navigation. Present whether
295 // |is_transfer| is true or false. 300 // |request_transfer| is NULL or not.
296 GlobalRequestID global_request_id; 301 GlobalRequestID global_request_id;
297 302
298 // Whether this pending navigation needs to be transferred to another 303 // If a pending request needs to be transferred to another process, this
299 // process than the one it was going to commit in. If so, the 304 // owns the request until it's transferred to the new process, so it will be
300 // |transfer_url|, |referrer|, and |frame_id| parameters will be set. 305 // cleaned up if the navigation is cancelled. Otherwise, this is NULL.
301 bool is_transfer; 306 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request;
302 307
303 // If |is_transfer|, this is the URL chain of the request. The first entry 308 // If |request_transfer| is non-NULL, the values below are all set.
304 // is the original request URL, and the last entry is the destination URL to 309
305 // request in the new process. 310 // The first entry is the original request URL, and the last entry is the
311 // destination URL to request in the new process.
306 std::vector<GURL> transfer_url_chain; 312 std::vector<GURL> transfer_url_chain;
307 313
308 // If |is_transfer|, this is the referrer to use for the request in the new 314 // This is the referrer to use for the request in the new process.
309 // process.
310 Referrer referrer; 315 Referrer referrer;
311 316
312 // If |is_transfer|, this is the transition type for the original 317 // This is the transition type for the original navigation.
313 // navigation.
314 PageTransition page_transition; 318 PageTransition page_transition;
315 319
316 // If |is_transfer|, this is the frame ID to use in RequestTransferURL. 320 // This is the frame ID to use in RequestTransferURL.
317 int64 frame_id; 321 int64 frame_id;
318 322
319 // If |is_transfer|, this is whether the navigation should replace the 323 // This is whether the navigation should replace the current history entry.
320 // current history entry.
321 bool should_replace_current_entry; 324 bool should_replace_current_entry;
322 }; 325 };
323 326
324 // Used with FrameTree::ForEach to erase inactive RenderFrameHosts from a 327 // Used with FrameTree::ForEach to erase inactive RenderFrameHosts from a
325 // FrameTreeNode's RenderFrameHostManager. 328 // FrameTreeNode's RenderFrameHostManager.
326 static bool ClearSwappedOutRFHsInSiteInstance(int32 site_instance_id, 329 static bool ClearSwappedOutRFHsInSiteInstance(int32 site_instance_id,
327 FrameTreeNode* node); 330 FrameTreeNode* node);
328 331
329 // Returns whether this tab should transition to a new renderer for 332 // Returns whether this tab should transition to a new renderer for
330 // cross-site URLs. Enabled unless we see the --process-per-tab command line 333 // cross-site URLs. Enabled unless we see the --process-per-tab command line
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 CrossProcessFrameConnector* cross_process_frame_connector_; 464 CrossProcessFrameConnector* cross_process_frame_connector_;
462 465
463 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; 466 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_;
464 467
465 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); 468 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager);
466 }; 469 };
467 470
468 } // namespace content 471 } // namespace content
469 472
470 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ 473 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698