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

Side by Side Diff: content/browser/frame_host/navigation_handle_impl.cc

Issue 1759123002: Ensure RenderFrameHost & NavigationHandle are not destroyed during commit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "content/browser/frame_host/navigation_handle_impl.h" 5 #include "content/browser/frame_host/navigation_handle_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "content/browser/frame_host/frame_tree_node.h" 9 #include "content/browser/frame_host/frame_tree_node.h"
10 #include "content/browser/frame_host/navigator.h" 10 #include "content/browser/frame_host/navigator.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 render_frame_host_(nullptr), 58 render_frame_host_(nullptr),
59 is_same_page_(false), 59 is_same_page_(false),
60 is_synchronous_(is_synchronous), 60 is_synchronous_(is_synchronous),
61 is_srcdoc_(is_srcdoc), 61 is_srcdoc_(is_srcdoc),
62 was_redirected_(false), 62 was_redirected_(false),
63 state_(INITIAL), 63 state_(INITIAL),
64 is_transferring_(false), 64 is_transferring_(false),
65 frame_tree_node_(frame_tree_node), 65 frame_tree_node_(frame_tree_node),
66 next_index_(0), 66 next_index_(0),
67 navigation_start_(navigation_start), 67 navigation_start_(navigation_start),
68 pending_nav_entry_id_(pending_nav_entry_id) { 68 pending_nav_entry_id_(pending_nav_entry_id),
69 is_in_commit_(false) {
69 DCHECK(!navigation_start.is_null()); 70 DCHECK(!navigation_start.is_null());
70 GetDelegate()->DidStartNavigation(this); 71 GetDelegate()->DidStartNavigation(this);
71 } 72 }
72 73
73 NavigationHandleImpl::~NavigationHandleImpl() { 74 NavigationHandleImpl::~NavigationHandleImpl() {
74 GetDelegate()->DidFinishNavigation(this); 75 GetDelegate()->DidFinishNavigation(this);
75 76
77 CHECK(!is_in_commit_);
78
76 // Cancel the navigation on the IO thread if the NavigationHandle is being 79 // Cancel the navigation on the IO thread if the NavigationHandle is being
77 // destroyed in the middle of the NavigationThrottles checks. 80 // destroyed in the middle of the NavigationThrottles checks.
78 if (!IsBrowserSideNavigationEnabled() && !complete_callback_.is_null()) 81 if (!IsBrowserSideNavigationEnabled() && !complete_callback_.is_null())
79 RunCompleteCallback(NavigationThrottle::CANCEL_AND_IGNORE); 82 RunCompleteCallback(NavigationThrottle::CANCEL_AND_IGNORE);
80 } 83 }
81 84
82 NavigatorDelegate* NavigationHandleImpl::GetDelegate() const { 85 NavigatorDelegate* NavigationHandleImpl::GetDelegate() const {
83 return frame_tree_node_->navigator()->GetDelegate(); 86 return frame_tree_node_->navigator()->GetDelegate();
84 } 87 }
85 88
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 complete_callback_.Reset(); 487 complete_callback_.Reset();
485 488
486 if (!callback.is_null()) 489 if (!callback.is_null())
487 callback.Run(result); 490 callback.Run(result);
488 491
489 // No code after running the callback, as it might have resulted in our 492 // No code after running the callback, as it might have resulted in our
490 // destruction. 493 // destruction.
491 } 494 }
492 495
493 } // namespace content 496 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698