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

Unified Diff: net/url_request/url_request_file_job.h

Issue 10695110: Avoid disk accesses on the wrong thread in URLRequestFileJob (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: 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 side-by-side diff with in-line comments
Download patch
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"
@@ -60,22 +61,31 @@
const FilePath& path);
// Callback after fetching file info on a background thread.
- void DidResolve(bool exists, const base::PlatformFileInfo& file_info);
+ void DidResolveAndMimeType(const bool* exists,
+ const base::PlatformFileInfo* file_info,
+ const bool* mime_type_result,
+ const std::string* read_mime_type);
+ // Callback after opening file on a background thread.
+ void DidOpen(int result);
+
+ // Callback after seeking to necessary position in the file which is done
+ // 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_;
+ bool mime_type_result_;
+ std::string mime_type_;
+ int64 file_size_;
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);
};

Powered by Google App Engine
This is Rietveld 408576698