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

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

Issue 10534100: Decouple URLRequestJob from URLRequestContext; access NetworkDelegate as a contructor parameter. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Merged with latest sync Created 8 years, 5 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
« no previous file with comments | « net/url_request/url_request_file_dir_job.cc ('k') | net/url_request/url_request_ftp_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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 78 }
79 79
80 URLRequestFileJob* owner_; 80 URLRequestFileJob* owner_;
81 81
82 base::Lock lock_; 82 base::Lock lock_;
83 MessageLoop* owner_loop_; 83 MessageLoop* owner_loop_;
84 }; 84 };
85 85
86 URLRequestFileJob::URLRequestFileJob(URLRequest* request, 86 URLRequestFileJob::URLRequestFileJob(URLRequest* request,
87 const FilePath& file_path) 87 const FilePath& file_path)
88 : URLRequestJob(request), 88 : URLRequestJob(request, request->context()->network_delegate()),
89 file_path_(file_path), 89 file_path_(file_path),
90 stream_(NULL), 90 stream_(NULL),
91 is_directory_(false), 91 is_directory_(false),
92 remaining_bytes_(0) { 92 remaining_bytes_(0) {
93 } 93 }
94 94
95 // static 95 // static
96 URLRequestJob* URLRequestFileJob::Factory(URLRequest* request, 96 URLRequestJob* URLRequestFileJob::Factory(URLRequest* request,
97 const std::string& scheme) { 97 const std::string& scheme) {
98 FilePath file_path; 98 FilePath file_path;
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result)); 341 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result));
342 } 342 }
343 343
344 remaining_bytes_ -= result; 344 remaining_bytes_ -= result;
345 DCHECK_GE(remaining_bytes_, 0); 345 DCHECK_GE(remaining_bytes_, 0);
346 346
347 NotifyReadComplete(result); 347 NotifyReadComplete(result);
348 } 348 }
349 349
350 } // namespace net 350 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_file_dir_job.cc ('k') | net/url_request/url_request_ftp_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698