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

Side by Side Diff: content/browser/loader/stream_resource_handler.cc

Issue 232843003: Fix IOBuffer leak in CertificateResourceHandler and StreamResourceHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | « content/browser/loader/certificate_resource_handler.cc ('k') | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/loader/stream_resource_handler.h" 5 #include "content/browser/loader/stream_resource_handler.h"
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "content/browser/streams/stream.h" 9 #include "content/browser/streams/stream.h"
10 #include "content/browser/streams/stream_registry.h" 10 #include "content/browser/streams/stream_registry.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 int bytes_read, 81 int bytes_read,
82 bool* defer) { 82 bool* defer) {
83 if (!bytes_read) 83 if (!bytes_read)
84 return true; 84 return true;
85 85
86 // We have more data to read. 86 // We have more data to read.
87 DCHECK(read_buffer_.get()); 87 DCHECK(read_buffer_.get());
88 88
89 // Release the ownership of the buffer, and store a reference 89 // Release the ownership of the buffer, and store a reference
90 // to it. A new one will be allocated in OnWillRead(). 90 // to it. A new one will be allocated in OnWillRead().
91 net::IOBuffer* buffer = NULL; 91 scoped_refptr<net::IOBuffer> buffer;
92 read_buffer_.swap(&buffer); 92 read_buffer_.swap(buffer);
93 stream_->AddData(buffer, bytes_read); 93 stream_->AddData(buffer, bytes_read);
94 94
95 if (!stream_->can_add_data()) 95 if (!stream_->can_add_data())
96 *defer = true; 96 *defer = true;
97 97
98 return true; 98 return true;
99 } 99 }
100 100
101 void StreamResourceHandler::OnResponseCompleted( 101 void StreamResourceHandler::OnResponseCompleted(
102 int request_id, 102 int request_id,
(...skipping 11 matching lines...) Expand all
114 114
115 void StreamResourceHandler::OnSpaceAvailable(Stream* stream) { 115 void StreamResourceHandler::OnSpaceAvailable(Stream* stream) {
116 controller()->Resume(); 116 controller()->Resume();
117 } 117 }
118 118
119 void StreamResourceHandler::OnClose(Stream* stream) { 119 void StreamResourceHandler::OnClose(Stream* stream) {
120 controller()->Cancel(); 120 controller()->Cancel();
121 } 121 }
122 122
123 } // namespace content 123 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/certificate_resource_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698