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

Unified Diff: content/browser/loader/resource_loader.cc

Issue 25536005: Clean up ResourceHandler API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 2 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/browser/loader/resource_handler.cc ('k') | content/browser/loader/resource_loader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/resource_loader.cc
diff --git a/content/browser/loader/resource_loader.cc b/content/browser/loader/resource_loader.cc
index 88c9c857d55e21cb6b8017de3f08821b32cf8964..55add725731dd2aa3a0e1267c61ac58c3f239fb1 100644
--- a/content/browser/loader/resource_loader.cc
+++ b/content/browser/loader/resource_loader.cc
@@ -597,7 +597,10 @@ void ResourceLoader::ReadMore(int* bytes_read) {
ResourceRequestInfoImpl* info = GetRequestInfo();
DCHECK(!is_deferred());
- net::IOBuffer* buf;
+ // Make sure we track the buffer in at least one place. This ensures it gets
+ // deleted even in the case the request has already finished its job and
+ // doesn't use the buffer.
+ scoped_refptr<net::IOBuffer> buf;
int buf_size;
if (!handler_->OnWillRead(info->GetRequestID(), &buf, &buf_size, -1)) {
Cancel();
@@ -607,12 +610,7 @@ void ResourceLoader::ReadMore(int* bytes_read) {
DCHECK(buf);
DCHECK(buf_size > 0);
- // Make sure we track the buffer in at least one place. This ensures it gets
- // deleted even in the case the request has already finished its job and
- // doesn't use the buffer.
- scoped_refptr<net::IOBuffer> tracked_buf(buf);
-
- request_->Read(tracked_buf.get(), buf_size, bytes_read);
+ request_->Read(buf.get(), buf_size, bytes_read);
// No need to check the return value here as we'll detect errors by
// inspecting the URLRequest's status.
« no previous file with comments | « content/browser/loader/resource_handler.cc ('k') | content/browser/loader/resource_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698