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

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

Issue 9288084: Added Net logging to FileStream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed copyright issue. Created 8 years, 10 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 | « net/tools/dump_cache/dump_files.cc ('k') | webkit/blob/blob_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) 2011 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 //
11 // Since overlapped reads require a 'static' buffer for the duration of the 11 // Since overlapped reads require a 'static' buffer for the duration of the
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 URLRequestFileJob* owner_; 79 URLRequestFileJob* owner_;
80 80
81 base::Lock lock_; 81 base::Lock lock_;
82 MessageLoop* owner_loop_; 82 MessageLoop* owner_loop_;
83 }; 83 };
84 84
85 URLRequestFileJob::URLRequestFileJob(URLRequest* request, 85 URLRequestFileJob::URLRequestFileJob(URLRequest* request,
86 const FilePath& file_path) 86 const FilePath& file_path)
87 : URLRequestJob(request), 87 : URLRequestJob(request),
88 file_path_(file_path), 88 file_path_(file_path),
89 stream_(NULL),
89 is_directory_(false), 90 is_directory_(false),
90 remaining_bytes_(0) { 91 remaining_bytes_(0) {
91 } 92 }
92 93
93 // static 94 // static
94 URLRequestJob* URLRequestFileJob::Factory(URLRequest* request, 95 URLRequestJob* URLRequestFileJob::Factory(URLRequest* request,
95 const std::string& scheme) { 96 const std::string& scheme) {
96 97
97 FilePath file_path; 98 FilePath file_path;
98 const bool is_file = FileURLToFilePath(request->url(), &file_path); 99 const bool is_file = FileURLToFilePath(request->url(), &file_path);
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result)); 356 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result));
356 } 357 }
357 358
358 remaining_bytes_ -= result; 359 remaining_bytes_ -= result;
359 DCHECK_GE(remaining_bytes_, 0); 360 DCHECK_GE(remaining_bytes_, 0);
360 361
361 NotifyReadComplete(result); 362 NotifyReadComplete(result);
362 } 363 }
363 364
364 } // namespace net 365 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/dump_cache/dump_files.cc ('k') | webkit/blob/blob_url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698