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

Unified Diff: content/common/resource_dispatcher.cc

Issue 7601011: Fix resource loads dropped when iframe is transferred to a new window and original window closes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix crash in tests (RenderThread::current() is NULL) Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/resource_dispatcher.h ('k') | content/common/resource_dispatcher_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/resource_dispatcher.cc
diff --git a/content/common/resource_dispatcher.cc b/content/common/resource_dispatcher.cc
index c16d92f9da976cacab335e8f252e2dccace01e41..d6f6c0da539a5a81f6412e12949be3a7f88c0c64 100644
--- a/content/common/resource_dispatcher.cc
+++ b/content/common/resource_dispatcher.cc
@@ -68,6 +68,10 @@ class IPCResourceLoaderBridge : public ResourceLoaderBridge {
// ID for the request, valid once Start()ed, -1 if not valid yet.
int request_id_;
+ // For some requests, WebKit assigns an identifier which is used in certain
+ // callbacks. Example: when a loading resource is transferred between pages.
+ int webkit_request_identifier_;
+
// The routing id used when sending IPC messages.
int routing_id_;
};
@@ -78,6 +82,7 @@ IPCResourceLoaderBridge::IPCResourceLoaderBridge(
: peer_(NULL),
dispatcher_(dispatcher),
request_id_(-1),
+ webkit_request_identifier_(request_info.identifier),
routing_id_(request_info.routing_id) {
DCHECK(dispatcher_) << "no resource dispatcher";
request_.method = request_info.method;
@@ -162,7 +167,7 @@ bool IPCResourceLoaderBridge::Start(Peer* peer) {
// generate the request ID, and append it to the message
request_id_ = dispatcher_->AddPendingRequest(
- peer_, request_.resource_type, request_.url);
+ webkit_request_identifier_, peer_, request_.resource_type, request_.url);
return dispatcher_->message_sender()->Send(
new ResourceHostMsg_RequestResource(routing_id_, request_id_, request_));
@@ -434,13 +439,17 @@ void ResourceDispatcher::OnRequestComplete(int request_id,
}
int ResourceDispatcher::AddPendingRequest(
+ int webkit_request_id,
webkit_glue::ResourceLoaderBridge::Peer* callback,
ResourceType::Type resource_type,
const GURL& request_url) {
// Compute a unique request_id for this renderer process.
int id = MakeRequestID();
pending_requests_[id] =
- PendingRequestInfo(callback, resource_type, request_url);
+ PendingRequestInfo(webkit_request_id,
+ callback,
+ resource_type,
+ request_url);
return id;
}
@@ -472,6 +481,21 @@ void ResourceDispatcher::CancelPendingRequest(int routing_id,
new ResourceHostMsg_CancelRequest(routing_id, request_id));
}
+void ResourceDispatcher::TransferRequestToNewPage(int webkit_identifier,
+ int new_routing_id) {
+ DCHECK(webkit_identifier > 0) << "Attempt to transfer request w/o identifier";
+ for(PendingRequestList::iterator it = pending_requests_.begin();
+ it != pending_requests_.end(); ++it) {
+ PendingRequestInfo& request_info = it->second;
+ if (request_info.webkit_request_id == webkit_identifier) {
+ int request_id = it->first;
+ message_sender()->Send(
+ new ResourceHostMsg_TransferRequestToNewPage(new_routing_id,
+ request_id));
+ }
+ }
+}
+
void ResourceDispatcher::SetDefersLoading(int request_id, bool value) {
PendingRequestList::iterator it = pending_requests_.find(request_id);
if (it == pending_requests_.end()) {
« no previous file with comments | « content/common/resource_dispatcher.h ('k') | content/common/resource_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698