summaryrefslogtreecommitdiffstats
path: root/net/base
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-06 21:08:59 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-06 21:08:59 +0000
commit10b998f8a366c02a69b1e8688a1b5e0cb653a154 (patch)
tree4aa5d267e957f46ead7fd6742ade99679ff57a4c /net/base
parent0568e6ca9cba8826a42eed080e569dba3fe6afec (diff)
downloadchromium_src-10b998f8a366c02a69b1e8688a1b5e0cb653a154.zip
chromium_src-10b998f8a366c02a69b1e8688a1b5e0cb653a154.tar.gz
chromium_src-10b998f8a366c02a69b1e8688a1b5e0cb653a154.tar.bz2
Add Chromium side implementation for WebFileSystem interface in WebKit.
BUG=none TEST=non Review URL: http://codereview.chromium.org/1748015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46625 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r--net/base/file_stream.h3
-rw-r--r--net/base/file_stream_posix.cc6
-rw-r--r--net/base/file_stream_win.cc9
3 files changed, 13 insertions, 5 deletions
diff --git a/net/base/file_stream.h b/net/base/file_stream.h
index 6b7f3dc..ff9e7a6 100644
--- a/net/base/file_stream.h
+++ b/net/base/file_stream.h
@@ -34,6 +34,8 @@ class FileStream {
// |file| is valid file handle.
// |flags| is a bitfield of base::PlatformFileFlags when the file handle was
// opened.
+ // The already opened file will not be automatically closed when FileStream
+ // is destructed.
FileStream(base::PlatformFile file, int flags);
~FileStream();
@@ -128,6 +130,7 @@ class FileStream {
base::PlatformFile file_;
int open_flags_;
+ bool auto_closed_;
DISALLOW_COPY_AND_ASSIGN(FileStream);
};
diff --git a/net/base/file_stream_posix.cc b/net/base/file_stream_posix.cc
index a4c5b3c..65c8e2b 100644
--- a/net/base/file_stream_posix.cc
+++ b/net/base/file_stream_posix.cc
@@ -293,13 +293,15 @@ void FileStream::AsyncContext::RunAsynchronousCallback() {
FileStream::FileStream()
: file_(base::kInvalidPlatformFileValue),
- open_flags_(0) {
+ open_flags_(0),
+ auto_closed_(true) {
DCHECK(!IsOpen());
}
FileStream::FileStream(base::PlatformFile file, int flags)
: file_(file),
- open_flags_(flags) {
+ open_flags_(flags),
+ auto_closed_(false) {
// If the file handle is opened with base::PLATFORM_FILE_ASYNC, we need to
// make sure we will perform asynchronous File IO to it.
if (flags & base::PLATFORM_FILE_ASYNC) {
diff --git a/net/base/file_stream_win.cc b/net/base/file_stream_win.cc
index cec6a9d..1ad9a34 100644
--- a/net/base/file_stream_win.cc
+++ b/net/base/file_stream_win.cc
@@ -117,12 +117,14 @@ void FileStream::AsyncContext::OnIOCompleted(
FileStream::FileStream()
: file_(INVALID_HANDLE_VALUE),
- open_flags_(0) {
+ open_flags_(0),
+ auto_closed_(true) {
}
FileStream::FileStream(base::PlatformFile file, int flags)
: file_(file),
- open_flags_(flags) {
+ open_flags_(flags),
+ auto_closed_(false) {
// If the file handle is opened with base::PLATFORM_FILE_ASYNC, we need to
// make sure we will perform asynchronous File IO to it.
if (flags & base::PLATFORM_FILE_ASYNC) {
@@ -133,7 +135,8 @@ FileStream::FileStream(base::PlatformFile file, int flags)
}
FileStream::~FileStream() {
- Close();
+ if (auto_closed_)
+ Close();
}
void FileStream::Close() {