[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
jianli at chromium.org
jianli at chromium.org
Wed Dec 22 12:18:57 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit d62ea90897264b8110ada7a22816e6299f699b5f
Author: jianli at chromium.org <jianli at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Aug 18 23:52:03 2010 +0000
Move FileStream to platform.
https://bugs.webkit.org/show_bug.cgi?id=44213
Reviewed by David Levin.
In addition to moving files over, FileStream has been changed to remove
ExceptionCode dependency. Also update FileStreamProxy and FileRead to
account for this change.
* Android.mk:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* html/FileReader.cpp:
(WebCore::FileReader::didOpen):
* html/FileReader.h:
* html/FileStream.cpp: Removed.
* html/FileStream.h: Removed.
* html/FileStreamClient.h:
(WebCore::FileStreamClient::didTruncate):
(WebCore::FileStreamClient::didOpen):
* html/FileStreamProxy.cpp:
(WebCore::didOpen):
(WebCore::FileStreamProxy::openForReadOnFileThread):
(WebCore::FileStreamProxy::openForWriteOnFileThread):
(WebCore::FileStreamProxy::write):
(WebCore::FileStreamProxy::writeOnFileThread):
(WebCore::didTruncate):
(WebCore::FileStreamProxy::truncateOnFileThread):
* html/FileStreamProxy.h:
* platform/FileStream.cpp: Renamed from WebCore/FileStream.cpp and updated.
* platform/FileStream.h: Renamed from WebCore/FileStream.h and updated.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65645 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/Android.mk b/WebCore/Android.mk
index 159b420..ac1060a 100644
--- a/WebCore/Android.mk
+++ b/WebCore/Android.mk
@@ -414,6 +414,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
platform/DragData.cpp \
platform/DragImage.cpp \
platform/FileChooser.cpp \
+ platform/FileStream.cpp \
platform/FileSystem.cpp \
platform/GeolocationService.cpp \
platform/KURL.cpp \
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e55b1c4..819f561 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,5 +1,42 @@
2010-08-18 Jian Li <jianli at chromium.org>
+ Reviewed by David Levin.
+
+ Move FileStream to platform.
+ https://bugs.webkit.org/show_bug.cgi?id=44213
+
+ In addition to moving files over, FileStream has been changed to remove
+ ExceptionCode dependency. Also update FileStreamProxy and FileRead to
+ account for this change.
+
+ * Android.mk:
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * html/FileReader.cpp:
+ (WebCore::FileReader::didOpen):
+ * html/FileReader.h:
+ * html/FileStream.cpp: Removed.
+ * html/FileStream.h: Removed.
+ * html/FileStreamClient.h:
+ (WebCore::FileStreamClient::didTruncate):
+ (WebCore::FileStreamClient::didOpen):
+ * html/FileStreamProxy.cpp:
+ (WebCore::didOpen):
+ (WebCore::FileStreamProxy::openForReadOnFileThread):
+ (WebCore::FileStreamProxy::openForWriteOnFileThread):
+ (WebCore::FileStreamProxy::write):
+ (WebCore::FileStreamProxy::writeOnFileThread):
+ (WebCore::didTruncate):
+ (WebCore::FileStreamProxy::truncateOnFileThread):
+ * html/FileStreamProxy.h:
+ * platform/FileStream.cpp: Renamed from WebCore/FileStream.cpp and updated.
+ * platform/FileStream.h: Renamed from WebCore/FileStream.h and updated.
+
+2010-08-18 Jian Li <jianli at chromium.org>
+
Reviewed by Darin Fisher.
Chromium side implementation of blob data and blob registry.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index c191573..c6d5838 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -1353,8 +1353,6 @@ webcore_sources += \
WebCore/html/FileList.h \
WebCore/html/FileReader.cpp \
WebCore/html/FileReader.h \
- WebCore/html/FileStream.cpp \
- WebCore/html/FileStream.h \
WebCore/html/FileStreamClient.h \
WebCore/html/FileStreamProxy.cpp \
WebCore/html/FileStreamProxy.h \
@@ -1901,6 +1899,8 @@ webcore_sources += \
WebCore/platform/EventLoop.h \
WebCore/platform/FileChooser.cpp \
WebCore/platform/FileChooser.h \
+ WebCore/platform/FileStream.cpp \
+ WebCore/platform/FileStream.h \
WebCore/platform/FileSystem.cpp \
WebCore/platform/FileSystem.h \
WebCore/platform/FloatConversion.h \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index d906385..32b2fe1 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -1518,8 +1518,6 @@
'html/FileList.h',
'html/FileReader.cpp',
'html/FileReader.h',
- 'html/FileStream.cpp',
- 'html/FileStream.h',
'html/FileStreamClient.h',
'html/FileStreamProxy.cpp',
'html/FileStreamProxy.h',
@@ -3060,6 +3058,8 @@
'platform/EventLoop.h',
'platform/FileChooser.cpp',
'platform/FileChooser.h',
+ 'platform/FileStream.cpp',
+ 'platform/FileStream.h',
'platform/FileSystem.cpp',
'platform/FileSystem.h',
'platform/FloatConversion.h',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 42ca95f..6c6e289 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -636,7 +636,6 @@ SOURCES += \
html/File.cpp \
html/FileList.cpp \
html/FileReader.cpp \
- html/FileStream.cpp \
html/FileStreamProxy.cpp \
html/FileThread.cpp \
html/FormDataList.cpp \
@@ -875,6 +874,7 @@ SOURCES += \
platform/DragData.cpp \
platform/DragImage.cpp \
platform/FileChooser.cpp \
+ platform/FileStream.cpp \
platform/FileSystem.cpp \
platform/GeolocationService.cpp \
platform/image-decoders/qt/RGBA32BufferQt.cpp \
@@ -1410,7 +1410,6 @@ HEADERS += \
html/FileError.h \
html/FileList.h \
html/FileReader.h \
- html/FileStream.h \
html/FileStreamClient.h \
html/FileStreamProxy.h \
html/FileThread.h \
@@ -1653,6 +1652,7 @@ HEADERS += \
platform/DragData.h \
platform/DragImage.h \
platform/FileChooser.h \
+ platform/FileStream.h \
platform/FileSystem.h \
platform/GeolocationService.h \
platform/image-decoders/ImageDecoder.h \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index d51cb40..bebc3f8 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -24013,6 +24013,14 @@
>
</File>
<File
+ RelativePath="..\platform\FileStream.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\FileStream.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\FileSystem.cpp"
>
</File>
@@ -37117,14 +37125,6 @@
>
</File>
<File
- RelativePath="..\html\FileStream.cpp"
- >
- </File>
- <File
- RelativePath="..\html\FileStream.h"
- >
- </File>
- <File
RelativePath="..\html\FileStreamClient.h"
>
</File>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 2953b96..8ce2a06 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -720,6 +720,8 @@
2EED575612109ED0007656BB /* BlobURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EED575112109ED0007656BB /* BlobURL.h */; };
2EED57FD1214A9C2007656BB /* ThreadableBlobRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2EED57FB1214A9C2007656BB /* ThreadableBlobRegistry.cpp */; };
2EED57FE1214A9C2007656BB /* ThreadableBlobRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EED57FC1214A9C2007656BB /* ThreadableBlobRegistry.h */; };
+ 2EF1BFEA121C9F4200C27627 /* FileStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2EF1BFE8121C9F4200C27627 /* FileStream.cpp */; };
+ 2EF1BFEB121C9F4200C27627 /* FileStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EF1BFE9121C9F4200C27627 /* FileStream.h */; };
31288E720E3005D6003619AE /* WebKitCSSKeyframeRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31288E6E0E3005D6003619AE /* WebKitCSSKeyframeRule.cpp */; };
31288E730E3005D6003619AE /* WebKitCSSKeyframeRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 31288E6F0E3005D6003619AE /* WebKitCSSKeyframeRule.h */; };
31288E740E3005D6003619AE /* WebKitCSSKeyframesRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31288E700E3005D6003619AE /* WebKitCSSKeyframesRule.cpp */; };
@@ -2376,8 +2378,6 @@
86243D0111BC31F700CC006A /* JSArrayBufferViewHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 86243D0011BC31F700CC006A /* JSArrayBufferViewHelper.h */; };
8952535211641B3400CABF00 /* FileThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8952535011641B3400CABF00 /* FileThread.cpp */; };
8952535311641B3400CABF00 /* FileThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 8952535111641B3400CABF00 /* FileThread.h */; };
- 895253D7116C4C6800CABF00 /* FileStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 895253D4116C4C6800CABF00 /* FileStream.cpp */; };
- 895253D8116C4C6800CABF00 /* FileStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 895253D5116C4C6800CABF00 /* FileStream.h */; };
895253D9116C4C6800CABF00 /* FileStreamClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 895253D6116C4C6800CABF00 /* FileStreamClient.h */; };
895253DC116C4EF500CABF00 /* FileStreamProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 895253DA116C4EF500CABF00 /* FileStreamProxy.cpp */; };
895253DD116C4EF500CABF00 /* FileStreamProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 895253DB116C4EF500CABF00 /* FileStreamProxy.h */; };
@@ -6533,6 +6533,8 @@
2EED575112109ED0007656BB /* BlobURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobURL.h; sourceTree = "<group>"; };
2EED57FB1214A9C2007656BB /* ThreadableBlobRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadableBlobRegistry.cpp; sourceTree = "<group>"; };
2EED57FC1214A9C2007656BB /* ThreadableBlobRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadableBlobRegistry.h; sourceTree = "<group>"; };
+ 2EF1BFE8121C9F4200C27627 /* FileStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileStream.cpp; sourceTree = "<group>"; };
+ 2EF1BFE9121C9F4200C27627 /* FileStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileStream.h; sourceTree = "<group>"; };
31288E6E0E3005D6003619AE /* WebKitCSSKeyframeRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSKeyframeRule.cpp; sourceTree = "<group>"; };
31288E6F0E3005D6003619AE /* WebKitCSSKeyframeRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitCSSKeyframeRule.h; sourceTree = "<group>"; };
31288E700E3005D6003619AE /* WebKitCSSKeyframesRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSKeyframesRule.cpp; sourceTree = "<group>"; };
@@ -8224,8 +8226,6 @@
86243D0011BC31F700CC006A /* JSArrayBufferViewHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSArrayBufferViewHelper.h; sourceTree = "<group>"; };
8952535011641B3400CABF00 /* FileThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileThread.cpp; sourceTree = "<group>"; };
8952535111641B3400CABF00 /* FileThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileThread.h; sourceTree = "<group>"; };
- 895253D4116C4C6800CABF00 /* FileStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileStream.cpp; sourceTree = "<group>"; };
- 895253D5116C4C6800CABF00 /* FileStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileStream.h; sourceTree = "<group>"; };
895253D6116C4C6800CABF00 /* FileStreamClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileStreamClient.h; sourceTree = "<group>"; };
895253DA116C4EF500CABF00 /* FileStreamProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileStreamProxy.cpp; sourceTree = "<group>"; };
895253DB116C4EF500CABF00 /* FileStreamProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileStreamProxy.h; sourceTree = "<group>"; };
@@ -14009,8 +14009,6 @@
2E94F3CB118B908E00B7F75D /* FileReader.cpp */,
2E94F3CC118B908E00B7F75D /* FileReader.h */,
2E94F427119205B300B7F75D /* FileReader.idl */,
- 895253D4116C4C6800CABF00 /* FileStream.cpp */,
- 895253D5116C4C6800CABF00 /* FileStream.h */,
895253D6116C4C6800CABF00 /* FileStreamClient.h */,
895253DA116C4EF500CABF00 /* FileStreamProxy.cpp */,
895253DB116C4EF500CABF00 /* FileStreamProxy.h */,
@@ -16594,6 +16592,8 @@
1CA19E150DC255CA0065A994 /* EventLoop.h */,
934FE9E40B5CA539003E4A73 /* FileChooser.cpp */,
066C772A0AB603B700238CC4 /* FileChooser.h */,
+ 2EF1BFE8121C9F4200C27627 /* FileStream.cpp */,
+ 2EF1BFE9121C9F4200C27627 /* FileStream.h */,
C57FEDE01212EE9C0097BE65 /* FileSystem.cpp */,
514B3F720C722047000530DF /* FileSystem.h */,
BC073BA90C399B1F000F5979 /* FloatConversion.h */,
@@ -18673,7 +18673,6 @@
2E3BC0BD117D3A4F00B9409A /* FileError.h in Headers */,
BCDBB8AC0E088CA500C60FF6 /* FileList.h in Headers */,
2E94F4511192096A00B7F75D /* FileReader.h in Headers */,
- 895253D8116C4C6800CABF00 /* FileStream.h in Headers */,
895253D9116C4C6800CABF00 /* FileStreamClient.h in Headers */,
895253DD116C4EF500CABF00 /* FileStreamProxy.h in Headers */,
514B3F730C722047000530DF /* FileSystem.h in Headers */,
@@ -20320,6 +20319,7 @@
2EDEF1F5121B0EFC00726DB2 /* BlobRegistry.h in Headers */,
2EDEF1F7121B0EFC00726DB2 /* BlobRegistryImpl.h in Headers */,
2EDEF1F8121B0EFC00726DB2 /* BlobStorageData.h in Headers */,
+ 2EF1BFEB121C9F4200C27627 /* FileStream.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -20379,7 +20379,6 @@
isa = PBXProject;
buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
compatibilityVersion = "Xcode 2.4";
- developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
@@ -21175,7 +21174,6 @@
066C772D0AB603D200238CC4 /* FileChooserMac.mm in Sources */,
BCDBB8AD0E088CA500C60FF6 /* FileList.cpp in Sources */,
2E94F4501192096400B7F75D /* FileReader.cpp in Sources */,
- 895253D7116C4C6800CABF00 /* FileStream.cpp in Sources */,
895253DC116C4EF500CABF00 /* FileStreamProxy.cpp in Sources */,
5160306C0CC4362300C8AC25 /* FileSystemCF.cpp in Sources */,
514B3F760C722055000530DF /* FileSystemMac.mm in Sources */,
@@ -22771,6 +22769,7 @@
C57FEDE11212EE9C0097BE65 /* FileSystem.cpp in Sources */,
2EDEF1F3121B0EFC00726DB2 /* BlobData.cpp in Sources */,
2EDEF1F6121B0EFC00726DB2 /* BlobRegistryImpl.cpp in Sources */,
+ 2EF1BFEA121C9F4200C27627 /* FileStream.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebCore/html/FileReader.cpp b/WebCore/html/FileReader.cpp
index e99fdc4..d600d40 100644
--- a/WebCore/html/FileReader.cpp
+++ b/WebCore/html/FileReader.cpp
@@ -189,10 +189,10 @@ void FileReader::didGetSize(long long size)
m_streamProxy->openForRead(m_fileBlob->path(), start, m_totalBytes);
}
-void FileReader::didOpen(ExceptionCode ec)
+void FileReader::didOpen(bool success)
{
- if (ec) {
- didFail(ec);
+ if (!success) {
+ didFail(NOT_READABLE_ERR);
return;
}
diff --git a/WebCore/html/FileReader.h b/WebCore/html/FileReader.h
index 2237af5..ee15968 100644
--- a/WebCore/html/FileReader.h
+++ b/WebCore/html/FileReader.h
@@ -89,7 +89,7 @@ public:
// FileStreamClient
virtual void didStart();
virtual void didGetSize(long long);
- virtual void didOpen(ExceptionCode);
+ virtual void didOpen(bool);
virtual void didRead(int);
using RefCounted<FileReader>::ref;
diff --git a/WebCore/html/FileStream.cpp b/WebCore/html/FileStream.cpp
deleted file mode 100644
index a89c67a..0000000
--- a/WebCore/html/FileStream.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(BLOB) || ENABLE(FILE_WRITER)
-
-#include "FileStream.h"
-
-#include "Blob.h"
-#include "PlatformString.h"
-
-namespace WebCore {
-
-FileStream::FileStream()
- : m_handle(invalidPlatformFileHandle)
- , m_bytesProcessed(0)
- , m_totalBytesToRead(0)
-{
-}
-
-FileStream::~FileStream()
-{
- ASSERT(!isHandleValid(m_handle));
-}
-
-// FIXME: To be removed when we switch to using BlobData.
-void FileStream::start()
-{
-}
-
-void FileStream::stop()
-{
- close();
-}
-
-long long FileStream::getSize(const String& path, double expectedModificationTime)
-{
- // Check the modification time for the possible file change.
- time_t modificationTime;
- if (!getFileModificationTime(path, modificationTime))
- return -1;
- if (expectedModificationTime) {
- if (static_cast<time_t>(expectedModificationTime) != modificationTime)
- return -1;
- }
-
- // Now get the file size.
- long long length;
- if (!getFileSize(path, length))
- return -1;
-
- return length;
-}
-
-ExceptionCode FileStream::openForRead(const String& path, long long offset, long long length)
-{
- if (isHandleValid(m_handle))
- return 0;
-
- // Open the file.
- m_handle = openFile(path, OpenForRead);
- if (!isHandleValid(m_handle))
- return NOT_READABLE_ERR;
-
- // Jump to the beginning position if the file has been sliced.
- if (offset > 0) {
- if (seekFile(m_handle, offset, SeekFromBeginning) < 0)
- return NOT_READABLE_ERR;
- }
-
- m_totalBytesToRead = length;
- m_bytesProcessed = 0;
-
- return 0;
-}
-
-ExceptionCode FileStream::openForWrite(const String&)
-{
- // FIXME: to be implemented.
- return NOT_SUPPORTED_ERR;
-}
-
-void FileStream::close()
-{
- if (isHandleValid(m_handle)) {
- closeFile(m_handle);
- m_handle = invalidPlatformFileHandle;
- }
-}
-
-int FileStream::read(char* buffer, int bufferSize)
-{
- if (!isHandleValid(m_handle))
- return -1;
-
- long long remaining = m_totalBytesToRead - m_bytesProcessed;
- int bytesToRead = (remaining < bufferSize) ? static_cast<int>(remaining) : bufferSize;
- int bytesRead = 0;
- if (bytesToRead > 0)
- bytesRead = readFromFile(m_handle, buffer, bytesToRead);
- if (bytesRead < 0)
- return -1;
- if (bytesRead > 0)
- m_bytesProcessed += bytesRead;
-
- return bytesRead;
-}
-
-int FileStream::write(Blob*, long long, int)
-{
- // FIXME: to be implemented.
- return -1;
-}
-
-ExceptionCode FileStream::truncate(long long)
-{
- // FIXME: to be implemented.
- return NOT_SUPPORTED_ERR;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(BLOB) || ENABLE(FILE_WRITER)
diff --git a/WebCore/html/FileStream.h b/WebCore/html/FileStream.h
deleted file mode 100644
index e299fe4..0000000
--- a/WebCore/html/FileStream.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef FileStream_h
-#define FileStream_h
-
-#if ENABLE(BLOB) || ENABLE(FILE_WRITER)
-
-#include "ExceptionCode.h"
-#include "FileSystem.h"
-#include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-
-namespace WebCore {
-
-class Blob;
-
-// All methods are synchronous.
-class FileStream : public RefCounted<FileStream> {
-public:
- static PassRefPtr<FileStream> create()
- {
- return adoptRef(new FileStream());
- }
- virtual ~FileStream();
-
- // FIXME: To be removed when we switch to using BlobData.
- void start();
-
- // Aborts the operation.
- void stop();
-
- // Gets the size of a file. Also validates if the file has been changed or not if the expected modification time is provided, i.e. non-zero.
- // Returns total number of bytes if successful. -1 otherwise.
- long long getSize(const String& path, double expectedModificationTime);
-
- // Opens a file for reading. The reading starts at the specified offset and lasts till the specified length.
- // Returns 0 on success. Exception code otherwise.
- ExceptionCode openForRead(const String& path, long long offset, long long length);
-
- // Opens a file for writing.
- // Returns 0 on success. Exception code otherwise.
- ExceptionCode openForWrite(const String& path);
-
- // Closes the file.
- void close();
-
- // Reads a file into the provided data buffer.
- // Returns number of bytes being read on success. -1 otherwise.
- // If 0 is returned, it means that the reading is completed.
- int read(char* buffer, int length);
-
- // Writes a blob to the file.
- // Returns number of bytes being written on success. -1 otherwise.
- int write(Blob*, long long position, int length);
-
- // Truncates the file to the specified position.
- // Returns 0 on success. Exception code otherwise.
- ExceptionCode truncate(long long position);
-
-private:
- FileStream();
-
- PlatformFileHandle m_handle;
- long long m_bytesProcessed;
- long long m_totalBytesToRead;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(BLOB) || ENABLE(FILE_WRITER)
-
-#endif // FileStream_h
diff --git a/WebCore/html/FileStreamClient.h b/WebCore/html/FileStreamClient.h
index 440d2fb..b3d1fff 100644
--- a/WebCore/html/FileStreamClient.h
+++ b/WebCore/html/FileStreamClient.h
@@ -33,8 +33,6 @@
#if ENABLE(BLOB) || ENABLE(FILE_WRITER)
-#include "ExceptionCode.h"
-
namespace WebCore {
class FileStreamClient {
@@ -44,13 +42,13 @@ public:
// For writing.
virtual void didWrite(int) { }
- virtual void didTruncate(ExceptionCode) { }
+ virtual void didTruncate(bool) { }
// FIXME: To be removed when we switch to using BlobData.
virtual void didStart() { }
// For both reading and writing.
- virtual void didOpen(ExceptionCode) { }
+ virtual void didOpen(bool) { }
virtual void didStop() { }
virtual void didGetSize(long long) { }
diff --git a/WebCore/html/FileStreamProxy.cpp b/WebCore/html/FileStreamProxy.cpp
index f50b7e8..f289c84 100644
--- a/WebCore/html/FileStreamProxy.cpp
+++ b/WebCore/html/FileStreamProxy.cpp
@@ -126,10 +126,10 @@ void FileStreamProxy::getSizeOnFileThread(const String& path, double expectedMod
m_context->postTask(createCallbackTask(&didGetSize, this, size));
}
-static void didOpen(ScriptExecutionContext*, FileStreamProxy* proxy, ExceptionCode ec)
+static void didOpen(ScriptExecutionContext*, FileStreamProxy* proxy, bool success)
{
if (proxy->client())
- proxy->client()->didOpen(ec);
+ proxy->client()->didOpen(success);
}
void FileStreamProxy::openForRead(const String& path, long long offset, long long length)
@@ -139,8 +139,8 @@ void FileStreamProxy::openForRead(const String& path, long long offset, long lon
void FileStreamProxy::openForReadOnFileThread(const String& path, long long offset, long long length)
{
- ExceptionCode ec = m_stream->openForRead(path, offset, length);
- m_context->postTask(createCallbackTask(&didOpen, this, ec));
+ bool success = m_stream->openForRead(path, offset, length);
+ m_context->postTask(createCallbackTask(&didOpen, this, success));
}
void FileStreamProxy::openForWrite(const String& path)
@@ -150,8 +150,8 @@ void FileStreamProxy::openForWrite(const String& path)
void FileStreamProxy::openForWriteOnFileThread(const String& path)
{
- ExceptionCode ec = m_stream->openForWrite(path);
- m_context->postTask(createCallbackTask(&didOpen, this, ec));
+ bool success = m_stream->openForWrite(path);
+ m_context->postTask(createCallbackTask(&didOpen, this, success));
}
void FileStreamProxy::close()
@@ -187,21 +187,21 @@ static void didWrite(ScriptExecutionContext*, FileStreamProxy* proxy, int bytesW
proxy->client()->didWrite(bytesWritten);
}
-void FileStreamProxy::write(Blob* blob, long long position, int length)
+void FileStreamProxy::write(const KURL& blobURL, long long position, int length)
{
- fileThread()->postTask(createFileThreadTask(this, &FileStreamProxy::writeOnFileThread, blob, position, length));
+ fileThread()->postTask(createFileThreadTask(this, &FileStreamProxy::writeOnFileThread, blobURL, position, length));
}
-void FileStreamProxy::writeOnFileThread(Blob* blob, long long position, int length)
+void FileStreamProxy::writeOnFileThread(const KURL& blobURL, long long position, int length)
{
- int bytesWritten = m_stream->write(blob, position, length);
+ int bytesWritten = m_stream->write(blobURL, position, length);
m_context->postTask(createCallbackTask(&didWrite, this, bytesWritten));
}
-static void didTruncate(ScriptExecutionContext*, FileStreamProxy* proxy, ExceptionCode ec)
+static void didTruncate(ScriptExecutionContext*, FileStreamProxy* proxy, bool success)
{
if (proxy->client())
- proxy->client()->didTruncate(ec);
+ proxy->client()->didTruncate(success);
}
void FileStreamProxy::truncate(long long position)
@@ -211,8 +211,8 @@ void FileStreamProxy::truncate(long long position)
void FileStreamProxy::truncateOnFileThread(long long position)
{
- ExceptionCode ec = m_stream->truncate(position);
- m_context->postTask(createCallbackTask(&didTruncate, this, ec));
+ bool success = m_stream->truncate(position);
+ m_context->postTask(createCallbackTask(&didTruncate, this, success));
}
} // namespace WebCore
diff --git a/WebCore/html/FileStreamProxy.h b/WebCore/html/FileStreamProxy.h
index 1d03a58..6dc1cc7 100644
--- a/WebCore/html/FileStreamProxy.h
+++ b/WebCore/html/FileStreamProxy.h
@@ -41,10 +41,10 @@
namespace WebCore {
-class Blob;
class FileStream;
class FileStreamClient;
class FileThread;
+class KURL;
class ScriptExecutionContext;
// A proxy module that asynchronously calls corresponding FileStream methods on the file thread. Note: you must call stop() first and then release the reference to destruct the FileStreamProxy instance.
@@ -58,7 +58,7 @@ public:
void openForWrite(const String& path);
void close();
void read(char* buffer, int length);
- void write(Blob*, long long position, int length);
+ void write(const KURL& blobURL, long long position, int length);
void truncate(long long position);
// Stops the proxy and scedules it to be destructed. All the pending tasks will be aborted and the file stream will be closed.
@@ -80,7 +80,7 @@ private:
void openForWriteOnFileThread(const String& path);
void closeOnFileThread();
void readOnFileThread(char* buffer, int length);
- void writeOnFileThread(Blob*, long long position, int length);
+ void writeOnFileThread(const KURL& blobURL, long long position, int length);
void truncateOnFileThread(long long position);
RefPtr<ScriptExecutionContext> m_context;
diff --git a/WebCore/platform/FileStream.cpp b/WebCore/platform/FileStream.cpp
new file mode 100644
index 0000000..45f435e
--- /dev/null
+++ b/WebCore/platform/FileStream.cpp
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(BLOB) || ENABLE(FILE_WRITER)
+
+#include "FileStream.h"
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+FileStream::FileStream()
+ : m_handle(invalidPlatformFileHandle)
+ , m_bytesProcessed(0)
+ , m_totalBytesToRead(0)
+{
+}
+
+FileStream::~FileStream()
+{
+ ASSERT(!isHandleValid(m_handle));
+}
+
+// FIXME: To be removed when we switch to using BlobData.
+void FileStream::start()
+{
+}
+
+void FileStream::stop()
+{
+ close();
+}
+
+long long FileStream::getSize(const String& path, double expectedModificationTime)
+{
+ // Check the modification time for the possible file change.
+ time_t modificationTime;
+ if (!getFileModificationTime(path, modificationTime))
+ return -1;
+ if (expectedModificationTime) {
+ if (static_cast<time_t>(expectedModificationTime) != modificationTime)
+ return -1;
+ }
+
+ // Now get the file size.
+ long long length;
+ if (!getFileSize(path, length))
+ return -1;
+
+ return length;
+}
+
+bool FileStream::openForRead(const String& path, long long offset, long long length)
+{
+ if (isHandleValid(m_handle))
+ return true;
+
+ // Open the file.
+ m_handle = openFile(path, OpenForRead);
+ if (!isHandleValid(m_handle))
+ return false;
+
+ // Jump to the beginning position if the file has been sliced.
+ if (offset > 0) {
+ if (seekFile(m_handle, offset, SeekFromBeginning) < 0)
+ return false;
+ }
+
+ m_totalBytesToRead = length;
+ m_bytesProcessed = 0;
+
+ return true;
+}
+
+bool FileStream::openForWrite(const String&)
+{
+ // FIXME: to be implemented.
+ return false;
+}
+
+void FileStream::close()
+{
+ if (isHandleValid(m_handle)) {
+ closeFile(m_handle);
+ m_handle = invalidPlatformFileHandle;
+ }
+}
+
+int FileStream::read(char* buffer, int bufferSize)
+{
+ if (!isHandleValid(m_handle))
+ return -1;
+
+ long long remaining = m_totalBytesToRead - m_bytesProcessed;
+ int bytesToRead = (remaining < bufferSize) ? static_cast<int>(remaining) : bufferSize;
+ int bytesRead = 0;
+ if (bytesToRead > 0)
+ bytesRead = readFromFile(m_handle, buffer, bytesToRead);
+ if (bytesRead < 0)
+ return -1;
+ if (bytesRead > 0)
+ m_bytesProcessed += bytesRead;
+
+ return bytesRead;
+}
+
+int FileStream::write(const KURL&, long long, int)
+{
+ // FIXME: to be implemented.
+ return -1;
+}
+
+bool FileStream::truncate(long long)
+{
+ // FIXME: to be implemented.
+ return false;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(BLOB) || ENABLE(FILE_WRITER)
diff --git a/WebCore/platform/FileStream.h b/WebCore/platform/FileStream.h
new file mode 100644
index 0000000..6c3a221
--- /dev/null
+++ b/WebCore/platform/FileStream.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FileStream_h
+#define FileStream_h
+
+#if ENABLE(BLOB) || ENABLE(FILE_WRITER)
+
+#include "FileSystem.h"
+#include <wtf/Forward.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class KURL;
+
+// All methods are synchronous.
+class FileStream : public RefCounted<FileStream> {
+public:
+ static PassRefPtr<FileStream> create()
+ {
+ return adoptRef(new FileStream());
+ }
+ ~FileStream();
+
+ // FIXME: To be removed when we switch to using BlobData.
+ void start();
+
+ // Aborts the operation.
+ void stop();
+
+ // Gets the size of a file. Also validates if the file has been changed or not if the expected modification time is provided, i.e. non-zero.
+ // Returns total number of bytes if successful. -1 otherwise.
+ long long getSize(const String& path, double expectedModificationTime);
+
+ // Opens a file for reading. The reading starts at the specified offset and lasts till the specified length.
+ // Returns true on success. False otherwise.
+ bool openForRead(const String& path, long long offset, long long length);
+
+ // Opens a file for writing.
+ // Returns true on success. False otherwise.
+ bool openForWrite(const String& path);
+
+ // Closes the file.
+ void close();
+
+ // Reads a file into the provided data buffer.
+ // Returns number of bytes being read on success. -1 otherwise.
+ // If 0 is returned, it means that the reading is completed.
+ int read(char* buffer, int length);
+
+ // Writes a blob to the file.
+ // Returns number of bytes being written on success. -1 otherwise.
+ int write(const KURL& blobURL, long long position, int length);
+
+ // Truncates the file to the specified position.
+ // Returns true on success. False otherwise.
+ bool truncate(long long position);
+
+private:
+ FileStream();
+
+ PlatformFileHandle m_handle;
+ long long m_bytesProcessed;
+ long long m_totalBytesToRead;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(BLOB) || ENABLE(FILE_WRITER)
+
+#endif // FileStream_h
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list