Changeset 66255 in webkit
- Timestamp:
- Aug 27, 2010 2:15:35 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/CMakeLists.txt
r66223 r66255 1212 1212 1213 1213 platform/Arena.cpp 1214 platform/AsyncFileSystem.cpp 1214 1215 platform/BlobItem.cpp 1215 1216 platform/ContentType.cpp … … 1484 1485 storage/IDBFactoryBackendInterface.cpp 1485 1486 storage/IDBFactoryBackendImpl.cpp 1487 storage/LocalFileSystem.cpp 1486 1488 storage/LocalStorageTask.cpp 1487 1489 storage/LocalStorageThread.cpp -
trunk/WebCore/ChangeLog
r66251 r66255 1 2010-08-27 Kinuko Yasuda <kinuko@chromium.org> 2 3 Reviewed by Darin Fisher. 4 5 Add AsyncFileSystem interface for platform-dependent FileSystem API implementation 6 https://bugs.webkit.org/show_bug.cgi?id=44433 7 8 No new tests; tests will be added later. 9 10 * CMakeLists.txt: 11 * WebCore.gypi: 12 * WebCore.pro: 13 * WebCore.vcproj/WebCore.vcproj: 14 * WebCore.xcodeproj/project.pbxproj: 15 * platform/AsyncFileSystem.cpp: Added. 16 * platform/AsyncFileSystem.h: Added. 17 * platform/AsyncFileSystemCallbacks.h: Added. 18 * storage/DOMFileSystem.cpp: 19 (WebCore::DOMFileSystem::DOMFileSystem): 20 (WebCore::DOMFileSystem::~DOMFileSystem): 21 (WebCore::DOMFileSystem::stop): 22 (WebCore::DOMFileSystem::hasPendingActivity): 23 (WebCore::DOMFileSystem::contextDestroyed): 24 * storage/DOMFileSystem.h: 25 (WebCore::DOMFileSystem::create): 26 * storage/FileSystemCallbacks.cpp: 27 (WebCore::FileSystemCallbacksBase::didFail): 28 (WebCore::FileSystemCallbacks::FileSystemCallbacks): 29 (WebCore::FileSystemCallbacks::didOpenFileSystem): 30 * storage/FileSystemCallbacks.h: 31 * storage/LocalFileSystem.cpp: Added. 32 * storage/LocalFileSystem.h: Added. 33 34 * storage/Flags.h: Nits fix. 35 1 36 2010-07-27 Jer Noble <jer.noble@apple.com> 2 37 -
trunk/WebCore/WebCore.gypi
r66248 r66255 3043 3043 'platform/Arena.h', 3044 3044 'platform/AsyncFileStream.h', 3045 'platform/AsyncFileSystem.cpp', 3046 'platform/AsyncFileSystem.h', 3047 'platform/AsyncFileSystemCallbacks.h', 3045 3048 'platform/AutodrainedPool.h', 3046 3049 'platform/BlobItem.cpp', … … 3639 3642 'storage/IDBTransactionCoordinator.cpp', 3640 3643 'storage/IDBTransactionCoordinator.h', 3644 'storage/LocalFileSystem.h', 3641 3645 'storage/LocalStorageTask.cpp', 3642 3646 'storage/LocalStorageTask.h', -
trunk/WebCore/WebCore.pro
r66223 r66255 875 875 platform/animation/AnimationList.cpp \ 876 876 platform/Arena.cpp \ 877 platform/AsyncFileSystem.cpp \ 877 878 platform/BlobItem.cpp \ 878 879 platform/text/Base64.cpp \ … … 1661 1662 platform/Arena.h \ 1662 1663 platform/AsyncFileStream.h \ 1664 platform/AsyncFileSystem.h \ 1665 platform/AsyncFileSystemCallbacks.h \ 1663 1666 platform/BlobItem.h \ 1664 1667 platform/ContentType.h \ … … 2598 2601 storage/FileSystemCallbacks.h \ 2599 2602 storage/Flags.h \ 2603 storage/LocalFileSystem.h \ 2600 2604 storage/Metadata.h \ 2601 2605 storage/MetadataCallback.h … … 2609 2613 storage/EntryArray.cpp \ 2610 2614 storage/FileEntry.cpp \ 2611 storage/FileSystemCallbacks.cpp 2615 storage/FileSystemCallbacks.cpp \ 2616 storage/LocalFileSystem.cpp 2612 2617 } 2613 2618 -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r66239 r66255 23982 23982 </File> 23983 23983 <File 23984 RelativePath="..\platform\AsyncFileSystem.cpp" 23985 > 23986 </File> 23987 <File 23988 RelativePath="..\platform\AsyncFileSystem.h" 23989 > 23990 </File> 23991 <File 23992 RelativePath="..\platform\AsyncFileSystemCallbacks.h" 23993 > 23994 </File> 23995 <File 23984 23996 RelativePath="..\platform\AutodrainedPool.h" 23985 23997 > … … 51450 51462 </File> 51451 51463 <File 51464 RelativePath="..\storage\LocalFileSystem.cpp" 51465 > 51466 </File> 51467 <File 51468 RelativePath="..\storage\LocalFileSystem.h" 51469 > 51470 </File> 51471 <File 51452 51472 RelativePath="..\storage\LocalStorageTask.cpp" 51453 51473 > -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r66251 r66255 2400 2400 89686C9F122244A00076EAA4 /* DOMFilePath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 89686C9D122244A00076EAA4 /* DOMFilePath.cpp */; }; 2401 2401 89686CA0122244A00076EAA4 /* DOMFilePath.h in Headers */ = {isa = PBXBuildFile; fileRef = 89686C9E122244A00076EAA4 /* DOMFilePath.h */; }; 2402 898783D312232A13003AABDA /* LocalFileSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 898783D112232A13003AABDA /* LocalFileSystem.cpp */; }; 2403 898783D412232A13003AABDA /* LocalFileSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 898783D212232A13003AABDA /* LocalFileSystem.h */; }; 2402 2404 8988E10E11A3508B00DB732E /* BlobItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8988E10C11A3508B00DB732E /* BlobItem.cpp */; }; 2403 2405 8988E10F11A3508B00DB732E /* BlobItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 8988E10D11A3508B00DB732E /* BlobItem.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 2449 2451 89CD029311C85B870070B791 /* JSBlobBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 89CD029111C85B870070B791 /* JSBlobBuilder.cpp */; }; 2450 2452 89CD029411C85B870070B791 /* JSBlobBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 89CD029211C85B870070B791 /* JSBlobBuilder.h */; }; 2453 89D08D9F12228451001241DF /* AsyncFileSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 89D08D9C12228451001241DF /* AsyncFileSystem.cpp */; }; 2454 89D08DA012228451001241DF /* AsyncFileSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 89D08D9D12228451001241DF /* AsyncFileSystem.h */; }; 2455 89D08DA112228451001241DF /* AsyncFileSystemCallbacks.h in Headers */ = {isa = PBXBuildFile; fileRef = 89D08D9E12228451001241DF /* AsyncFileSystemCallbacks.h */; }; 2451 2456 8A12E35D11FA33280025836A /* DocumentLoadTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A12E35C11FA33280025836A /* DocumentLoadTiming.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2452 2457 8A413AE01207BBA50082016E /* AsyncScriptRunner.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A413ADE1207BBA50082016E /* AsyncScriptRunner.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 8295 8300 897A2D91120003760082740C /* JSFlags.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFlags.cpp; sourceTree = "<group>"; }; 8296 8301 897A2D92120003760082740C /* JSFlags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFlags.h; sourceTree = "<group>"; }; 8302 898783D112232A13003AABDA /* LocalFileSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LocalFileSystem.cpp; sourceTree = "<group>"; }; 8303 898783D212232A13003AABDA /* LocalFileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalFileSystem.h; sourceTree = "<group>"; }; 8297 8304 8988E10C11A3508B00DB732E /* BlobItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BlobItem.cpp; sourceTree = "<group>"; }; 8298 8305 8988E10D11A3508B00DB732E /* BlobItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobItem.h; sourceTree = "<group>"; }; … … 8330 8337 89CD029111C85B870070B791 /* JSBlobBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSBlobBuilder.cpp; sourceTree = "<group>"; }; 8331 8338 89CD029211C85B870070B791 /* JSBlobBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBlobBuilder.h; sourceTree = "<group>"; }; 8339 89D08D9C12228451001241DF /* AsyncFileSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AsyncFileSystem.cpp; sourceTree = "<group>"; }; 8340 89D08D9D12228451001241DF /* AsyncFileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncFileSystem.h; sourceTree = "<group>"; }; 8341 89D08D9E12228451001241DF /* AsyncFileSystemCallbacks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncFileSystemCallbacks.h; sourceTree = "<group>"; }; 8332 8342 8A12E35C11FA33280025836A /* DocumentLoadTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentLoadTiming.h; sourceTree = "<group>"; }; 8333 8343 8A413ADE1207BBA50082016E /* AsyncScriptRunner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncScriptRunner.h; sourceTree = "<group>"; }; … … 11694 11704 B6566269120B115A006EA85C /* IDBTransaction.idl */, 11695 11705 B656626D120B116B006EA85C /* IDBTransactionBackendInterface.h */, 11706 898783D112232A13003AABDA /* LocalFileSystem.cpp */, 11707 898783D212232A13003AABDA /* LocalFileSystem.h */, 11696 11708 511F23130DC160DA004F0032 /* LocalStorageTask.cpp */, 11697 11709 511F23140DC160DA004F0032 /* LocalStorageTask.h */, … … 16616 16628 BCFB2F75097A2E1A00BA703D /* Arena.h */, 16617 16629 2EF1BFF6121CB0BD00C27627 /* AsyncFileStream.h */, 16630 89D08D9C12228451001241DF /* AsyncFileSystem.cpp */, 16631 89D08D9D12228451001241DF /* AsyncFileSystem.h */, 16632 89D08D9E12228451001241DF /* AsyncFileSystemCallbacks.h */, 16618 16633 51E1ECB10C91C55600DC255B /* AutodrainedPool.h */, 16619 16634 8988E10C11A3508B00DB732E /* BlobItem.cpp */, … … 20386 20401 8947A83D122234F900D95F2D /* MetadataCallback.h in Headers */, 20387 20402 9F3B947E12241758005304E7 /* ScriptHeapSnapshot.h in Headers */, 20403 89D08DA012228451001241DF /* AsyncFileSystem.h in Headers */, 20404 89D08DA112228451001241DF /* AsyncFileSystemCallbacks.h in Headers */, 20405 898783D412232A13003AABDA /* LocalFileSystem.h in Headers */, 20388 20406 ); 20389 20407 runOnlyForDeploymentPostprocessing = 0; … … 22844 22862 8947A82912222C4700D95F2D /* JSMetadata.cpp in Sources */, 22845 22863 8947A82B12222C4700D95F2D /* JSMetadataCallback.cpp in Sources */, 22864 89D08D9F12228451001241DF /* AsyncFileSystem.cpp in Sources */, 22865 898783D312232A13003AABDA /* LocalFileSystem.cpp in Sources */, 22846 22866 ); 22847 22867 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/platform/FileSystem.h
r65509 r66255 139 139 }; 140 140 141 #if OS(WINDOWS) 142 static const char PlatformFilePathSeparator = '\\'; 143 #else 144 static const char PlatformFilePathSeparator = '/'; 145 #endif 146 141 147 bool fileExists(const String&); 142 148 bool deleteFile(const String&); -
trunk/WebCore/storage/DOMFileSystem.cpp
r65474 r66255 34 34 #if ENABLE(FILE_SYSTEM) 35 35 36 #include "AsyncFileSystem.h" 36 37 #include "DirectoryEntry.h" 38 #include "ScriptExecutionContext.h" 37 39 38 40 namespace WebCore { 39 41 40 DOMFileSystem::DOMFileSystem( const String& name, const String& rootPath)41 : m_rootPath(rootPath)42 DOMFileSystem::DOMFileSystem(ScriptExecutionContext* context, const String& name, PassOwnPtr<AsyncFileSystem> asyncFileSystem) 43 : ActiveDOMObject(context, this) 42 44 , m_name(name) 45 , m_asyncFileSystem(asyncFileSystem) 46 { 47 } 48 49 DOMFileSystem::~DOMFileSystem() 43 50 { 44 51 } … … 49 56 } 50 57 58 void DOMFileSystem::stop() 59 { 60 m_asyncFileSystem->stop(); 61 } 62 63 bool DOMFileSystem::hasPendingActivity() const 64 { 65 return m_asyncFileSystem->hasPendingActivity(); 66 } 67 68 void DOMFileSystem::contextDestroyed() 69 { 70 m_asyncFileSystem->stop(); 71 } 72 51 73 } // namespace 52 74 -
trunk/WebCore/storage/DOMFileSystem.h
r65474 r66255 34 34 #if ENABLE(FILE_SYSTEM) 35 35 36 #include "ActiveDOMObject.h" 37 #include "AsyncFileSystem.h" 38 #include "Flags.h" 36 39 #include "PlatformString.h" 37 40 #include <wtf/PassRefPtr.h> … … 41 44 42 45 class DirectoryEntry; 46 class ScriptExecutionContext; 43 47 44 class DOMFileSystem : public RefCounted<DOMFileSystem> {48 class DOMFileSystem : public RefCounted<DOMFileSystem>, public ActiveDOMObject { 45 49 public: 46 static PassRefPtr<DOMFileSystem> create( const String& name, const String& rootPath)50 static PassRefPtr<DOMFileSystem> create(ScriptExecutionContext* context, const String& name, PassOwnPtr<AsyncFileSystem> asyncFileSystem) 47 51 { 48 return adoptRef(new DOMFileSystem( name, rootPath));52 return adoptRef(new DOMFileSystem(context, name, asyncFileSystem)); 49 53 } 54 55 virtual ~DOMFileSystem(); 50 56 51 57 const String& name() const { return m_name; } 52 58 PassRefPtr<DirectoryEntry> root(); 53 59 60 // ActiveDOMObject methods. 61 virtual void stop(); 62 virtual bool hasPendingActivity() const; 63 virtual void contextDestroyed(); 64 54 65 private: 55 DOMFileSystem( const String& name, const String& rootPath);66 DOMFileSystem(ScriptExecutionContext*, const String& name, PassOwnPtr<AsyncFileSystem>); 56 67 57 String m_rootPath;58 68 String m_name; 69 mutable OwnPtr<AsyncFileSystem> m_asyncFileSystem; 59 70 }; 60 71 -
trunk/WebCore/storage/FileSystemCallbacks.cpp
r65763 r66255 34 34 #if ENABLE(FILE_SYSTEM) 35 35 36 #include "AsyncFileSystem.h" 36 37 #include "DOMFileSystem.h" 37 38 #include "DirectoryEntry.h" … … 66 67 } 67 68 68 void FileSystemCallbacksBase::didOpenFileSystem(const String&, const String&)69 void FileSystemCallbacksBase::didOpenFileSystem(const String&, PassOwnPtr<AsyncFileSystem>) 69 70 { 70 71 // Each subclass must implement an appropriate one. … … 78 79 } 79 80 80 void FileSystemCallbacksBase::didReadDirectory ChunkDone(bool)81 void FileSystemCallbacksBase::didReadDirectoryEntries(bool) 81 82 { 82 83 // Each subclass must implement an appropriate one. … … 90 91 } 91 92 92 void FileSystemCallbacksBase::didFail( ExceptionCodecode)93 void FileSystemCallbacksBase::didFail(int code) 93 94 { 94 95 if (m_errorCallback) { … … 138 139 } 139 140 140 void EntriesCallbacks::didReadDirectory ChunkDone(bool hasMore)141 void EntriesCallbacks::didReadDirectoryEntries(bool hasMore) 141 142 { 142 143 if (m_successCallback) { … … 153 154 // FileSystemCallbacks -------------------------------------------------------- 154 155 155 FileSystemCallbacks::FileSystemCallbacks(PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) 156 : FileSystemCallbacksBase(errorCallback) 157 , m_successCallback(successCallback) 158 { 159 } 160 161 void FileSystemCallbacks::didOpenFileSystem(const String& name, const String& rootPath) 162 { 163 if (m_successCallback) 164 m_successCallback->handleEvent(DOMFileSystem::create(name, rootPath).get()); 156 FileSystemCallbacks::FileSystemCallbacks(PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, ScriptExecutionContext* context) 157 : FileSystemCallbacksBase(errorCallback) 158 , m_successCallback(successCallback) 159 , m_scriptExecutionContext(context) 160 { 161 } 162 163 void FileSystemCallbacks::didOpenFileSystem(const String& name, PassOwnPtr<AsyncFileSystem> asyncFileSystem) 164 { 165 if (m_successCallback) { 166 ASSERT(asyncFileSystem); 167 m_successCallback->handleEvent(DOMFileSystem::create(m_scriptExecutionContext.get(), name, asyncFileSystem.leakPtr()).get()); 168 m_scriptExecutionContext.clear(); 169 } 165 170 m_successCallback.clear(); 166 171 } -
trunk/WebCore/storage/FileSystemCallbacks.h
r65763 r66255 34 34 #if ENABLE(FILE_SYSTEM) 35 35 36 #include "AsyncFileSystemCallbacks.h" 36 37 #include "PlatformString.h" 37 38 #include <wtf/PassRefPtr.h> … … 50 51 class VoidCallback; 51 52 52 typedef int ExceptionCode; 53 54 // A base class for FileSystem callbacks that bundles successCallback, errorCallback and some closure data for the callbacks. 55 class FileSystemCallbacksBase : public Noncopyable { 53 class FileSystemCallbacksBase : public AsyncFileSystemCallbacks { 56 54 public: 57 55 virtual ~FileSystemCallbacksBase(); … … 61 59 62 60 // For FileSystemCallbacks. 63 virtual void didOpenFileSystem(const String& name, const String& rootPath);61 virtual void didOpenFileSystem(const String& name, PassOwnPtr<AsyncFileSystem>); 64 62 65 63 // For MetadataCallbacks. … … 68 66 // For EntriesCallbacks. didReadDirectoryEntry is called each time the API reads an entry, and didReadDirectoryDone is called when a chunk of entries have been read (i.e. good time to call back to the application). If hasMore is true there can be more chunks. 69 67 virtual void didReadDirectoryEntry(const String& name, bool isDirectory); 70 virtual void didReadDirectory ChunkDone(bool hasMore);68 virtual void didReadDirectoryEntries(bool hasMore); 71 69 72 70 // For ErrorCallback. 73 virtual void didFail( ExceptionCodecode);71 virtual void didFail(int code); 74 72 75 73 protected: … … 96 94 EntriesCallbacks(PassRefPtr<EntriesCallback>, PassRefPtr<ErrorCallback>, DOMFileSystem*, const String& basePath); 97 95 virtual void didReadDirectoryEntry(const String& name, bool isDirectory); 98 virtual void didReadDirectory ChunkDone(bool hasMore);96 virtual void didReadDirectoryEntries(bool hasMore); 99 97 100 98 private: … … 107 105 class FileSystemCallbacks : public FileSystemCallbacksBase { 108 106 public: 109 FileSystemCallbacks(PassRefPtr<FileSystemCallback>, PassRefPtr<ErrorCallback> );110 virtual void didOpenFileSystem(const String& name, const String& rootPath);107 FileSystemCallbacks(PassRefPtr<FileSystemCallback>, PassRefPtr<ErrorCallback>, ScriptExecutionContext*); 108 virtual void didOpenFileSystem(const String& name, PassOwnPtr<AsyncFileSystem>); 111 109 112 110 private: 113 111 RefPtr<FileSystemCallback> m_successCallback; 112 RefPtr<ScriptExecutionContext> m_scriptExecutionContext; 114 113 }; 115 114 -
trunk/WebCore/storage/Flags.h
r64414 r66255 34 34 #if ENABLE(FILE_SYSTEM) 35 35 36 #include <wtf/PassRefPtr.h> 36 37 #include <wtf/RefCounted.h> 37 38 -
trunk/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp
r65770 r66255 72 72 for (size_t i = 0; i < entries.size(); ++i) 73 73 m_callbacks->didReadDirectoryEntry(entries[i].name, entries[i].isDirectory); 74 m_callbacks->didReadDirectory ChunkDone(hasMore);74 m_callbacks->didReadDirectoryEntries(hasMore); 75 75 if (!hasMore) 76 76 delete this;
Note: See TracChangeset
for help on using the changeset viewer.