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

Side by Side Diff: net/url_request/url_request_file_job.cc

Issue 675303004: Adding instrumentation to locate the source of jankiness. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | net/url_request/url_request_job.cc » ('j') | 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 // For loading files, we make use of overlapped i/o to ensure that reading from 5 // For loading files, we make use of overlapped i/o to ensure that reading from
6 // the filesystem (e.g., a network filesystem) does not block the calling 6 // the filesystem (e.g., a network filesystem) does not block the calling
7 // thread. An alternative approach would be to use a background thread or pool 7 // thread. An alternative approach would be to use a background thread or pool
8 // of threads, but it seems better to leverage the operating system's ability 8 // of threads, but it seems better to leverage the operating system's ability
9 // to do background file reads for us. 9 // to do background file reads for us.
10 // 10 //
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, 263 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED,
264 ERR_REQUEST_RANGE_NOT_SATISFIABLE)); 264 ERR_REQUEST_RANGE_NOT_SATISFIABLE));
265 return; 265 return;
266 } 266 }
267 267
268 remaining_bytes_ = byte_range_.last_byte_position() - 268 remaining_bytes_ = byte_range_.last_byte_position() -
269 byte_range_.first_byte_position() + 1; 269 byte_range_.first_byte_position() + 1;
270 DCHECK_GE(remaining_bytes_, 0); 270 DCHECK_GE(remaining_bytes_, 0);
271 271
272 if (remaining_bytes_ > 0 && byte_range_.first_byte_position() != 0) { 272 if (remaining_bytes_ > 0 && byte_range_.first_byte_position() != 0) {
273 // TODO(vadimt): Remove ScopedProfile below once crbug.com/423948 is fixed.
274 tracked_objects::ScopedProfile tracking_profile1(
275 FROM_HERE_WITH_EXPLICIT_FUNCTION(
276 "423948 URLRequestFileJob::DidOpen 1"));
277
273 int rv = stream_->Seek(base::File::FROM_BEGIN, 278 int rv = stream_->Seek(base::File::FROM_BEGIN,
274 byte_range_.first_byte_position(), 279 byte_range_.first_byte_position(),
275 base::Bind(&URLRequestFileJob::DidSeek, 280 base::Bind(&URLRequestFileJob::DidSeek,
276 weak_ptr_factory_.GetWeakPtr())); 281 weak_ptr_factory_.GetWeakPtr()));
277 if (rv != ERR_IO_PENDING) { 282 if (rv != ERR_IO_PENDING) {
278 // stream_->Seek() failed, so pass an intentionally erroneous value 283 // stream_->Seek() failed, so pass an intentionally erroneous value
279 // into DidSeek(). 284 // into DidSeek().
280 DidSeek(-1); 285 DidSeek(-1);
281 } 286 }
282 } else { 287 } else {
(...skipping 29 matching lines...) Expand all
312 if (result == 0) { 317 if (result == 0) {
313 NotifyDone(URLRequestStatus()); 318 NotifyDone(URLRequestStatus());
314 } else if (result < 0) { 319 } else if (result < 0) {
315 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result)); 320 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result));
316 } 321 }
317 322
318 NotifyReadComplete(result); 323 NotifyReadComplete(result);
319 } 324 }
320 325
321 } // namespace net 326 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/url_request/url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698