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

Side by Side Diff: content/child/resource_dispatcher.cc

Issue 2303733004: Eliminate spurious request cancelations (Closed)
Patch Set: Fixed dispatcher unit test Created 4 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/child/resource_dispatcher.h" 7 #include "content/child/resource_dispatcher.h"
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 if (should_dump) { 482 if (should_dump) {
483 char url_copy[256] = {0}; 483 char url_copy[256] = {0};
484 strncpy(url_copy, info.response_url.spec().c_str(), 484 strncpy(url_copy, info.response_url.spec().c_str(),
485 sizeof(url_copy)); 485 sizeof(url_copy));
486 base::debug::Alias(&url_copy); 486 base::debug::Alias(&url_copy);
487 base::debug::Alias(&request_time); 487 base::debug::Alias(&request_time);
488 base::debug::DumpWithoutCrashing(); 488 base::debug::DumpWithoutCrashing();
489 should_dump = false; 489 should_dump = false;
490 } 490 }
491 } 491 }
492 // Cancel the request, and clean it up so the bridge will receive no more 492 // Cancel the request if it didn't complete, and clean it up so the bridge
493 // messages. 493 // will receive no more messages.
494 message_sender_->Send(new ResourceHostMsg_CancelRequest(request_id)); 494 if (info.completion_time.is_null())
495 message_sender_->Send(new ResourceHostMsg_CancelRequest(request_id));
495 RemovePendingRequest(request_id); 496 RemovePendingRequest(request_id);
496 } 497 }
497 498
498 void ResourceDispatcher::SetDefersLoading(int request_id, bool value) { 499 void ResourceDispatcher::SetDefersLoading(int request_id, bool value) {
499 PendingRequestMap::iterator it = pending_requests_.find(request_id); 500 PendingRequestMap::iterator it = pending_requests_.find(request_id);
500 if (it == pending_requests_.end()) { 501 if (it == pending_requests_.end()) {
501 DLOG(ERROR) << "unknown request"; 502 DLOG(ERROR) << "unknown request";
502 return; 503 return;
503 } 504 }
504 PendingRequestInfo* request_info = it->second.get(); 505 PendingRequestInfo* request_info = it->second.get();
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 *frame_origin = extra_data->frame_origin(); 875 *frame_origin = extra_data->frame_origin();
875 return request; 876 return request;
876 } 877 }
877 878
878 void ResourceDispatcher::SetResourceSchedulingFilter( 879 void ResourceDispatcher::SetResourceSchedulingFilter(
879 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { 880 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) {
880 resource_scheduling_filter_ = resource_scheduling_filter; 881 resource_scheduling_filter_ = resource_scheduling_filter;
881 } 882 }
882 883
883 } // namespace content 884 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.cc ('k') | content/child/resource_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698