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

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

Issue 301753002: Revert 241291 (Fix a leak in ResourceDispatcher on cancel). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 return true; 581 return true;
582 } 582 }
583 583
584 void ResourceDispatcher::CancelPendingRequest(int request_id) { 584 void ResourceDispatcher::CancelPendingRequest(int request_id) {
585 PendingRequestList::iterator it = pending_requests_.find(request_id); 585 PendingRequestList::iterator it = pending_requests_.find(request_id);
586 if (it == pending_requests_.end()) { 586 if (it == pending_requests_.end()) {
587 DVLOG(1) << "unknown request"; 587 DVLOG(1) << "unknown request";
588 return; 588 return;
589 } 589 }
590 590
591 // |request_id| will be removed from |pending_requests_| when 591 PendingRequestInfo& request_info = it->second;
592 // OnRequestComplete returns with ERR_ABORTED. 592 ReleaseResourcesInMessageQueue(&request_info.deferred_message_queue);
593 pending_requests_.erase(it);
594
593 message_sender()->Send(new ResourceHostMsg_CancelRequest(request_id)); 595 message_sender()->Send(new ResourceHostMsg_CancelRequest(request_id));
594 } 596 }
595 597
596 void ResourceDispatcher::SetDefersLoading(int request_id, bool value) { 598 void ResourceDispatcher::SetDefersLoading(int request_id, bool value) {
597 PendingRequestList::iterator it = pending_requests_.find(request_id); 599 PendingRequestList::iterator it = pending_requests_.find(request_id);
598 if (it == pending_requests_.end()) { 600 if (it == pending_requests_.end()) {
599 DLOG(ERROR) << "unknown request"; 601 DLOG(ERROR) << "unknown request";
600 return; 602 return;
601 } 603 }
602 PendingRequestInfo& request_info = it->second; 604 PendingRequestInfo& request_info = it->second;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { 810 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) {
809 while (!queue->empty()) { 811 while (!queue->empty()) {
810 IPC::Message* message = queue->front(); 812 IPC::Message* message = queue->front();
811 ReleaseResourcesInDataMessage(*message); 813 ReleaseResourcesInDataMessage(*message);
812 queue->pop_front(); 814 queue->pop_front();
813 delete message; 815 delete message;
814 } 816 }
815 } 817 }
816 818
817 } // namespace content 819 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698