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

Unified Diff: content/common/url_fetcher.cc

Issue 7066067: Support creating temporary files for sync file operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Darin's comments Created 9 years, 6 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
« no previous file with comments | « content/browser/renderer_host/redirect_to_file_resource_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/url_fetcher.cc
diff --git a/content/common/url_fetcher.cc b/content/common/url_fetcher.cc
index 9706a9d318d75a4899adac2bc52aff7a0494c070..e0852fb8af3fab03557fe9fcb175b8b99c12f0f8 100644
--- a/content/common/url_fetcher.cc
+++ b/content/common/url_fetcher.cc
@@ -109,10 +109,6 @@ class URLFetcher::Core
void DidCreateTempFile(base::PlatformFileError error_code,
base::PassPlatformFile file_handle,
FilePath file_path);
- void DidCloseTempFile(base::PlatformFileError error_code);
- void DidReopenTempFile(base::PlatformFileError error_code,
- base::PassPlatformFile file_handle,
- bool created);
// Record |num_bytes_| response bytes in |core_->buffer_| to the file.
void WriteBuffer(int num_bytes);
@@ -317,6 +313,7 @@ void URLFetcher::Core::TempFileWriter::CreateTempFile() {
CHECK(file_message_loop_proxy_.get());
base::FileUtilProxy::CreateTemporary(
file_message_loop_proxy_,
+ 0, // No additional file flags.
callback_factory_.NewCallback(
&URLFetcher::Core::TempFileWriter::DidCreateTempFile));
}
@@ -332,50 +329,6 @@ void URLFetcher::Core::TempFileWriter::DidCreateTempFile(
}
temp_file_ = file_path;
-
- // The file was opened with async writes enabled. FileUtilProxy::Write()
- // treats a write that returns IO_PENDING as an error, and does not inform
- // the caller. We need to close and reopen the file with asyncronus writes
- // disabled.
- // TODO(skerner): Make FileUtilProxy::Write() play nice with async IO.
- base::FileUtilProxy::Close(
- file_message_loop_proxy_,
- file_handle.ReleaseValue(),
- callback_factory_.NewCallback(
- &URLFetcher::Core::TempFileWriter::DidCloseTempFile));
-}
-
-void URLFetcher::Core::TempFileWriter::DidCloseTempFile(
- base::PlatformFileError error_code) {
- if (base::PLATFORM_FILE_OK != error_code) {
- error_code_ = error_code;
- core_->InformDelegateFetchIsComplete();
- return;
- }
-
- int file_flags =
- base::PLATFORM_FILE_CREATE_ALWAYS |
- base::PLATFORM_FILE_WRITE |
- base::PLATFORM_FILE_TEMPORARY;
-
- base::FileUtilProxy::CreateOrOpen(
- file_message_loop_proxy_,
- temp_file_,
- file_flags,
- callback_factory_.NewCallback(
- &URLFetcher::Core::TempFileWriter::DidReopenTempFile));
-}
-
-void URLFetcher::Core::TempFileWriter::DidReopenTempFile(
- base::PlatformFileError error_code,
- base::PassPlatformFile file_handle,
- bool created) {
- if (base::PLATFORM_FILE_OK != error_code) {
- error_code_ = error_code;
- core_->InformDelegateFetchIsComplete();
- return;
- }
-
temp_file_handle_ = file_handle.ReleaseValue();
total_bytes_written_ = 0;
« no previous file with comments | « content/browser/renderer_host/redirect_to_file_resource_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698