summaryrefslogtreecommitdiffstats
path: root/net/base/file_stream_posix.cc
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-21 11:00:46 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-21 11:00:46 +0000
commitbe070042674df09e0ca2c4b28c1134aece04f9f8 (patch)
tree6a85aa24c348079eab1216723b656d71b813e3cd /net/base/file_stream_posix.cc
parente8b10af498c2f0f69fbfac6d65fdb3276d70566e (diff)
downloadchromium_src-be070042674df09e0ca2c4b28c1134aece04f9f8.zip
chromium_src-be070042674df09e0ca2c4b28c1134aece04f9f8.tar.gz
chromium_src-be070042674df09e0ca2c4b28c1134aece04f9f8.tar.bz2
net: Get back the blocking behavior in FileStream's destructor.
crrev.com/122601 removed the behavior, but it'd be better to keep this so that the FileStream can be deleted safely, even if it blocks. TEST=net_unittests BUG=115067 Review URL: http://codereview.chromium.org/9425058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122811 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/file_stream_posix.cc')
-rw-r--r--net/base/file_stream_posix.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/base/file_stream_posix.cc b/net/base/file_stream_posix.cc
index 835d520..3809cd8 100644
--- a/net/base/file_stream_posix.cc
+++ b/net/base/file_stream_posix.cc
@@ -388,8 +388,10 @@ FileStream::FileStream(base::PlatformFile file, int flags, net::NetLog* net_log)
FileStream::~FileStream() {
if (auto_closed_) {
if (async_context_.get()) {
- // Make sure we don't have a request in flight.
- DCHECK(async_context_->callback().is_null());
+ // Block until the last read/write operation is complete, if needed.
+ // This is needed to close the file safely.
+ // TODO(satorux): Remove the blocking logic. crrev.com/115067
+ async_context_.reset();
// Close the file in the background.
const bool posted = base::WorkerPool::PostTask(