Index: net/url_request/url_request_file_job.h |
=================================================================== |
--- net/url_request/url_request_file_job.h (revision 145483) |
+++ net/url_request/url_request_file_job.h (working copy) |
@@ -10,6 +10,7 @@ |
#include <vector> |
#include "base/file_path.h" |
+#include "base/memory/weak_ptr.h" |
#include "net/base/file_stream.h" |
#include "net/base/net_export.h" |
#include "net/http/http_byte_range.h" |
@@ -53,29 +54,44 @@ |
FilePath file_path_; |
private: |
+ struct FileMetaInfo { |
+ int64 file_size_; |
+ std::string mime_type_; |
+ bool mime_type_result_; |
+ bool file_exists_; |
+ bool is_directory_; |
wtc
2012/07/13 22:38:55
The style guide recommends that struct member name
|
+ }; |
+ |
// Tests to see if access to |path| is allowed. If g_allow_file_access_ is |
// true, then this will return true. If the NetworkDelegate associated with |
// the |request| says it's OK, then this will also return true. |
static bool IsFileAccessAllowed(const URLRequest& request, |
const FilePath& path); |
+ // Function fetching file info on a WorkerPool thread. |
wtc
2012/07/13 22:38:55
Nit: Function fetching => Fetches
|
+ static void FetchMetaInfo(const FilePath& file_path, |
+ FileMetaInfo* meta_info); |
+ |
// Callback after fetching file info on a background thread. |
- void DidResolve(bool exists, const base::PlatformFileInfo& file_info); |
+ void DidFetchMetaInfo(const FileMetaInfo* meta_info); |
+ // Callback after opening file on a background thread. |
+ void DidOpen(int result); |
+ |
+ // Callback after seeking to necessary position in the file which is done |
wtc
2012/07/13 22:38:55
Nit: change this comment to:
// Callback after s
|
+ // on a background thread. |
+ void DidSeek(int64 result); |
+ |
// Callback after data is asynchronously read from the file. |
void DidRead(int result); |
FileStream stream_; |
- bool is_directory_; |
+ FileMetaInfo meta_info_; |
HttpByteRange byte_range_; |
int64 remaining_bytes_; |
- // The initial file metadata is fetched on a background thread. |
- // AsyncResolver runs that task. |
- class AsyncResolver; |
- friend class AsyncResolver; |
- scoped_refptr<AsyncResolver> async_resolver_; |
+ base::WeakPtrFactory<URLRequestFileJob> weak_ptr_factory_; |
DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob); |
}; |