| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef DOMFileSystem_h | 31 #ifndef FileSystem_h |
| 32 #define DOMFileSystem_h | 32 #define FileSystem_h |
| 33 | 33 |
| 34 #include "bindings/core/v8/ActiveScriptWrappable.h" | 34 #include "bindings/core/v8/ActiveScriptWrappable.h" |
| 35 #include "bindings/core/v8/ScriptWrappable.h" | 35 #include "bindings/core/v8/ScriptWrappable.h" |
| 36 #include "core/dom/ActiveDOMObject.h" | 36 #include "core/dom/ActiveDOMObject.h" |
| 37 #include "core/dom/ExecutionContext.h" | 37 #include "core/dom/ExecutionContext.h" |
| 38 #include "core/dom/ExecutionContextTask.h" | 38 #include "core/dom/ExecutionContextTask.h" |
| 39 #include "modules/ModulesExport.h" | 39 #include "modules/ModulesExport.h" |
| 40 #include "modules/filesystem/DOMFileSystemBase.h" | 40 #include "modules/filesystem/FileSystemBase.h" |
| 41 #include "modules/filesystem/EntriesCallback.h" | 41 #include "modules/filesystem/FileSystemEntriesCallback.h" |
| 42 #include "platform/heap/Handle.h" | 42 #include "platform/heap/Handle.h" |
| 43 #include "public/platform/WebTraceLocation.h" | 43 #include "public/platform/WebTraceLocation.h" |
| 44 #include "wtf/PtrUtil.h" | 44 #include "wtf/PtrUtil.h" |
| 45 | 45 |
| 46 namespace blink { | 46 namespace blink { |
| 47 | 47 |
| 48 class DirectoryEntry; | |
| 49 class BlobCallback; | 48 class BlobCallback; |
| 50 class FileEntry; | 49 class FileSystemDirectoryEntry; |
| 50 class FileSystemFileEntry; |
| 51 class FileWriterCallback; | 51 class FileWriterCallback; |
| 52 | 52 |
| 53 class MODULES_EXPORT DOMFileSystem final : public DOMFileSystemBase, | 53 class MODULES_EXPORT FileSystem final : public FileSystemBase, |
| 54 public ScriptWrappable, | 54 public ScriptWrappable, |
| 55 public ActiveScriptWrappable, | 55 public ActiveScriptWrappable, |
| 56 public ActiveDOMObject { | 56 public ActiveDOMObject { |
| 57 DEFINE_WRAPPERTYPEINFO(); | 57 DEFINE_WRAPPERTYPEINFO(); |
| 58 USING_GARBAGE_COLLECTED_MIXIN(DOMFileSystem); | 58 USING_GARBAGE_COLLECTED_MIXIN(FileSystem); |
| 59 | 59 |
| 60 public: | 60 public: |
| 61 static DOMFileSystem* create(ExecutionContext*, | 61 static FileSystem* create(ExecutionContext*, |
| 62 const String& name, | 62 const String& name, |
| 63 FileSystemType, | 63 FileSystemType, |
| 64 const KURL& rootURL); | 64 const KURL& rootURL); |
| 65 | 65 |
| 66 // Creates a new isolated file system for the given filesystemId. | 66 // Creates a new isolated file system for the given filesystemId. |
| 67 static DOMFileSystem* createIsolatedFileSystem(ExecutionContext*, | 67 static FileSystem* createIsolatedFileSystem(ExecutionContext*, |
| 68 const String& filesystemId); | 68 const String& filesystemId); |
| 69 | 69 |
| 70 DirectoryEntry* root() const; | 70 FileSystemDirectoryEntry* root() const; |
| 71 | 71 |
| 72 // DOMFileSystemBase overrides. | 72 // FileSystemBase overrides. |
| 73 void addPendingCallbacks() override; | 73 void addPendingCallbacks() override; |
| 74 void removePendingCallbacks() override; | 74 void removePendingCallbacks() override; |
| 75 void reportError(ErrorCallbackBase*, FileError::ErrorCode) override; | 75 void reportError(ErrorCallbackBase*, FileError::ErrorCode) override; |
| 76 | 76 |
| 77 static void reportError(ExecutionContext*, | 77 static void reportError(ExecutionContext*, |
| 78 ErrorCallbackBase*, | 78 ErrorCallbackBase*, |
| 79 FileError::ErrorCode); | 79 FileError::ErrorCode); |
| 80 | 80 |
| 81 // ScriptWrappable overrides. | 81 // ScriptWrappable overrides. |
| 82 bool hasPendingActivity() const final; | 82 bool hasPendingActivity() const final; |
| 83 | 83 |
| 84 void createWriter(const FileEntry*, FileWriterCallback*, ErrorCallbackBase*); | 84 void createWriter(const FileSystemFileEntry*, |
| 85 void createFile(const FileEntry*, BlobCallback*, ErrorCallbackBase*); | 85 FileWriterCallback*, |
| 86 ErrorCallbackBase*); |
| 87 void createFile(const FileSystemFileEntry*, |
| 88 BlobCallback*, |
| 89 ErrorCallbackBase*); |
| 86 | 90 |
| 87 // Schedule a callback. This should not cross threads (should be called on the | 91 // Schedule a callback. This should not cross threads (should be called on the |
| 88 // same context thread). | 92 // same context thread). |
| 89 static void scheduleCallback(ExecutionContext* executionContext, | 93 static void scheduleCallback(ExecutionContext* executionContext, |
| 90 std::unique_ptr<ExecutionContextTask> task) { | 94 std::unique_ptr<ExecutionContextTask> task) { |
| 91 DCHECK(executionContext->isContextThread()); | 95 DCHECK(executionContext->isContextThread()); |
| 92 executionContext->postTask(BLINK_FROM_HERE, std::move(task), | 96 executionContext->postTask(BLINK_FROM_HERE, std::move(task), |
| 93 taskNameForInstrumentation()); | 97 taskNameForInstrumentation()); |
| 94 } | 98 } |
| 95 | 99 |
| 96 DECLARE_VIRTUAL_TRACE(); | 100 DECLARE_VIRTUAL_TRACE(); |
| 97 | 101 |
| 98 private: | 102 private: |
| 99 DOMFileSystem(ExecutionContext*, | 103 FileSystem(ExecutionContext*, |
| 100 const String& name, | 104 const String& name, |
| 101 FileSystemType, | 105 FileSystemType, |
| 102 const KURL& rootURL); | 106 const KURL& rootURL); |
| 103 | 107 |
| 104 static String taskNameForInstrumentation() { return "FileSystem"; } | 108 static String taskNameForInstrumentation() { return "FileSystem"; } |
| 105 | 109 |
| 106 int m_numberOfPendingCallbacks; | 110 int m_numberOfPendingCallbacks; |
| 107 Member<DirectoryEntry> m_rootEntry; | 111 Member<FileSystemDirectoryEntry> m_rootEntry; |
| 108 }; | 112 }; |
| 109 | 113 |
| 110 } // namespace blink | 114 } // namespace blink |
| 111 | 115 |
| 112 #endif // DOMFileSystem_h | 116 #endif // FileSystem_h |
| OLD | NEW |