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

Side by Side Diff: chrome/browser/predictors/resource_prefetcher.cc

Issue 16296002: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 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
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 #include <iterator> 5 #include <iterator>
6 6
7 #include "chrome/browser/predictors/resource_prefetcher.h" 7 #include "chrome/browser/predictors/resource_prefetcher.h"
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 TryToLaunchPrefetchRequests(); 161 TryToLaunchPrefetchRequests();
162 } 162 }
163 163
164 void ResourcePrefetcher::ReadFullResponse(net::URLRequest* request) { 164 void ResourcePrefetcher::ReadFullResponse(net::URLRequest* request) {
165 bool status = true; 165 bool status = true;
166 while (status) { 166 while (status) {
167 int bytes_read = 0; 167 int bytes_read = 0;
168 scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer( 168 scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(
169 kResourceBufferSizeBytes)); 169 kResourceBufferSizeBytes));
170 status = request->Read(buffer, kResourceBufferSizeBytes, &bytes_read); 170 status = request->Read(buffer.get(), kResourceBufferSizeBytes, &bytes_read);
171 171
172 if (status) { 172 if (status) {
173 status = ShouldContinueReadingRequest(request, bytes_read); 173 status = ShouldContinueReadingRequest(request, bytes_read);
174 } else if (request->status().error()) { 174 } else if (request->status().error()) {
175 FinishRequest(request, Request::PREFETCH_STATUS_FAILED); 175 FinishRequest(request, Request::PREFETCH_STATUS_FAILED);
176 return; 176 return;
177 } 177 }
178 } 178 }
179 } 179 }
180 180
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 if (request->status().error()) { 229 if (request->status().error()) {
230 FinishRequest(request, Request::PREFETCH_STATUS_FAILED); 230 FinishRequest(request, Request::PREFETCH_STATUS_FAILED);
231 return; 231 return;
232 } 232 }
233 233
234 if (ShouldContinueReadingRequest(request, bytes_read)) 234 if (ShouldContinueReadingRequest(request, bytes_read))
235 ReadFullResponse(request); 235 ReadFullResponse(request);
236 } 236 }
237 237
238 } // namespace predictors 238 } // namespace predictors
OLDNEW
« no previous file with comments | « chrome/browser/predictors/resource_prefetch_predictor_unittest.cc ('k') | chrome/browser/prefs/chrome_pref_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698