OLD | NEW |
---|---|
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 #ifndef NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ |
6 #define NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... | |
24 | 24 |
25 namespace net { | 25 namespace net { |
26 | 26 |
27 class FileStream; | 27 class FileStream; |
28 | 28 |
29 // A request job that handles reading file URLs | 29 // A request job that handles reading file URLs |
30 class NET_EXPORT URLRequestFileJob : public URLRequestJob { | 30 class NET_EXPORT URLRequestFileJob : public URLRequestJob { |
31 public: | 31 public: |
32 URLRequestFileJob(URLRequest* request, | 32 URLRequestFileJob(URLRequest* request, |
33 NetworkDelegate* network_delegate, | 33 NetworkDelegate* network_delegate, |
34 const base::FilePath& file_path); | 34 const base::FilePath& file_path, |
35 const scoped_refptr<base::TaskRunner>& file_task_runner); | |
akalin
2013/08/16 21:22:20
#include ref_counted.h
forward-declare TaskRunner
| |
35 | 36 |
36 // URLRequestJob: | 37 // URLRequestJob: |
37 virtual void Start() OVERRIDE; | 38 virtual void Start() OVERRIDE; |
38 virtual void Kill() OVERRIDE; | 39 virtual void Kill() OVERRIDE; |
39 virtual bool ReadRawData(IOBuffer* buf, | 40 virtual bool ReadRawData(IOBuffer* buf, |
40 int buf_size, | 41 int buf_size, |
41 int* bytes_read) OVERRIDE; | 42 int* bytes_read) OVERRIDE; |
42 virtual bool IsRedirectResponse(GURL* location, | 43 virtual bool IsRedirectResponse(GURL* location, |
43 int* http_status_code) OVERRIDE; | 44 int* http_status_code) OVERRIDE; |
44 virtual Filter* SetupFilter() const OVERRIDE; | 45 virtual Filter* SetupFilter() const OVERRIDE; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 | 85 |
85 // Callback after seeking to the beginning of |byte_range_| in the file | 86 // Callback after seeking to the beginning of |byte_range_| in the file |
86 // on a background thread. | 87 // on a background thread. |
87 void DidSeek(int64 result); | 88 void DidSeek(int64 result); |
88 | 89 |
89 // Callback after data is asynchronously read from the file. | 90 // Callback after data is asynchronously read from the file. |
90 void DidRead(int result); | 91 void DidRead(int result); |
91 | 92 |
92 scoped_ptr<FileStream> stream_; | 93 scoped_ptr<FileStream> stream_; |
93 FileMetaInfo meta_info_; | 94 FileMetaInfo meta_info_; |
95 const scoped_refptr<base::TaskRunner> file_task_runner_; | |
94 | 96 |
95 HttpByteRange byte_range_; | 97 HttpByteRange byte_range_; |
96 int64 remaining_bytes_; | 98 int64 remaining_bytes_; |
97 | 99 |
98 base::WeakPtrFactory<URLRequestFileJob> weak_ptr_factory_; | 100 base::WeakPtrFactory<URLRequestFileJob> weak_ptr_factory_; |
99 | 101 |
100 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob); | 102 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob); |
101 }; | 103 }; |
102 | 104 |
103 } // namespace net | 105 } // namespace net |
104 | 106 |
105 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ | 107 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ |
OLD | NEW |