summaryrefslogtreecommitdiffstats
path: root/net/base/file_stream_context.cc
diff options
context:
space:
mode:
authorwaffles@chromium.org <waffles@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-12 06:37:19 +0000
committerwaffles@chromium.org <waffles@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-12 06:37:19 +0000
commitc1d9cf7449c127f77efda8f360a87a7e41132a4c (patch)
tree8da2abcba1c73c40be5bd127514da23a55e32e46 /net/base/file_stream_context.cc
parente38a64749edc404584e603bffd3981c4f9c1faf4 (diff)
downloadchromium_src-c1d9cf7449c127f77efda8f360a87a7e41132a4c.zip
chromium_src-c1d9cf7449c127f77efda8f360a87a7e41132a4c.tar.gz
chromium_src-c1d9cf7449c127f77efda8f360a87a7e41132a4c.tar.bz2
URLFetcher won't call delegate until file is closed.
Previously, URLFetchers closed the file in parallel with calling the delegate, which causes races on whether or not the file has been closed. Implementing this change required the addition of a Close() function to the API of FileStream. BUG=265840 Review URL: https://chromiumcodereview.appspot.com/23500006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222737 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/file_stream_context.cc')
-rw-r--r--net/base/file_stream_context.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/net/base/file_stream_context.cc b/net/base/file_stream_context.cc
index abc058a..0d4f8d9 100644
--- a/net/base/file_stream_context.cc
+++ b/net/base/file_stream_context.cc
@@ -105,6 +105,21 @@ void FileStream::Context::CloseSync() {
}
}
+void FileStream::Context::CloseAsync(const CompletionCallback& callback) {
+ DCHECK(!async_in_progress_);
+ const bool posted = base::PostTaskAndReplyWithResult(
+ task_runner_.get(),
+ FROM_HERE,
+ base::Bind(&Context::CloseFileImpl, base::Unretained(this)),
+ base::Bind(&Context::ProcessAsyncResult,
+ base::Unretained(this),
+ IntToInt64(callback),
+ FILE_ERROR_SOURCE_CLOSE));
+ DCHECK(posted);
+
+ async_in_progress_ = true;
+}
+
void FileStream::Context::SeekAsync(Whence whence,
int64 offset,
const Int64CompletionCallback& callback) {