diff options
author | Kristian Monsen <kristianm@google.com> | 2010-09-08 12:18:00 +0100 |
---|---|---|
committer | Kristian Monsen <kristianm@google.com> | 2010-09-11 12:08:58 +0100 |
commit | 5ddde30071f639962dd557c453f2ad01f8f0fd00 (patch) | |
tree | 775803c4ab35af50aa5f5472cd1fb95fe9d5152d /WebCore/storage | |
parent | 3e63d9b33b753ca86d0765d1b3d711114ba9e34f (diff) | |
download | external_webkit-5ddde30071f639962dd557c453f2ad01f8f0fd00.zip external_webkit-5ddde30071f639962dd557c453f2ad01f8f0fd00.tar.gz external_webkit-5ddde30071f639962dd557c453f2ad01f8f0fd00.tar.bz2 |
Merge WebKit at r66666 : Initial merge by git.
Change-Id: I57dedeb49859adc9c539e760f0e749768c66626f
Diffstat (limited to 'WebCore/storage')
51 files changed, 247 insertions, 2295 deletions
diff --git a/WebCore/storage/DOMFilePath.cpp b/WebCore/storage/DOMFilePath.cpp deleted file mode 100644 index 2da057c..0000000 --- a/WebCore/storage/DOMFilePath.cpp +++ /dev/null @@ -1,166 +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" -#include "DOMFilePath.h" - -#if ENABLE(FILE_SYSTEM) - -#include "RegularExpression.h" -#include <wtf/Vector.h> -#include <wtf/text/CString.h> - -namespace WebCore { - -const char DOMFilePath::separator = '/'; -const char DOMFilePath::root[] = "/"; - -String DOMFilePath::append(const String& base, const String& components) -{ - return ensureDirectoryPath(base) + components; -} - -String DOMFilePath::ensureDirectoryPath(const String& path) -{ - if (!DOMFilePath::endsWithSeparator(path)) { - String newPath = path; - newPath.append(DOMFilePath::separator); - return newPath; - } - return path; -} - -String DOMFilePath::getName(const String& path) -{ - int index = path.reverseFind(DOMFilePath::separator); - if (index != -1) - return path.substring(index); - return path; -} - -String DOMFilePath::getDirectory(const String& path) -{ - int index = path.reverseFind(DOMFilePath::separator); - if (index == 0) - return DOMFilePath::root; - if (index != -1) - return path.substring(0, index); - return "."; -} - -bool DOMFilePath::isParentOf(const String& parent, const String& mayBeChild) -{ - ASSERT(DOMFilePath::isAbsolute(parent)); - ASSERT(DOMFilePath::isAbsolute(mayBeChild)); - if (parent == DOMFilePath::root && mayBeChild != DOMFilePath::root) - return true; - if (parent.length() >= mayBeChild.length() || !mayBeChild.startsWith(parent, false)) - return false; - if (mayBeChild[parent.length()] != DOMFilePath::separator) - return false; - return true; -} - -String DOMFilePath::removeExtraParentReferences(const String& path) -{ - ASSERT(DOMFilePath::isAbsolute(path)); - Vector<String> components; - Vector<String> canonicalized; - path.split(DOMFilePath::separator, components); - for (size_t i = 0; i < components.size(); ++i) { - if (components[i] == ".") - continue; - if (components[i] == "..") { - if (canonicalized.size() > 0) - canonicalized.removeLast(); - continue; - } - canonicalized.append(components[i]); - } - if (canonicalized.isEmpty()) - return DOMFilePath::root; - String result; - for (size_t i = 0; i < canonicalized.size(); ++i) { - result.append(DOMFilePath::separator); - result.append(canonicalized[i]); - } - return result; -} - -// Check the naming restrictions defined in FileSystem API 8.3. -// http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#naming-restrictions -bool DOMFilePath::isValidPath(const String& path) -{ - if (path.isEmpty() || path == DOMFilePath::root) - return true; - - // Chars 0-31 in UTF-8 prepresentation are not allowed. - for (size_t i = 0; i < path.length(); ++i) - if (path[i] < 32) - return false; - - // Unallowed names. - DEFINE_STATIC_LOCAL(RegularExpression, unallowedNamesRegExp1, ("(/|^)(CON|PRN|AUX|NUL)([\\./]|$)", TextCaseInsensitive)); - DEFINE_STATIC_LOCAL(RegularExpression, unallowedNamesRegExp2, ("(/|^)(COM|LPT)[1-9]([\\./]|$)", TextCaseInsensitive)); - - if (unallowedNamesRegExp1.match(path) >= 0) - return false; - if (unallowedNamesRegExp2.match(path) >= 0) - return false; - - // Names must not end with period or whitespace. - DEFINE_STATIC_LOCAL(RegularExpression, endingRegExp, ("[\\.\\s](/|$)", TextCaseInsensitive)); - - if (endingRegExp.match(path) >= 0) - return false; - - // Unallowed chars: '\', '<', '>', ':', '?', '*', '"', '|' - // (We don't check '/' here as this method takes paths as its argument.) - DEFINE_STATIC_LOCAL(RegularExpression, unallowedCharsRegExp, ("[\\\\<>:\\?\\*\"|]", TextCaseInsensitive)); - - if (unallowedCharsRegExp.match(path) >= 0) - return false; - - return true; -} - -bool DOMFilePath::isValidName(const String& name) -{ - if (name.isEmpty()) - return true; - // '/' is not allowed in name. - if (name.contains('/')) - return false; - return isValidPath(name); -} - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) diff --git a/WebCore/storage/DOMFilePath.h b/WebCore/storage/DOMFilePath.h deleted file mode 100644 index 2f2bb23..0000000 --- a/WebCore/storage/DOMFilePath.h +++ /dev/null @@ -1,86 +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 DOMFilePath_h -#define DOMFilePath_h - -#include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -// DOMFileSystem path utilities. All methods in this class are static. -class DOMFilePath { -public: - static const char separator; - static const char root[]; - - // Returns the name part from the given path. - static String getName(const String& path); - - // Returns the parent directory path of the given path. - static String getDirectory(const String& path); - - // Checks if a given path is a parent of mayBeChild. This method assumes given paths are absolute and do not have extra references to a parent (i.e. "../"). - static bool isParentOf(const String& path, const String& mayBeChild); - - // Appends the separator at the end of the path if it's not there already. - static String ensureDirectoryPath(const String& path); - - // Returns a new path by appending a separator and the supplied path component to the path. - static String append(const String& path, const String& component); - - static bool isAbsolute(const String& path) - { - return path.startsWith(DOMFilePath::root); - } - - static bool endsWithSeparator(const String& path) - { - return path[path.length() - 1] == DOMFilePath::separator; - } - - // Evaluates all "../" and "./" segments. Note that "/../" expands to "/", so you can't ever refer to anything above the root directory. - static String removeExtraParentReferences(const String& path); - - // Checks if the given path follows the FileSystem API naming restrictions. - static bool isValidPath(const String& path); - - // Checks if the given name follows the FileSystem API naming restrictions. - static bool isValidName(const String& name); - -private: - DOMFilePath() { } -}; - -} // namespace WebCore - -#endif // DOMFilePath_h diff --git a/WebCore/storage/DOMFileSystem.cpp b/WebCore/storage/DOMFileSystem.cpp deleted file mode 100644 index c3dbd34..0000000 --- a/WebCore/storage/DOMFileSystem.cpp +++ /dev/null @@ -1,53 +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" -#include "DOMFileSystem.h" - -#if ENABLE(FILE_SYSTEM) - -#include "DirectoryEntry.h" - -namespace WebCore { - -DOMFileSystem::DOMFileSystem(const String& name, const String& rootPath) - : m_rootPath(rootPath) - , m_name(name) -{ -} - -PassRefPtr<DirectoryEntry> DOMFileSystem::root() -{ - return DirectoryEntry::create(this, "/"); -} - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) diff --git a/WebCore/storage/DOMFileSystem.h b/WebCore/storage/DOMFileSystem.h deleted file mode 100644 index b87aaaf..0000000 --- a/WebCore/storage/DOMFileSystem.h +++ /dev/null @@ -1,65 +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 DOMFileSystem_h -#define DOMFileSystem_h - -#if ENABLE(FILE_SYSTEM) - -#include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class DirectoryEntry; - -class DOMFileSystem : public RefCounted<DOMFileSystem> { -public: - static PassRefPtr<DOMFileSystem> create(const String& name, const String& rootPath) - { - return adoptRef(new DOMFileSystem(name, rootPath)); - } - - const String& name() const { return m_name; } - PassRefPtr<DirectoryEntry> root(); - -private: - DOMFileSystem(const String& name, const String& rootPath); - - String m_rootPath; - String m_name; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // DOMFileSystem_h diff --git a/WebCore/storage/DOMFileSystem.idl b/WebCore/storage/DOMFileSystem.idl deleted file mode 100644 index b7307e2..0000000 --- a/WebCore/storage/DOMFileSystem.idl +++ /dev/null @@ -1,38 +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. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM - ] DOMFileSystem { - readonly attribute DOMString name; - readonly attribute DirectoryEntry root; - }; -} diff --git a/WebCore/storage/DirectoryEntry.cpp b/WebCore/storage/DirectoryEntry.cpp deleted file mode 100644 index 60dcace..0000000 --- a/WebCore/storage/DirectoryEntry.cpp +++ /dev/null @@ -1,66 +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" -#include "DirectoryEntry.h" - -#if ENABLE(FILE_SYSTEM) - -#include "DirectoryReader.h" -#include "EntryCallback.h" -#include "ErrorCallback.h" - -namespace WebCore { - -DirectoryEntry::DirectoryEntry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath) - : Entry(fileSystem, fullPath) -{ -} - -PassRefPtr<DirectoryReader> DirectoryEntry::createReader() -{ - return DirectoryReader::create(m_fileSystem, m_fullPath); -} - -void DirectoryEntry::getFile(const String&, PassRefPtr<Flags>, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>) -{ - // FIXME: to be implemented. - ASSERT_NOT_REACHED(); -} - -void DirectoryEntry::getDirectory(const String&, PassRefPtr<Flags>, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>) -{ - // FIXME: to be implemented. - ASSERT_NOT_REACHED(); -} - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) diff --git a/WebCore/storage/DirectoryEntry.h b/WebCore/storage/DirectoryEntry.h deleted file mode 100644 index 2ae4fb5..0000000 --- a/WebCore/storage/DirectoryEntry.h +++ /dev/null @@ -1,68 +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 DirectoryEntry_h -#define DirectoryEntry_h - -#if ENABLE(FILE_SYSTEM) - -#include "Entry.h" -#include "Flags.h" -#include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class DirectoryReader; -class EntryCallback; -class ErrorCallback; - -class DirectoryEntry : public Entry { -public: - static PassRefPtr<DirectoryEntry> create(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath) - { - return adoptRef(new DirectoryEntry(fileSystem, fullPath)); - } - virtual bool isDirectory() const { return true; } - - PassRefPtr<DirectoryReader> createReader(); - void getFile(const String& path, PassRefPtr<Flags> options = 0, PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); - void getDirectory(const String& path, PassRefPtr<Flags> options = 0, PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); - -private: - DirectoryEntry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath); -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // DirectoryEntry_h diff --git a/WebCore/storage/DirectoryEntry.idl b/WebCore/storage/DirectoryEntry.idl deleted file mode 100644 index ac30c7f..0000000 --- a/WebCore/storage/DirectoryEntry.idl +++ /dev/null @@ -1,41 +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. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - GenerateNativeConverter, - GenerateToJS - ] DirectoryEntry : Entry { - DirectoryReader createReader(); - void getFile(in DOMString path, in [Optional] Flags options, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - void getDirectory(in DOMString path, in [Optional] Flags options, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - }; -} diff --git a/WebCore/storage/DirectoryReader.cpp b/WebCore/storage/DirectoryReader.cpp deleted file mode 100644 index 0b30f70..0000000 --- a/WebCore/storage/DirectoryReader.cpp +++ /dev/null @@ -1,56 +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" -#include "DirectoryReader.h" - -#if ENABLE(FILE_SYSTEM) - -#include "DOMFileSystem.h" -#include "EntriesCallback.h" -#include "ErrorCallback.h" - -namespace WebCore { - -DirectoryReader::DirectoryReader(PassRefPtr<DOMFileSystem> fileSystem, const String& path) - : m_fileSystem(fileSystem) - , m_path(path) -{ -} - -void DirectoryReader::readEntries(PassRefPtr<EntriesCallback>, PassRefPtr<ErrorCallback>) -{ - // FIXME: to be implemented. - ASSERT_NOT_REACHED(); -} - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) diff --git a/WebCore/storage/DirectoryReader.h b/WebCore/storage/DirectoryReader.h deleted file mode 100644 index cf5da8f..0000000 --- a/WebCore/storage/DirectoryReader.h +++ /dev/null @@ -1,66 +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 DirectoryReader_h -#define DirectoryReader_h - -#if ENABLE(FILE_SYSTEM) - -#include "DOMFileSystem.h" -#include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class EntriesCallback; -class ErrorCallback; - -class DirectoryReader : public RefCounted<DirectoryReader> { -public: - static PassRefPtr<DirectoryReader> create(PassRefPtr<DOMFileSystem> fileSystem, const String& path) - { - return adoptRef(new DirectoryReader(fileSystem, path)); - } - - void readEntries(PassRefPtr<EntriesCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback = 0); - -private: - DirectoryReader(PassRefPtr<DOMFileSystem> fileSystem, const String& path); - - RefPtr<DOMFileSystem> m_fileSystem; - String m_path; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // DirectoryReader_h diff --git a/WebCore/storage/DirectoryReader.idl b/WebCore/storage/DirectoryReader.idl deleted file mode 100644 index c3c7012..0000000 --- a/WebCore/storage/DirectoryReader.idl +++ /dev/null @@ -1,37 +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. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM - ] DirectoryReader { - void readEntries(in [Callback] EntriesCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - }; -} diff --git a/WebCore/storage/EntriesCallback.h b/WebCore/storage/EntriesCallback.h deleted file mode 100644 index 9f812e9..0000000 --- a/WebCore/storage/EntriesCallback.h +++ /dev/null @@ -1,52 +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 EntriesCallback_h -#define EntriesCallback_h - -#if ENABLE(FILE_SYSTEM) - -#include <wtf/RefCounted.h> - -namespace WebCore { - -class EntryArray; - -class EntriesCallback : public RefCounted<EntriesCallback> { -public: - virtual ~EntriesCallback() { } - virtual bool handleEvent(EntryArray*) = 0; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // EntriesCallback_h diff --git a/WebCore/storage/EntriesCallback.idl b/WebCore/storage/EntriesCallback.idl deleted file mode 100644 index 73b374d..0000000 --- a/WebCore/storage/EntriesCallback.idl +++ /dev/null @@ -1,38 +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. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - Callback - ] EntriesCallback { - boolean handleEvent(in EntryArray entries); - }; -} diff --git a/WebCore/storage/Entry.cpp b/WebCore/storage/Entry.cpp deleted file mode 100644 index 6783291..0000000 --- a/WebCore/storage/Entry.cpp +++ /dev/null @@ -1,93 +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" -#include "Entry.h" - -#if ENABLE(FILE_SYSTEM) - -#include "DOMFileSystem.h" -#include "EntryCallback.h" -#include "ErrorCallback.h" -#include "MetadataCallback.h" -#include "VoidCallback.h" - -namespace WebCore { - -Entry::Entry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath) - : m_fileSystem(fileSystem) - , m_fullPath(fullPath) -{ - size_t index = fullPath.reverseFind("/"); - if (index != notFound) - m_name = fullPath.substring(index); - else - m_name = fullPath; -} - -void Entry::getMetadata(PassRefPtr<MetadataCallback>, PassRefPtr<ErrorCallback>) -{ - // FIXME: to be implemented. - ASSERT_NOT_REACHED(); -} - -void Entry::moveTo(PassRefPtr<Entry>, const String&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>) -{ - // FIXME: to be implemented. - ASSERT_NOT_REACHED(); -} - -void Entry::copyTo(PassRefPtr<Entry>, const String&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>) -{ - // FIXME: to be implemented. - ASSERT_NOT_REACHED(); -} - -void Entry::remove(PassRefPtr<VoidCallback>, PassRefPtr<ErrorCallback>) -{ - // FIXME: to be implemented. - ASSERT_NOT_REACHED(); -} - -void Entry::getParent(PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>) -{ - // FIXME: to be implemented. - ASSERT_NOT_REACHED(); -} - -String Entry::toURI(const String&) -{ - // FIXME: to be implemented. - ASSERT_NOT_REACHED(); - return String(); -} - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) diff --git a/WebCore/storage/Entry.h b/WebCore/storage/Entry.h deleted file mode 100644 index 7bbb265..0000000 --- a/WebCore/storage/Entry.h +++ /dev/null @@ -1,80 +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 Entry_h -#define Entry_h - -#if ENABLE(FILE_SYSTEM) - -#include "DOMFileSystem.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class EntryCallback; -class ErrorCallback; -class MetadataCallback; -class VoidCallback; - -class Entry : public RefCounted<Entry> { -public: - virtual ~Entry() { } - - virtual bool isFile() const { return false; } - virtual bool isDirectory() const { return false; } - - const String& fullPath() const { return m_fullPath; } - const String& name() const { return m_name; } - - DOMFileSystem* filesystem() const { return m_fileSystem.get(); } - - virtual void getMetadata(PassRefPtr<MetadataCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); - - virtual void moveTo(PassRefPtr<Entry> parent, const String& name = String(), PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); - virtual void copyTo(PassRefPtr<Entry> parent, const String& name = String(), PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); - virtual void remove(PassRefPtr<VoidCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); - virtual void getParent(PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); - - virtual String toURI(const String& mimeType = String()); - -protected: - Entry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath); - - RefPtr<DOMFileSystem> m_fileSystem; - String m_fullPath; // virtual path - String m_name; -}; - -} // namespace WebCore - -#endif // ENABLE(FILE_SYSTEM) - -#endif // Entry_h diff --git a/WebCore/storage/Entry.idl b/WebCore/storage/Entry.idl deleted file mode 100644 index 7d4ffee..0000000 --- a/WebCore/storage/Entry.idl +++ /dev/null @@ -1,47 +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. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM - ] Entry { - readonly attribute boolean isFile; - readonly attribute boolean isDirectory; - readonly attribute DOMString name; - readonly attribute DOMString fullPath; - readonly attribute DOMFileSystem filesystem; - - void moveTo(in Entry parent, in [Optional] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - void copyTo(in Entry parent, in [Optional] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - void remove(in [Optional, Callback] VoidCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - void getParent(in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - DOMString toURI(in [Optional] DOMString mimeType); - }; -} diff --git a/WebCore/storage/EntryArray.cpp b/WebCore/storage/EntryArray.cpp deleted file mode 100644 index 6c4f74f..0000000 --- a/WebCore/storage/EntryArray.cpp +++ /dev/null @@ -1,51 +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" -#include "EntryArray.h" - -#if ENABLE(FILE_SYSTEM) - -namespace WebCore { - -EntryArray::EntryArray() -{ -} - -Entry* EntryArray::item(unsigned index) const -{ - if (index >= m_entries.size()) - return 0; - return m_entries[index].get(); -} - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) diff --git a/WebCore/storage/EntryArray.h b/WebCore/storage/EntryArray.h deleted file mode 100644 index e5957ab..0000000 --- a/WebCore/storage/EntryArray.h +++ /dev/null @@ -1,67 +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 EntryArray_h -#define EntryArray_h - -#if ENABLE(FILE_SYSTEM) - -#include "Entry.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class EntryArray : public RefCounted<EntryArray> { -public: - static PassRefPtr<EntryArray> create() - { - return adoptRef(new EntryArray()); - } - - unsigned length() const { return m_entries.size(); } - Entry* item(unsigned index) const; - void set(unsigned index, PassRefPtr<Entry> entry); - - bool isEmpty() const { return m_entries.isEmpty(); } - void clear() { m_entries.clear(); } - void append(PassRefPtr<Entry> entry) { m_entries.append(entry); } - -private: - EntryArray(); - - Vector<RefPtr<Entry> > m_entries; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // EntryArray_h diff --git a/WebCore/storage/EntryArray.idl b/WebCore/storage/EntryArray.idl deleted file mode 100644 index e987ece..0000000 --- a/WebCore/storage/EntryArray.idl +++ /dev/null @@ -1,39 +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. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - HasIndexGetter, - ] EntryArray { - readonly attribute unsigned long length; - Entry item(in [IsIndex] unsigned long index); - }; -} diff --git a/WebCore/storage/EntryCallback.h b/WebCore/storage/EntryCallback.h deleted file mode 100644 index 9580eda..0000000 --- a/WebCore/storage/EntryCallback.h +++ /dev/null @@ -1,52 +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 EntryCallback_h -#define EntryCallback_h - -#if ENABLE(FILE_SYSTEM) - -#include <wtf/RefCounted.h> - -namespace WebCore { - -class Entry; - -class EntryCallback : public RefCounted<EntryCallback> { -public: - virtual ~EntryCallback() { } - virtual bool handleEvent(Entry*) = 0; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // EntryCallback_h diff --git a/WebCore/storage/EntryCallback.idl b/WebCore/storage/EntryCallback.idl deleted file mode 100644 index bea3fd1..0000000 --- a/WebCore/storage/EntryCallback.idl +++ /dev/null @@ -1,38 +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. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - Callback - ] EntryCallback { - boolean handleEvent(in Entry entry); - }; -} diff --git a/WebCore/storage/ErrorCallback.h b/WebCore/storage/ErrorCallback.h deleted file mode 100644 index 91143e8..0000000 --- a/WebCore/storage/ErrorCallback.h +++ /dev/null @@ -1,53 +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 ErrorCallback_h -#define ErrorCallback_h - -#if ENABLE(FILE_SYSTEM) - -#include <wtf/RefCounted.h> - -namespace WebCore { - -class FileError; -class ScriptExecutionContext; - -class ErrorCallback : public RefCounted<ErrorCallback> { -public: - virtual ~ErrorCallback() { } - virtual bool handleEvent(FileError*) = 0; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // ErrorCallback_h diff --git a/WebCore/storage/ErrorCallback.idl b/WebCore/storage/ErrorCallback.idl deleted file mode 100644 index fc7fa85..0000000 --- a/WebCore/storage/ErrorCallback.idl +++ /dev/null @@ -1,38 +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. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - Callback - ] ErrorCallback { - boolean handleEvent(in FileError error); - }; -} diff --git a/WebCore/storage/FileEntry.cpp b/WebCore/storage/FileEntry.cpp deleted file mode 100644 index 4bec01d..0000000 --- a/WebCore/storage/FileEntry.cpp +++ /dev/null @@ -1,45 +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" -#include "FileEntry.h" - -#if ENABLE(FILE_SYSTEM) - -namespace WebCore { - -FileEntry::FileEntry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath) - : Entry(fileSystem, fullPath) -{ -} - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) diff --git a/WebCore/storage/FileEntry.h b/WebCore/storage/FileEntry.h deleted file mode 100644 index b02b5c7..0000000 --- a/WebCore/storage/FileEntry.h +++ /dev/null @@ -1,61 +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 FileEntry_h -#define FileEntry_h - -#if ENABLE(FILE_SYSTEM) - -#include "Entry.h" -#include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class DOMFileSystem; - -class FileEntry : public Entry { -public: - static PassRefPtr<FileEntry> create(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath) - { - return adoptRef(new FileEntry(fileSystem, fullPath)); - } - virtual bool isFile() const { return true; } - -private: - FileEntry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath); -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // FileEntry_h diff --git a/WebCore/storage/FileEntry.idl b/WebCore/storage/FileEntry.idl deleted file mode 100644 index af3b807..0000000 --- a/WebCore/storage/FileEntry.idl +++ /dev/null @@ -1,38 +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. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - GenerateNativeConverter, - GenerateToJS - ] FileEntry : Entry { - }; -} diff --git a/WebCore/storage/FileSystemCallback.h b/WebCore/storage/FileSystemCallback.h deleted file mode 100644 index 63f8416..0000000 --- a/WebCore/storage/FileSystemCallback.h +++ /dev/null @@ -1,52 +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 FileSystemCallback_h -#define FileSystemCallback_h - -#if ENABLE(FILE_SYSTEM) - -#include <wtf/RefCounted.h> - -namespace WebCore { - -class DOMFileSystem; - -class FileSystemCallback : public RefCounted<FileSystemCallback> { -public: - virtual ~FileSystemCallback() { } - virtual bool handleEvent(DOMFileSystem*) = 0; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // FileSystemCallback_h diff --git a/WebCore/storage/FileSystemCallback.idl b/WebCore/storage/FileSystemCallback.idl deleted file mode 100644 index cf686ff..0000000 --- a/WebCore/storage/FileSystemCallback.idl +++ /dev/null @@ -1,38 +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. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - Callback - ] FileSystemCallback { - boolean handleEvent(in DOMFileSystem fileSystem); - }; -} diff --git a/WebCore/storage/FileSystemCallbacks.cpp b/WebCore/storage/FileSystemCallbacks.cpp deleted file mode 100644 index ec352dd..0000000 --- a/WebCore/storage/FileSystemCallbacks.cpp +++ /dev/null @@ -1,200 +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" -#include "FileSystemCallbacks.h" - -#if ENABLE(FILE_SYSTEM) - -#include "DOMFileSystem.h" -#include "DirectoryEntry.h" -#include "EntriesCallback.h" -#include "EntryArray.h" -#include "EntryCallback.h" -#include "ErrorCallback.h" -#include "ExceptionCode.h" -#include "FileEntry.h" -#include "FileError.h" -#include "FileSystemCallback.h" -#include "Metadata.h" -#include "MetadataCallback.h" -#include "ScriptExecutionContext.h" -#include "VoidCallback.h" - -namespace WebCore { - -FileSystemCallbacksBase::FileSystemCallbacksBase(PassRefPtr<ErrorCallback> errorCallback) - : m_errorCallback(errorCallback) -{ -} - -FileSystemCallbacksBase::~FileSystemCallbacksBase() -{ -} - -void FileSystemCallbacksBase::didSucceed() -{ - // Each subclass must implement an appropriate one. - ASSERT_NOT_REACHED(); -} - -void FileSystemCallbacksBase::didOpenFileSystem(const String&, const String&) -{ - // Each subclass must implement an appropriate one. - ASSERT_NOT_REACHED(); -} - -void FileSystemCallbacksBase::didReadMetadata(double) -{ - // Each subclass must implement an appropriate one. - ASSERT_NOT_REACHED(); -} - -void FileSystemCallbacksBase::didReadDirectoryChunkDone(bool) -{ - // Each subclass must implement an appropriate one. - ASSERT_NOT_REACHED(); -} - -void FileSystemCallbacksBase::didReadDirectoryEntry(const String&, bool) -{ - // Each subclass must implement an appropriate one. - ASSERT_NOT_REACHED(); -} - -void FileSystemCallbacksBase::didFail(ExceptionCode code) -{ - if (m_errorCallback) { - m_errorCallback->handleEvent(FileError::create(code).get()); - m_errorCallback.clear(); - } -} - -// EntryCallbacks ------------------------------------------------------------- - -EntryCallbacks::EntryCallbacks(PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, DOMFileSystem* fileSystem, const String& expectedPath, bool isDirectory) - : FileSystemCallbacksBase(errorCallback) - , m_successCallback(successCallback) - , m_fileSystem(fileSystem) - , m_expectedPath(expectedPath) - , m_isDirectory(isDirectory) -{ -} - -void EntryCallbacks::didSucceed() -{ - if (m_successCallback) { - if (m_isDirectory) - m_successCallback->handleEvent(DirectoryEntry::create(m_fileSystem, m_expectedPath).get()); - else - m_successCallback->handleEvent(FileEntry::create(m_fileSystem, m_expectedPath).get()); - } - m_successCallback.clear(); -} - -// EntriesCallbacks ----------------------------------------------------------- - -EntriesCallbacks::EntriesCallbacks(PassRefPtr<EntriesCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, DOMFileSystem* fileSystem, const String& basePath) - : FileSystemCallbacksBase(errorCallback) - , m_successCallback(successCallback) - , m_fileSystem(fileSystem) - , m_basePath(basePath) -{ -} - -void EntriesCallbacks::didReadDirectoryEntry(const String& name, bool isDirectory) -{ - if (isDirectory) - m_entries->append(DirectoryEntry::create(m_fileSystem, m_basePath + "/" + name)); - else - m_entries->append(FileEntry::create(m_fileSystem, m_basePath + "/" + name)); -} - -void EntriesCallbacks::didReadDirectoryChunkDone(bool hasMore) -{ - if (m_successCallback) { - m_successCallback->handleEvent(m_entries.get()); - m_entries->clear(); - if (!hasMore) { - // If there're no more entries, call back once more with an empty array. - m_successCallback->handleEvent(m_entries.get()); - m_successCallback.clear(); - } - } -} - -// FileSystemCallbacks -------------------------------------------------------- - -FileSystemCallbacks::FileSystemCallbacks(PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) - : FileSystemCallbacksBase(errorCallback) - , m_successCallback(successCallback) -{ -} - -void FileSystemCallbacks::didOpenFileSystem(const String& name, const String& rootPath) -{ - if (m_successCallback) - m_successCallback->handleEvent(DOMFileSystem::create(name, rootPath).get()); - m_successCallback.clear(); -} - -// MetadataCallbacks ---------------------------------------------------------- - -MetadataCallbacks::MetadataCallbacks(PassRefPtr<MetadataCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) - : FileSystemCallbacksBase(errorCallback) - , m_successCallback(successCallback) -{ -} - -void MetadataCallbacks::didReadMetadata(double modificationTime) -{ - if (m_successCallback) - m_successCallback->handleEvent(Metadata::create(modificationTime).get()); - m_successCallback.clear(); -} - -// VoidCallbacks -------------------------------------------------------------- - -VoidCallbacks::VoidCallbacks(PassRefPtr<VoidCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) - : FileSystemCallbacksBase(errorCallback) - , m_successCallback(successCallback) -{ -} - -void VoidCallbacks::didSucceed() -{ - if (m_successCallback) - m_successCallback->handleEvent(); - m_successCallback.clear(); -} - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) diff --git a/WebCore/storage/FileSystemCallbacks.h b/WebCore/storage/FileSystemCallbacks.h deleted file mode 100644 index e0e78d3..0000000 --- a/WebCore/storage/FileSystemCallbacks.h +++ /dev/null @@ -1,138 +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 FileSystemCallbacks_h -#define FileSystemCallbacks_h - -#if ENABLE(FILE_SYSTEM) - -#include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/Vector.h> - -namespace WebCore { - -class DOMFileSystem; -class ErrorCallback; -class EntriesCallback; -class EntryArray; -class EntryCallback; -class FileSystemCallback; -class MetadataCallback; -class ScriptExecutionContext; -class VoidCallback; - -typedef int ExceptionCode; - -// A base class for FileSystem callbacks that bundles successCallback, errorCallback and some closure data for the callbacks. -class FileSystemCallbacksBase : public Noncopyable { -public: - virtual ~FileSystemCallbacksBase(); - - // For EntryCallbacks and VoidCallbacks. - virtual void didSucceed(); - - // For FileSystemCallbacks. - virtual void didOpenFileSystem(const String& name, const String& rootPath); - - // For MetadataCallbacks. - virtual void didReadMetadata(double modificationTime); - - // 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. - virtual void didReadDirectoryEntry(const String& name, bool isDirectory); - virtual void didReadDirectoryChunkDone(bool hasMore); - - // For ErrorCallback. - virtual void didFail(ExceptionCode code); - -protected: - FileSystemCallbacksBase(PassRefPtr<ErrorCallback> errorCallback); - RefPtr<ErrorCallback> m_errorCallback; -}; - -// Subclasses ---------------------------------------------------------------- - -class EntryCallbacks : public FileSystemCallbacksBase { -public: - EntryCallbacks(PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>, DOMFileSystem*, const String& expectedPath, bool isDirectory); - virtual void didSucceed(); - -private: - RefPtr<EntryCallback> m_successCallback; - DOMFileSystem* m_fileSystem; - String m_expectedPath; - bool m_isDirectory; -}; - -class EntriesCallbacks : public FileSystemCallbacksBase { -public: - EntriesCallbacks(PassRefPtr<EntriesCallback>, PassRefPtr<ErrorCallback>, DOMFileSystem*, const String& basePath); - virtual void didReadDirectoryEntry(const String& name, bool isDirectory); - virtual void didReadDirectoryChunkDone(bool hasMore); - -private: - RefPtr<EntriesCallback> m_successCallback; - DOMFileSystem* m_fileSystem; - String m_basePath; - RefPtr<EntryArray> m_entries; -}; - -class FileSystemCallbacks : public FileSystemCallbacksBase { -public: - FileSystemCallbacks(PassRefPtr<FileSystemCallback>, PassRefPtr<ErrorCallback>); - virtual void didOpenFileSystem(const String& name, const String& rootPath); - -private: - RefPtr<FileSystemCallback> m_successCallback; -}; - -class MetadataCallbacks : public FileSystemCallbacksBase { -public: - MetadataCallbacks(PassRefPtr<MetadataCallback>, PassRefPtr<ErrorCallback>); - virtual void didReadMetadata(double modificationTime); - -private: - RefPtr<MetadataCallback> m_successCallback; -}; - -class VoidCallbacks : public FileSystemCallbacksBase { -public: - VoidCallbacks(PassRefPtr<VoidCallback>, PassRefPtr<ErrorCallback>); - virtual void didSucceed(); - -private: - RefPtr<VoidCallback> m_successCallback; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // FileSystemCallbacks_h diff --git a/WebCore/storage/Flags.h b/WebCore/storage/Flags.h deleted file mode 100644 index ffe3403..0000000 --- a/WebCore/storage/Flags.h +++ /dev/null @@ -1,66 +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 Flags_h -#define Flags_h - -#if ENABLE(FILE_SYSTEM) - -#include <wtf/RefCounted.h> - -namespace WebCore { - -class Flags : public RefCounted<Flags> { -public: - static PassRefPtr<Flags> create(bool create = false, bool exclusive = false) - { - return adoptRef(new Flags(create, exclusive)); - } - - bool isCreate() const { return m_create; } - void setCreate(bool create) { m_create = create; } - bool isExclusive() const { return m_exclusive; } - void setExclusive(bool exclusive) { m_exclusive = exclusive; } - -private: - Flags(bool create, bool exclusive) - : m_create(create) - , m_exclusive(exclusive) - { - } - bool m_create; - bool m_exclusive; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // Flags_h diff --git a/WebCore/storage/Flags.idl b/WebCore/storage/Flags.idl deleted file mode 100644 index cfe73d2..0000000 --- a/WebCore/storage/Flags.idl +++ /dev/null @@ -1,38 +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. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM - ] Flags { - attribute boolean CREATE; - attribute boolean EXCLUSIVE; - }; -} diff --git a/WebCore/storage/IDBCursor.cpp b/WebCore/storage/IDBCursor.cpp index de752f5..ae0d127 100644 --- a/WebCore/storage/IDBCursor.cpp +++ b/WebCore/storage/IDBCursor.cpp @@ -59,7 +59,7 @@ PassRefPtr<IDBKey> IDBCursor::key() const PassRefPtr<IDBAny> IDBCursor::value() const { - return m_backend->value(); + return IDBAny::create(m_backend->value().get()); } PassRefPtr<IDBRequest> IDBCursor::update(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value) diff --git a/WebCore/storage/IDBCursorBackendImpl.cpp b/WebCore/storage/IDBCursorBackendImpl.cpp index d3298b3..4cbac0e 100644 --- a/WebCore/storage/IDBCursorBackendImpl.cpp +++ b/WebCore/storage/IDBCursorBackendImpl.cpp @@ -28,23 +28,26 @@ #if ENABLE(INDEXED_DATABASE) -#include "IDBAny.h" #include "IDBCallbacks.h" +#include "IDBDatabaseBackendImpl.h" +#include "IDBDatabaseError.h" +#include "IDBDatabaseException.h" #include "IDBKeyRange.h" #include "IDBObjectStoreBackendImpl.h" #include "IDBRequest.h" #include "SQLiteDatabase.h" +#include "SQLiteStatement.h" #include "SerializedScriptValue.h" namespace WebCore { -IDBCursorBackendImpl::IDBCursorBackendImpl(PassRefPtr<IDBObjectStoreBackendImpl> idbObjectStore, PassRefPtr<IDBKeyRange> keyRange, IDBCursor::Direction direction, PassRefPtr<IDBKey> key, PassRefPtr<SerializedScriptValue> value) +IDBCursorBackendImpl::IDBCursorBackendImpl(PassRefPtr<IDBObjectStoreBackendImpl> idbObjectStore, PassRefPtr<IDBKeyRange> keyRange, IDBCursor::Direction direction, PassOwnPtr<SQLiteStatement> query) : m_idbObjectStore(idbObjectStore) , m_keyRange(keyRange) , m_direction(direction) - , m_key(key) - , m_value(IDBAny::create(value.get())) + , m_query(query) { + loadCurrentRow(); } IDBCursorBackendImpl::~IDBCursorBackendImpl() @@ -58,30 +61,106 @@ unsigned short IDBCursorBackendImpl::direction() const PassRefPtr<IDBKey> IDBCursorBackendImpl::key() const { - return m_key; + + return m_currentKey; } -PassRefPtr<IDBAny> IDBCursorBackendImpl::value() const +PassRefPtr<SerializedScriptValue> IDBCursorBackendImpl::value() const { - return m_value; + return m_currentValue; } -void IDBCursorBackendImpl::update(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBCallbacks>) +void IDBCursorBackendImpl::update(PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBCallbacks> callbacks) { - // FIXME: Implement this method. - ASSERT_NOT_REACHED(); + RefPtr<SerializedScriptValue> value = prpValue; + + if (!m_query || m_currentId == InvalidId) { + // FIXME: Use the proper error code when it's specced. + callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Operation not possible.")); + return; + } + + String sql = "UPDATE ObjectStoreData SET value = ? WHERE id = ?"; + SQLiteStatement updateQuery(m_idbObjectStore->database()->sqliteDatabase(), sql); + + bool ok = updateQuery.prepare() == SQLResultOk; + ASSERT_UNUSED(ok, ok); // FIXME: Better error handling. + updateQuery.bindText(1, value->toWireString()); + updateQuery.bindInt64(2, m_currentId); + ok = updateQuery.step() == SQLResultDone; + ASSERT_UNUSED(ok, ok); // FIXME: Better error handling. + + m_currentValue = value.release(); + callbacks->onSuccess(); +} + +void IDBCursorBackendImpl::continueFunction(PassRefPtr<IDBKey> prpKey, PassRefPtr<IDBCallbacks> callbacks) +{ + RefPtr<IDBKey> key = prpKey; + while (true) { + if (!m_query || m_query->step() != SQLResultRow) { + m_query = 0; + m_currentId = InvalidId; + m_currentKey = 0; + m_currentValue = 0; + callbacks->onSuccess(); + return; + } + + RefPtr<IDBKey> oldKey = m_currentKey; + loadCurrentRow(); + + // If a key was supplied, we must loop until we find that key (or hit the end). + if (key && !key->isEqual(m_currentKey.get())) + continue; + + // If we don't have a uniqueness constraint, we can stop now. + if (m_direction == IDBCursor::NEXT || m_direction == IDBCursor::PREV) + break; + if (!m_currentKey->isEqual(oldKey.get())) + break; + } + + callbacks->onSuccess(this); } -void IDBCursorBackendImpl::continueFunction(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>) +void IDBCursorBackendImpl::remove(PassRefPtr<IDBCallbacks> callbacks) { - // FIXME: Implement this method. - ASSERT_NOT_REACHED(); + if (!m_query || m_currentId == InvalidId) { + // FIXME: Use the proper error code when it's specced. + callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Operation not possible.")); + return; + } + + String sql = "DELETE FROM ObjectStoreData WHERE id = ?"; + SQLiteStatement deleteQuery(m_idbObjectStore->database()->sqliteDatabase(), sql); + + bool ok = deleteQuery.prepare() == SQLResultOk; + ASSERT_UNUSED(ok, ok); // FIXME: Better error handling. + deleteQuery.bindInt64(1, m_currentId); + ok = deleteQuery.step() == SQLResultDone; + ASSERT_UNUSED(ok, ok); // FIXME: Better error handling. + + m_currentId = InvalidId; + m_currentKey = 0; + m_currentValue = 0; + callbacks->onSuccess(); } -void IDBCursorBackendImpl::remove(PassRefPtr<IDBCallbacks>) +void IDBCursorBackendImpl::loadCurrentRow() { - // FIXME: Implement this method. - ASSERT_NOT_REACHED(); + // The column numbers depend on the query in IDBObjectStoreBackendImpl::openCursor. + m_currentId = m_query->getColumnInt64(0); + if (!m_query->isColumnNull(1)) + m_currentKey = IDBKey::create(m_query->getColumnText(1)); + else if (!m_query->isColumnNull(2)) { + ASSERT_NOT_REACHED(); // FIXME: Implement date. + m_currentKey = IDBKey::create(); + } else if (!m_query->isColumnNull(3)) + m_currentKey = IDBKey::create(m_query->getColumnInt(3)); + else + m_currentKey = IDBKey::create(); + m_currentValue = SerializedScriptValue::createFromWire(m_query->getColumnText(4)); } } // namespace WebCore diff --git a/WebCore/storage/IDBCursorBackendImpl.h b/WebCore/storage/IDBCursorBackendImpl.h index 9ef62fe..3f7c4aa 100644 --- a/WebCore/storage/IDBCursorBackendImpl.h +++ b/WebCore/storage/IDBCursorBackendImpl.h @@ -31,37 +31,46 @@ #include "IDBCursor.h" #include "IDBCursorBackendInterface.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> #include <wtf/RefPtr.h> namespace WebCore { class IDBKeyRange; class IDBObjectStoreBackendImpl; +class SQLiteStatement; class SerializedScriptValue; class IDBCursorBackendImpl : public IDBCursorBackendInterface { public: - static PassRefPtr<IDBCursorBackendImpl> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> keyRange, IDBCursor::Direction direction, PassRefPtr<IDBKey> key, PassRefPtr<SerializedScriptValue> value) + static PassRefPtr<IDBCursorBackendImpl> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> keyRange, IDBCursor::Direction direction, PassOwnPtr<SQLiteStatement> query) { - return adoptRef(new IDBCursorBackendImpl(objectStore, keyRange, direction, key, value)); + return adoptRef(new IDBCursorBackendImpl(objectStore, keyRange, direction, query)); } virtual ~IDBCursorBackendImpl(); virtual unsigned short direction() const; virtual PassRefPtr<IDBKey> key() const; - virtual PassRefPtr<IDBAny> value() const; + virtual PassRefPtr<SerializedScriptValue> value() const; virtual void update(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBCallbacks>); virtual void continueFunction(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>); virtual void remove(PassRefPtr<IDBCallbacks>); private: - IDBCursorBackendImpl(PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, IDBCursor::Direction, PassRefPtr<IDBKey>, PassRefPtr<SerializedScriptValue>); + IDBCursorBackendImpl(PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, IDBCursor::Direction, PassOwnPtr<SQLiteStatement> query); + + void loadCurrentRow(); + + static const int64_t InvalidId = -1; RefPtr<IDBObjectStoreBackendImpl> m_idbObjectStore; RefPtr<IDBKeyRange> m_keyRange; IDBCursor::Direction m_direction; - RefPtr<IDBKey> m_key; - RefPtr<IDBAny> m_value; + OwnPtr<SQLiteStatement> m_query; + int64_t m_currentId; + RefPtr<IDBKey> m_currentKey; + RefPtr<SerializedScriptValue> m_currentValue; }; } // namespace WebCore diff --git a/WebCore/storage/IDBCursorBackendInterface.h b/WebCore/storage/IDBCursorBackendInterface.h index 4b209c4..acea955 100644 --- a/WebCore/storage/IDBCursorBackendInterface.h +++ b/WebCore/storage/IDBCursorBackendInterface.h @@ -46,7 +46,7 @@ public: virtual unsigned short direction() const = 0; virtual PassRefPtr<IDBKey> key() const = 0; - virtual PassRefPtr<IDBAny> value() const = 0; + virtual PassRefPtr<SerializedScriptValue> value() const = 0; virtual void update(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBCallbacks>) = 0; virtual void continueFunction(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>) = 0; diff --git a/WebCore/storage/IDBDatabase.cpp b/WebCore/storage/IDBDatabase.cpp index 78a6646..81950d6 100644 --- a/WebCore/storage/IDBDatabase.cpp +++ b/WebCore/storage/IDBDatabase.cpp @@ -69,6 +69,13 @@ PassRefPtr<IDBRequest> IDBDatabase::removeObjectStore(ScriptExecutionContext* co return request; } +PassRefPtr<IDBRequest> IDBDatabase::setVersion(ScriptExecutionContext* context, const String& version) +{ + RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this)); + m_backend->setVersion(version, request); + return request; +} + PassRefPtr<IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* context, DOMStringList* storeNames, unsigned short mode, unsigned long timeout) { // We need to create a new transaction synchronously. Locks are acquired asynchronously. Operations diff --git a/WebCore/storage/IDBDatabase.h b/WebCore/storage/IDBDatabase.h index 0e83288..dc70114 100644 --- a/WebCore/storage/IDBDatabase.h +++ b/WebCore/storage/IDBDatabase.h @@ -58,8 +58,10 @@ public: PassRefPtr<IDBRequest> createObjectStore(ScriptExecutionContext*, const String& name, const String& keyPath = String(), bool autoIncrement = false); PassRefPtr<IDBObjectStore> objectStore(const String& name, unsigned short mode = IDBTransaction::READ_ONLY); PassRefPtr<IDBRequest> removeObjectStore(ScriptExecutionContext*, const String& name); + PassRefPtr<IDBRequest> setVersion(ScriptExecutionContext*, const String& version); PassRefPtr<IDBTransaction> transaction(ScriptExecutionContext*, DOMStringList* storeNames = 0, unsigned short mode = IDBTransaction::READ_ONLY, unsigned long timeout = 0); // FIXME: what should the default timeout be? + private: IDBDatabase(PassRefPtr<IDBDatabaseBackendInterface>); diff --git a/WebCore/storage/IDBDatabase.idl b/WebCore/storage/IDBDatabase.idl index 51bbafb..347b3a7 100644 --- a/WebCore/storage/IDBDatabase.idl +++ b/WebCore/storage/IDBDatabase.idl @@ -32,13 +32,14 @@ module storage { readonly attribute DOMString version; readonly attribute DOMStringList objectStores; - // FIXME: Add setVersion. [CallWith=ScriptExecutionContext] IDBRequest createObjectStore(in DOMString name, in [Optional, ConvertNullToNullString] DOMString keyPath, in [Optional] boolean autoIncrement); // FIXME: objectStore needs to be able to raise an IDBDatabaseException. IDBObjectStore objectStore(in DOMString name, in [Optional] unsigned short mode); [CallWith=ScriptExecutionContext] IDBRequest removeObjectStore(in DOMString name); + [CallWith=ScriptExecutionContext] IDBRequest setVersion(in DOMString version); [CallWith=ScriptExecutionContext] IDBTransaction transaction (in [Optional] DOMStringList storeNames, in [Optional] unsigned short mode, in [Optional] unsigned long timeout); + // FIXME: Add close. }; } diff --git a/WebCore/storage/IDBDatabaseBackendImpl.cpp b/WebCore/storage/IDBDatabaseBackendImpl.cpp index 23bc44e..f4f2934 100644 --- a/WebCore/storage/IDBDatabaseBackendImpl.cpp +++ b/WebCore/storage/IDBDatabaseBackendImpl.cpp @@ -185,6 +185,13 @@ void IDBDatabaseBackendImpl::removeObjectStore(const String& name, PassRefPtr<ID callbacks->onSuccess(); } +void IDBDatabaseBackendImpl::setVersion(const String& version, PassRefPtr<IDBCallbacks> callbacks) +{ + m_version = version; + setMetaData(m_sqliteDatabase.get(), m_name, m_description, m_version); + callbacks->onSuccess(); +} + PassRefPtr<IDBTransactionBackendInterface> IDBDatabaseBackendImpl::transaction(DOMStringList* objectStores, unsigned short mode, unsigned long timeout) { return m_transactionCoordinator->createTransaction(objectStores, mode, timeout, this); diff --git a/WebCore/storage/IDBDatabaseBackendImpl.h b/WebCore/storage/IDBDatabaseBackendImpl.h index 3540b21..ab055f8 100644 --- a/WebCore/storage/IDBDatabaseBackendImpl.h +++ b/WebCore/storage/IDBDatabaseBackendImpl.h @@ -59,7 +59,9 @@ public: virtual void createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks>); virtual PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name, unsigned short mode); virtual void removeObjectStore(const String& name, PassRefPtr<IDBCallbacks>); + virtual void setVersion(const String& version, PassRefPtr<IDBCallbacks>); virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* storeNames, unsigned short mode, unsigned long timeout); + private: IDBDatabaseBackendImpl(const String& name, const String& description, PassOwnPtr<SQLiteDatabase> database, IDBTransactionCoordinator*); diff --git a/WebCore/storage/IDBDatabaseBackendInterface.h b/WebCore/storage/IDBDatabaseBackendInterface.h index 9e35369..a2e042a 100644 --- a/WebCore/storage/IDBDatabaseBackendInterface.h +++ b/WebCore/storage/IDBDatabaseBackendInterface.h @@ -54,12 +54,12 @@ public: virtual String version() const = 0; virtual PassRefPtr<DOMStringList> objectStores() const = 0; - // FIXME: Add transaction and setVersion. - virtual void createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks>) = 0; virtual PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name, unsigned short mode) = 0; virtual void removeObjectStore(const String& name, PassRefPtr<IDBCallbacks>) = 0; + virtual void setVersion(const String& version, PassRefPtr<IDBCallbacks>) = 0; virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* storeNames, unsigned short mode, unsigned long timeout) = 0; + // FIXME: Add close. }; } // namespace WebCore diff --git a/WebCore/storage/IDBKey.cpp b/WebCore/storage/IDBKey.cpp index 8ec5dfd..50c4c46 100644 --- a/WebCore/storage/IDBKey.cpp +++ b/WebCore/storage/IDBKey.cpp @@ -53,6 +53,25 @@ IDBKey::~IDBKey() { } +bool IDBKey::isEqual(IDBKey* other) +{ + if (!other || other->m_type != m_type) + return false; + + switch (m_type) { + case StringType: + return other->m_string == m_string; + // FIXME: Implement dates. + case NumberType: + return other->m_number == m_number; + case NullType: + return true; + } + + ASSERT_NOT_REACHED(); + return false; +} + } // namespace WebCore #endif diff --git a/WebCore/storage/IDBKey.h b/WebCore/storage/IDBKey.h index a84ea6a..228b4a4 100644 --- a/WebCore/storage/IDBKey.h +++ b/WebCore/storage/IDBKey.h @@ -71,6 +71,8 @@ public: return m_number; } + bool isEqual(IDBKey* other); + private: IDBKey(); explicit IDBKey(int32_t); diff --git a/WebCore/storage/IDBKeyPathBackendImpl.cpp b/WebCore/storage/IDBKeyPathBackendImpl.cpp index 6cc9be5..b7c45c3 100644 --- a/WebCore/storage/IDBKeyPathBackendImpl.cpp +++ b/WebCore/storage/IDBKeyPathBackendImpl.cpp @@ -30,7 +30,11 @@ #error "Chromium should not compile this file and instead define its own version of this factory that navigates the multi-process boundry." #endif +#if ENABLE(INDEXED_DATABASE) + void IDBKeyPathBackendImpl::createIDBKeysFromSerializedValuesAndKeyPath(const Vector<RefPtr<SerializedScriptValue>&, 0> values, const String& keyPath, Vector<RefPtr<IDBKey>, 0>& keys) { // FIXME: Implement this method once JSC supports WireFormat for SerializedScriptValue. } + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebCore/storage/IDBKeyRange.cpp b/WebCore/storage/IDBKeyRange.cpp index dfcae19..4088b34 100644 --- a/WebCore/storage/IDBKeyRange.cpp +++ b/WebCore/storage/IDBKeyRange.cpp @@ -47,18 +47,27 @@ PassRefPtr<IDBKeyRange> IDBKeyRange::only(PassRefPtr<IDBKey> prpValue) PassRefPtr<IDBKeyRange> IDBKeyRange::leftBound(PassRefPtr<IDBKey> bound, bool open) { - return IDBKeyRange::create(bound, IDBKey::create(), open ? IDBKeyRange::LEFT_OPEN : IDBKeyRange::LEFT_BOUND); + unsigned short flags = IDBKeyRange::LEFT_BOUND; + if (open) + flags |= IDBKeyRange::LEFT_OPEN; + return IDBKeyRange::create(bound, IDBKey::create(), flags); } PassRefPtr<IDBKeyRange> IDBKeyRange::rightBound(PassRefPtr<IDBKey> bound, bool open) { - return IDBKeyRange::create(IDBKey::create(), bound, open ? IDBKeyRange::RIGHT_OPEN : IDBKeyRange::RIGHT_BOUND); + unsigned short flags = IDBKeyRange::RIGHT_BOUND; + if (open) + flags |= IDBKeyRange::RIGHT_OPEN; + return IDBKeyRange::create(IDBKey::create(), bound, flags); } PassRefPtr<IDBKeyRange> IDBKeyRange::bound(PassRefPtr<IDBKey> left, PassRefPtr<IDBKey> right, bool openLeft, bool openRight) { - unsigned short flags = openLeft ? IDBKeyRange::LEFT_OPEN : IDBKeyRange::LEFT_BOUND; - flags |= openRight ? IDBKeyRange::RIGHT_OPEN : IDBKeyRange::RIGHT_BOUND; + unsigned short flags = IDBKeyRange::LEFT_BOUND | IDBKeyRange::RIGHT_BOUND; + if (openLeft) + flags |= IDBKeyRange::LEFT_OPEN; + if (openRight) + flags |= IDBKeyRange::RIGHT_OPEN; return IDBKeyRange::create(left, right, flags); } diff --git a/WebCore/storage/IDBObjectStoreBackendImpl.cpp b/WebCore/storage/IDBObjectStoreBackendImpl.cpp index 1b9b76b..aeb3ced 100755 --- a/WebCore/storage/IDBObjectStoreBackendImpl.cpp +++ b/WebCore/storage/IDBObjectStoreBackendImpl.cpp @@ -265,23 +265,89 @@ void IDBObjectStoreBackendImpl::removeIndex(const String& name, PassRefPtr<IDBCa callbacks->onSuccess(); } -void IDBObjectStoreBackendImpl::openCursor(PassRefPtr<IDBKeyRange> range, unsigned short direction, PassRefPtr<IDBCallbacks> callbacks) +static String leftCursorWhereFragment(IDBKey::Type type, String comparisonOperator) { - // FIXME: Fully implement. + switch (type) { + case IDBKey::StringType: + return "? " + comparisonOperator + " keyString AND "; + // FIXME: Implement date. + case IDBKey::NumberType: + return "(? " + comparisonOperator + " keyNumber OR NOT keyString IS NULL OR NOT keyDate IS NULL) AND "; + case IDBKey::NullType: + if (comparisonOperator == "<") + return "NOT(keyString IS NULL AND keyDate IS NULL AND keyNumber IS NULL) AND "; + return ""; // If it's =, the upper bound half will do the constraining. If it's <=, then that's a no-op. + } + ASSERT_NOT_REACHED(); + return ""; +} - RefPtr<IDBKey> key = range->left(); - SQLiteStatement query(sqliteDatabase(), "SELECT id, value FROM ObjectStoreData " + whereClause(key->type())); - bool ok = query.prepare() == SQLResultOk; +static String rightCursorWhereFragment(IDBKey::Type type, String comparisonOperator) +{ + switch (type) { + case IDBKey::StringType: + return "(keyString " + comparisonOperator + " ? OR keyString IS NULL) AND "; + // FIXME: Implement date. + case IDBKey::NumberType: + return "(keyNumber " + comparisonOperator + " ? OR keyNumber IS NULL) AND keyString IS NULL AND keyDate IS NULL AND "; + case IDBKey::NullType: + if (comparisonOperator == "<") + return "0 != 0 AND "; + return "keyString IS NULL AND keyDate IS NULL AND keyNumber IS NULL AND "; + } + ASSERT_NOT_REACHED(); + return ""; +} + +void IDBObjectStoreBackendImpl::openCursor(PassRefPtr<IDBKeyRange> range, unsigned short tmpDirection, PassRefPtr<IDBCallbacks> callbacks) +{ + String lowerEquality; + if (range->flags() & IDBKeyRange::LEFT_OPEN) + lowerEquality = "<"; + else if (range->flags() & IDBKeyRange::LEFT_BOUND) + lowerEquality = "<="; + else + lowerEquality = "="; + + String upperEquality; + if (range->flags() & IDBKeyRange::RIGHT_OPEN) + upperEquality = "<"; + else if (range->flags() & IDBKeyRange::RIGHT_BOUND) + upperEquality = "<="; + else + upperEquality = "="; + + // If you change the order of this select, you'll need to change it in IDBCursorBackendImpl.cpp as well. + String sql = "SELECT id, keyString, keyDate, keyNumber, value FROM ObjectStoreData WHERE "; + if (range->flags() & IDBKeyRange::LEFT_BOUND || range->flags() == IDBKeyRange::SINGLE) + sql += leftCursorWhereFragment(range->left()->type(), lowerEquality); + if (range->flags() & IDBKeyRange::RIGHT_BOUND || range->flags() == IDBKeyRange::SINGLE) + sql += rightCursorWhereFragment(range->right()->type(), upperEquality); + sql += "objectStoreId = ? ORDER BY "; + + IDBCursor::Direction direction = static_cast<IDBCursor::Direction>(tmpDirection); + if (direction == IDBCursor::NEXT || direction == IDBCursor::NEXT_NO_DUPLICATE) + sql += "keyString, keyDate, keyNumber"; + else + sql += "keyString DESC, keyDate DESC, keyNumber DESC"; + + OwnPtr<SQLiteStatement> query = adoptPtr(new SQLiteStatement(sqliteDatabase(), sql)); + bool ok = query->prepare() == SQLResultOk; ASSERT_UNUSED(ok, ok); // FIXME: Better error handling? - bindWhereClause(query, m_id, key.get()); - if (query.step() != SQLResultRow) { + int currentColumn = 1; + if (range->flags() & IDBKeyRange::LEFT_BOUND || range->flags() == IDBKeyRange::SINGLE) + currentColumn += bindKey(*query, currentColumn, range->left().get()); + if (range->flags() & IDBKeyRange::RIGHT_BOUND || range->flags() == IDBKeyRange::SINGLE) + currentColumn += bindKey(*query, currentColumn, range->right().get()); + query->bindInt64(currentColumn, m_id); + + if (query->step() != SQLResultRow) { callbacks->onSuccess(); return; } - RefPtr<SerializedScriptValue> value = SerializedScriptValue::createFromWire(query.getColumnText(1)); - RefPtr<IDBCursorBackendInterface> cursor = IDBCursorBackendImpl::create(this, range, static_cast<IDBCursor::Direction>(direction), key.release(), value.release()); + RefPtr<IDBCursorBackendInterface> cursor = IDBCursorBackendImpl::create(this, range, direction, query.release()); callbacks->onSuccess(cursor.release()); } diff --git a/WebCore/storage/Metadata.h b/WebCore/storage/Metadata.h deleted file mode 100644 index 0b06f90..0000000 --- a/WebCore/storage/Metadata.h +++ /dev/null @@ -1,61 +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 Metadata_h -#define Metadata_h - -#if ENABLE(FILE_SYSTEM) - -#include <wtf/RefCounted.h> - -namespace WebCore { - -class Metadata : public RefCounted<Metadata> { -public: - static PassRefPtr<Metadata> create(double modificationTime) - { - return adoptRef(new Metadata(modificationTime)); - } - double modificationTime() const { return m_modificationTime; } - -private: - Metadata(double modificationTime) - : m_modificationTime(modificationTime) - { - } - - double m_modificationTime; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // Metadata_h diff --git a/WebCore/storage/Metadata.idl b/WebCore/storage/Metadata.idl deleted file mode 100644 index 711fae8..0000000 --- a/WebCore/storage/Metadata.idl +++ /dev/null @@ -1,37 +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. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM - ] Metadata { - readonly attribute double modificationTime; - }; -} diff --git a/WebCore/storage/MetadataCallback.h b/WebCore/storage/MetadataCallback.h deleted file mode 100644 index 3d57400..0000000 --- a/WebCore/storage/MetadataCallback.h +++ /dev/null @@ -1,53 +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 MetadataCallback_h -#define MetadataCallback_h - -#if ENABLE(FILE_SYSTEM) - -#include <wtf/RefCounted.h> - -namespace WebCore { - -class Metadata; -class ScriptExecutionContext; - -class MetadataCallback : public RefCounted<MetadataCallback> { -public: - virtual ~MetadataCallback() { } - virtual bool handleEvent(Metadata*) = 0; -}; - -} // namespace - -#endif // ENABLE(FILE_SYSTEM) - -#endif // MetadataCallback_h diff --git a/WebCore/storage/MetadataCallback.idl b/WebCore/storage/MetadataCallback.idl deleted file mode 100644 index 44ca180..0000000 --- a/WebCore/storage/MetadataCallback.idl +++ /dev/null @@ -1,38 +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. - */ - -module storage { - interface [ - Conditional=FILE_SYSTEM, - Callback - ] MetadataCallback { - boolean handleEvent(in Metadata metadata); - }; -} |