Index: content/browser/frame_host/navigation_request.cc |
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc |
index fb46ae59b3d9c10ad87d021dd60dd5010efb342f..c968d5732b7c400e4f0646cf119854dc8155b9c2 100644 |
--- a/content/browser/frame_host/navigation_request.cc |
+++ b/content/browser/frame_host/navigation_request.cc |
@@ -21,17 +21,33 @@ void OnBeginNavigation(const NavigationRequestInfo& info, |
info, request_body, frame_node_id); |
} |
+void OnDestructNavigationRequest(int64 navigation_request_id, |
+ int64 frame_node_id) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
+ ResourceDispatcherHostImpl::Get()->CancelNavigationRequest( |
+ navigation_request_id, frame_node_id); |
+} |
+ |
} // namespace |
+int64 NavigationRequest::next_navigation_request_id_ = 1; |
clamy
2014/08/14 13:19:06
This should be changed to 0 as we use pre-incremen
carlosk
2014/08/14 17:07:10
Done.
|
+ |
NavigationRequest::NavigationRequest(const NavigationRequestInfo& info, |
int64 frame_node_id) |
- : info_(info), |
+ : navigation_request_id_(next_navigation_request_id_++), |
clamy
2014/08/14 13:19:06
The styleguide mandates using ++next_navigation_re
carlosk
2014/08/14 17:07:10
Done.
|
+ info_(info), |
frame_node_id_(frame_node_id) { |
} |
NavigationRequest::~NavigationRequest() { |
- // TODO(clamy): Cancel the corresponding request in ResourceDispatcherHost if |
- // it has not commited yet. |
+ // TODO(carlosk): Figure out when the navigation actually needs to be |
+ // cancelled. |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ BrowserThread::PostTask( |
+ BrowserThread::IO, |
+ FROM_HERE, |
+ base::Bind(&OnDestructNavigationRequest, |
+ navigation_request_id_, frame_node_id_)); |
} |
void NavigationRequest::BeginNavigation( |