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

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

Issue 10701050: net: Implement canceling of all async operations in FileStream. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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
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 #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
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "net/base/file_stream.h"
13 #include "net/base/net_export.h" 12 #include "net/base/net_export.h"
14 #include "net/http/http_byte_range.h" 13 #include "net/http/http_byte_range.h"
15 #include "net/url_request/url_request.h" 14 #include "net/url_request/url_request.h"
16 #include "net/url_request/url_request_job.h" 15 #include "net/url_request/url_request_job.h"
17 16
17 namespace base{
18 struct PlatformFileInfo;
19 }
18 namespace file_util { 20 namespace file_util {
19 struct FileInfo; 21 struct FileInfo;
20 } 22 }
21 23
22 namespace net { 24 namespace net {
23 25
26 class FileStream;
27
24 // A request job that handles reading file URLs 28 // A request job that handles reading file URLs
25 class NET_EXPORT URLRequestFileJob : public URLRequestJob { 29 class NET_EXPORT URLRequestFileJob : public URLRequestJob {
26 public: 30 public:
27 URLRequestFileJob(URLRequest* request, 31 URLRequestFileJob(URLRequest* request,
28 NetworkDelegate* network_delegate, 32 NetworkDelegate* network_delegate,
29 const FilePath& file_path); 33 const FilePath& file_path);
30 34
31 static URLRequest::ProtocolFactory Factory; 35 static URLRequest::ProtocolFactory Factory;
32 36
33 // URLRequestJob: 37 // URLRequestJob:
(...skipping 15 matching lines...) Expand all
49 // The OS-specific full path name of the file 53 // The OS-specific full path name of the file
50 FilePath file_path_; 54 FilePath file_path_;
51 55
52 private: 56 private:
53 // Callback after fetching file info on a background thread. 57 // Callback after fetching file info on a background thread.
54 void DidResolve(bool exists, const base::PlatformFileInfo& file_info); 58 void DidResolve(bool exists, const base::PlatformFileInfo& file_info);
55 59
56 // Callback after data is asynchronously read from the file. 60 // Callback after data is asynchronously read from the file.
57 void DidRead(int result); 61 void DidRead(int result);
58 62
59 FileStream stream_; 63 scoped_ptr<FileStream> stream_;
60 bool is_directory_; 64 bool is_directory_;
61 65
62 HttpByteRange byte_range_; 66 HttpByteRange byte_range_;
63 int64 remaining_bytes_; 67 int64 remaining_bytes_;
64 68
65 // The initial file metadata is fetched on a background thread. 69 // The initial file metadata is fetched on a background thread.
66 // AsyncResolver runs that task. 70 // AsyncResolver runs that task.
67 class AsyncResolver; 71 class AsyncResolver;
68 friend class AsyncResolver; 72 friend class AsyncResolver;
69 scoped_refptr<AsyncResolver> async_resolver_; 73 scoped_refptr<AsyncResolver> async_resolver_;
70 74
71 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob); 75 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob);
72 }; 76 };
73 77
74 } // namespace net 78 } // namespace net
75 79
76 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ 80 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698