Commit 2087744b authored by jorlow@chromium.org's avatar jorlow@chromium.org

2010-03-29 Jeremy Orlow <jorlow@chromium.org>

        Reviewed by Darin Fisher.

        More IndexedDB work
        https://bugs.webkit.org/show_bug.cgi?id=36770

        Add the "singleton" IndexedDatabase object to PageGroup
        IndexedDatabase now has a create() method since PageGroup can own the instance (at least for now)
        Rip out the IDBRequest stuff (now obsolete).
        DOMWindow now can instantiate indexedDatabase objects on demand.

        New layout tests starting with the next patch (which should make indexedDB.open() "work").

        * WebCore.gypi:
        * bindings/v8/custom/V8IDBRequestCustom.cpp: Removed.
        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::indexedDB):
        * page/DOMWindow.h:
        * page/PageGroup.cpp:
        (WebCore::PageGroup::indexedDatabase):
        * page/PageGroup.h:
        * storage/IDBDatabase.cpp:
        * storage/IDBDatabaseRequest.h:
        (WebCore::IDBDatabaseRequest::createObjectStore):
        * storage/IDBDatabaseRequest.idl:
        * storage/IDBRequest.cpp: Removed.
        * storage/IDBRequest.h: Removed.
        * storage/IDBRequest.idl: Removed.
        * storage/IndexedDatabase.cpp:
        (WebCore::IndexedDatabase::create):
        * storage/IndexedDatabase.h:
        * storage/IndexedDatabaseImpl.cpp:
        (WebCore::IndexedDatabaseImpl::create):
        (WebCore::IndexedDatabaseImpl::IndexedDatabaseImpl):
        (WebCore::IndexedDatabaseImpl::~IndexedDatabaseImpl):
        * storage/IndexedDatabaseImpl.h:
        * storage/IndexedDatabaseRequest.cpp:
        (WebCore::IndexedDatabaseRequest::IndexedDatabaseRequest):
        * storage/IndexedDatabaseRequest.h:
        (WebCore::IndexedDatabaseRequest::create):
        * storage/IndexedDatabaseRequest.idl:
        * storage/chromium/IndexedDatabase.cpp:
        (WebCore::IndexedDatabase::create):
2010-03-29  Jeremy Orlow  <jorlow@chromium.org>

        Reviewed by Darin Fisher.

        More IndexedDB work
        https://bugs.webkit.org/show_bug.cgi?id=36770

        Start the implementation of WebIndexedDatabase (for entrance back into WebKit).

        * WebKit.gyp:
        * public/WebIndexedDatabase.h:
        * src/WebIndexedDatabaseImpl.cpp: Added.
        (WebKit::WebIndexedDatabase::create):
        (WebKit::WebIndexedDatabaseImpl::~WebIndexedDatabaseImpl):
        (WebKit::WebIndexedDatabaseImpl::open):
        * src/WebIndexedDatabaseImpl.h: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@56777 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7905038b
2010-03-29 Jeremy Orlow <jorlow@chromium.org>
Reviewed by Darin Fisher.
More IndexedDB work
https://bugs.webkit.org/show_bug.cgi?id=36770
Add the "singleton" IndexedDatabase object to PageGroup
IndexedDatabase now has a create() method since PageGroup can own the instance (at least for now)
Rip out the IDBRequest stuff (now obsolete).
DOMWindow now can instantiate indexedDatabase objects on demand.
New layout tests starting with the next patch (which should make indexedDB.open() "work").
* WebCore.gypi:
* bindings/v8/custom/V8IDBRequestCustom.cpp: Removed.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::indexedDB):
* page/DOMWindow.h:
* page/PageGroup.cpp:
(WebCore::PageGroup::indexedDatabase):
* page/PageGroup.h:
* storage/IDBDatabase.cpp:
* storage/IDBDatabaseRequest.h:
(WebCore::IDBDatabaseRequest::createObjectStore):
* storage/IDBDatabaseRequest.idl:
* storage/IDBRequest.cpp: Removed.
* storage/IDBRequest.h: Removed.
* storage/IDBRequest.idl: Removed.
* storage/IndexedDatabase.cpp:
(WebCore::IndexedDatabase::create):
* storage/IndexedDatabase.h:
* storage/IndexedDatabaseImpl.cpp:
(WebCore::IndexedDatabaseImpl::create):
(WebCore::IndexedDatabaseImpl::IndexedDatabaseImpl):
(WebCore::IndexedDatabaseImpl::~IndexedDatabaseImpl):
* storage/IndexedDatabaseImpl.h:
* storage/IndexedDatabaseRequest.cpp:
(WebCore::IndexedDatabaseRequest::IndexedDatabaseRequest):
* storage/IndexedDatabaseRequest.h:
(WebCore::IndexedDatabaseRequest::create):
* storage/IndexedDatabaseRequest.idl:
* storage/chromium/IndexedDatabase.cpp:
(WebCore::IndexedDatabase::create):
2010-03-30 Dirk Schulze <krit@webkit.org>
Reviewed by Nikolas Zimmermann.
......@@ -218,7 +218,6 @@
'storage/IDBDatabaseError.idl',
'storage/IDBDatabaseException.idl',
'storage/IDBDatabaseRequest.idl',
'storage/IDBRequest.idl',
'storage/IndexedDatabaseRequest.idl',
'storage/SQLError.idl',
'storage/SQLResultSet.idl',
......@@ -752,7 +751,6 @@
'bindings/v8/custom/V8HTMLPlugInElementCustom.cpp',
'bindings/v8/custom/V8HTMLSelectElementCustom.cpp',
'bindings/v8/custom/V8HTMLSelectElementCustom.h',
'bindings/v8/custom/V8IDBRequestCustom.cpp',
'bindings/v8/custom/V8IndexedDatabaseRequestCustom.cpp',
'bindings/v8/custom/V8InjectedScriptHostCustom.cpp',
'bindings/v8/custom/V8InspectorFrontendHostCustom.cpp',
......@@ -3273,8 +3271,6 @@
'storage/IDBDatabaseError.h',
'storage/IDBDatabaseException.h',
'storage/IDBDatabaseRequest.h',
'storage/IDBRequest.cpp',
'storage/IDBRequest.h',
'storage/IndexedDatabase.cpp',
'storage/IndexedDatabase.h',
'storage/IndexedDatabaseImpl.cpp',
......
......@@ -54,6 +54,8 @@
#include "FrameView.h"
#include "HTMLFrameOwnerElement.h"
#include "History.h"
#include "IndexedDatabase.h"
#include "IndexedDatabaseRequest.h"
#include "InspectorController.h"
#include "InspectorTimelineAgent.h"
#include "Location.h"
......@@ -468,6 +470,12 @@ void DOMWindow::clear()
m_notifications->disconnectFrame();
m_notifications = 0;
#endif
#if ENABLE(INDEXED_DATABASE)
if (m_indexedDatabaseRequest)
m_indexedDatabaseRequest->disconnectFrame();
m_indexedDatabaseRequest = 0;
#endif
}
#if ENABLE(ORIENTATION_EVENTS)
......@@ -645,7 +653,23 @@ NotificationCenter* DOMWindow::webkitNotifications() const
#if ENABLE(INDEXED_DATABASE)
IndexedDatabaseRequest* DOMWindow::indexedDB() const
{
return 0;
if (m_indexedDatabaseRequest)
return m_indexedDatabaseRequest.get();
Document* document = this->document();
if (!document)
return 0;
// FIXME: See if access is allowed.
Page* page = document->page();
if (!page)
return 0;
// FIXME: See if indexedDatabase access is allowed.
m_indexedDatabaseRequest = IndexedDatabaseRequest::create(page->group().indexedDatabase(), m_frame);
return m_indexedDatabaseRequest.get();
}
#endif
......
......@@ -401,6 +401,9 @@ namespace WebCore {
#if ENABLE(NOTIFICATIONS)
mutable RefPtr<NotificationCenter> m_notifications;
#endif
#if ENABLE(INDEXED_DATABASE)
mutable RefPtr<IndexedDatabaseRequest> m_indexedDatabaseRequest;
#endif
EventTargetData m_eventTargetData;
};
......
......@@ -30,12 +30,10 @@
#include "ChromeClient.h"
#include "Document.h"
#include "Frame.h"
#include "IndexedDatabase.h"
#include "Page.h"
#include "Settings.h"
#if ENABLE(DOM_STORAGE)
#include "StorageNamespace.h"
#endif
#if PLATFORM(CHROMIUM)
#include "ChromiumBridge.h"
......@@ -191,6 +189,9 @@ StorageNamespace* PageGroup::localStorage()
{
if (!m_localStorage) {
// Need a page in this page group to query the settings for the local storage database path.
// Having these parameters attached to the page settings is unfortunate since these settings are
// not per-page (and, in fact, we simply grab the settings from some page at random), but
// at this point we're stuck with it.
Page* page = *m_pages.begin();
const String& path = page->settings()->localStorageDatabasePath();
unsigned quota = page->settings()->localStorageQuota();
......@@ -201,6 +202,17 @@ StorageNamespace* PageGroup::localStorage()
}
#endif
#if ENABLE(INDEXED_DATABASE)
IndexedDatabase* PageGroup::indexedDatabase()
{
// Do not add page setting based access control here since this object is shared by all pages in
// the group and having per-page controls is misleading.
if (!m_indexedDatabase)
m_indexedDatabase = IndexedDatabase::create();
return m_indexedDatabase.get();
}
#endif
void PageGroup::addUserScriptToWorld(DOMWrapperWorld* world, const String& source, const KURL& url, PassOwnPtr<Vector<String> > whitelist,
PassOwnPtr<Vector<String> > blacklist, UserScriptInjectionTime injectionTime)
{
......
......@@ -36,6 +36,7 @@
namespace WebCore {
class KURL;
class IndexedDatabase;
class Page;
class StorageNamespace;
......@@ -69,6 +70,9 @@ namespace WebCore {
StorageNamespace* localStorage();
bool hasLocalStorage() { return m_localStorage; }
#endif
#if ENABLE(DOM_STORAGE)
IndexedDatabase* indexedDatabase();
#endif
void addUserScriptToWorld(DOMWrapperWorld*, const String& source, const KURL&,
PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist,
......@@ -101,6 +105,9 @@ namespace WebCore {
#if ENABLE(DOM_STORAGE)
RefPtr<StorageNamespace> m_localStorage;
#endif
#if ENABLE(INDEXED_DATABASE)
RefPtr<IndexedDatabase> m_indexedDatabase;
#endif
OwnPtr<UserScriptMap> m_userScripts;
OwnPtr<UserStyleSheetMap> m_userStyleSheets;
......
/*
* 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:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS 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 "IDBDatabase.h"
#if ENABLE(INDEXED_DATABASE)
namespace WebCore {
// FIXME: Write.
} // namespace WebCore
#endif // ENABLE(INDEXED_DATABASE)
......@@ -40,6 +40,7 @@ class IDBDatabaseRequest : public RefCounted<IDBDatabaseRequest> {
public:
// FIXME: Write.
IDBRequest* request() const { return 0; }
void createObjectStore(const String& name, const String& keyPath, bool autoIncrement) { }
};
} // namespace WebCore
......
......@@ -30,8 +30,10 @@ module storage {
interface [
Conditional=INDEXED_DATABASE
] IDBDatabaseRequest {
readonly attribute IDBRequest request;
// FIXME: Write.
// FIXME: Boolean should be optional and keyPath should take nulls.
void createObjectStore(in DOMString name, in DOMString keyPath, in boolean autoIncrement);
// FIXME: Finish.
};
}
/*
* 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:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS 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 "IDBRequest.h"
#if ENABLE(INDEXED_DATABASE)
#include "IDBDatabaseError.h"
#include "SerializedScriptValue.h"
namespace WebCore {
IDBRequest::IDBRequest(ScriptExecutionContext* context)
: ActiveDOMObject(context, this)
{
}
IDBRequest::~IDBRequest()
{
}
void IDBRequest::abort()
{
}
EventTargetData* IDBRequest::eventTargetData()
{
return 0;
}
EventTargetData* IDBRequest::ensureEventTargetData()
{
return 0;
}
} // namespace WebCore
#endif // ENABLE(INDEXED_DATABASE)
/*
* 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:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS 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 IDBRequest_h
#define IDBRequest_h
#include "ActiveDOMObject.h"
#include "EventTarget.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
#if ENABLE(INDEXED_DATABASE)
namespace WebCore {
class IDBDatabaseError;
class SerializedScriptValue;
class IDBRequest : public RefCounted<IDBRequest>, public ActiveDOMObject, public EventTarget {
public:
static PassRefPtr<IDBRequest> create(ScriptExecutionContext* context)
{
return adoptRef(new IDBRequest(context));
}
~IDBRequest();
void abort();
unsigned short readyState() const { return m_readyState; }
IDBDatabaseError* error() const { return m_error.get(); }
SerializedScriptValue* result() const { return m_result.get(); }
DEFINE_ATTRIBUTE_EVENT_LISTENER(success);
DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
using RefCounted<IDBRequest>::ref;
using RefCounted<IDBRequest>::deref;
// EventTarget interface
virtual ScriptExecutionContext* scriptExecutionContext() const { return ActiveDOMObject::scriptExecutionContext(); }
virtual IDBRequest* toIDBRequest() { return this; }
private:
explicit IDBRequest(ScriptExecutionContext* context);
// EventTarget interface
virtual void refEventTarget() { ref(); }
virtual void derefEventTarget() { deref(); }
virtual EventTargetData* eventTargetData();
virtual EventTargetData* ensureEventTargetData();
unsigned short m_readyState;
RefPtr<IDBDatabaseError> m_error;
RefPtr<SerializedScriptValue> m_result;
EventTargetData m_eventTargetData;
};
} // namespace WebCore
#endif
#endif // IDBRequest_h
......@@ -38,9 +38,9 @@
namespace WebCore {
PassRefPtr<IndexedDatabase> IndexedDatabase::get()
PassRefPtr<IndexedDatabase> IndexedDatabase::create()
{
return IndexedDatabaseImpl::get();
return IndexedDatabaseImpl::create();
}
} // namespace WebCore
......
......@@ -47,7 +47,7 @@ typedef IDBCallbacks<IDBDatabase> IDBDatabaseCallbacks;
// trigger work on a background thread if necessary.
class IndexedDatabase : public ThreadSafeShared<IndexedDatabase> {
public:
static PassRefPtr<IndexedDatabase> get();
static PassRefPtr<IndexedDatabase> create();
virtual ~IndexedDatabase() { }
virtual void open(const String& name, const String& description, bool modifyDatabase, ExceptionCode&, PassRefPtr<IDBDatabaseCallbacks>) = 0;
......
......@@ -36,28 +36,17 @@
namespace WebCore {
IndexedDatabaseImpl* IndexedDatabaseImpl::indexedDatabaseImpl = 0;
PassRefPtr<IndexedDatabaseImpl> IndexedDatabaseImpl::get()
PassRefPtr<IndexedDatabaseImpl> IndexedDatabaseImpl::create()
{
if (!indexedDatabaseImpl)
indexedDatabaseImpl = new IndexedDatabaseImpl();
ASSERT(indexedDatabaseImpl);
return indexedDatabaseImpl;
return new IndexedDatabaseImpl();
}
IndexedDatabaseImpl::IndexedDatabaseImpl()
{
// FIXME: Make this thread safe before implementing a sync interface.
ASSERT(!indexedDatabaseImpl);
indexedDatabaseImpl = this;
}
IndexedDatabaseImpl::~IndexedDatabaseImpl()
{
// FIXME: Make this thread safe before implementing a sync interface.
ASSERT(indexedDatabaseImpl == this);
indexedDatabaseImpl = 0;
}
void IndexedDatabaseImpl::open(const String& name, const String& description, bool modifyDatabase, ExceptionCode&, PassRefPtr<IDBDatabaseCallbacks>)
......
......@@ -36,7 +36,7 @@ namespace WebCore {
class IndexedDatabaseImpl : public IndexedDatabase {
public:
static PassRefPtr<IndexedDatabaseImpl> get();
static PassRefPtr<IndexedDatabaseImpl> create();
virtual ~IndexedDatabaseImpl();
virtual void open(const String& name, const String& description, bool modifyDatabase, ExceptionCode&, PassRefPtr<IDBCallbacks<IDBDatabase> >);
......
......@@ -28,14 +28,16 @@
#include "config.h"
#include "IndexedDatabaseRequest.h"
#if ENABLE(INDEXED_DATABASE)
#include "ExceptionCode.h"
#include "IDBRequest.h"
#include "IndexedDatabase.h"
#if ENABLE(INDEXED_DATABASE)
namespace WebCore {
IndexedDatabaseRequest::IndexedDatabaseRequest()
IndexedDatabaseRequest::IndexedDatabaseRequest(IndexedDatabase* indexedDatabase, Frame* frame)
: m_indexedDatabase(indexedDatabase)
, m_frame(frame)
{
}
......
......@@ -38,23 +38,26 @@
namespace WebCore {
class IDBRequest;
class IndexedDatabase;
class Frame;
class IndexedDatabaseRequest : public RefCounted<IndexedDatabaseRequest> {
public:
static PassRefPtr<IndexedDatabaseRequest> create()
static PassRefPtr<IndexedDatabaseRequest> create(IndexedDatabase* indexedDatabase, Frame* frame)
{
return adoptRef(new IndexedDatabaseRequest());
return adoptRef(new IndexedDatabaseRequest(indexedDatabase, frame));
}
~IndexedDatabaseRequest();
IDBRequest* request() const { return m_request.get(); }
void open(const String& name, const String& description, bool modifyDatabase, ExceptionCode&);
void disconnectFrame() { m_frame = 0; }
private:
IndexedDatabaseRequest();
IndexedDatabaseRequest(IndexedDatabase*, Frame*);
PassRefPtr<IDBRequest> m_request;
PassRefPtr<IndexedDatabase> m_indexedDatabase;
Frame* m_frame;
};
} // namespace WebCore
......
......@@ -30,7 +30,6 @@ module storage {
interface [
Conditional=INDEXED_DATABASE
] IndexedDatabaseRequest {
readonly attribute IDBRequest request;
[Custom] void open(in DOMString name, in DOMString description, in optional boolean modifyDatabase, IDBDatabaseErrorCallback onerror, IDBDatabaseRequestCallback onsuccess)
raises(IDBDatabaseException);
};
......
......@@ -34,7 +34,7 @@
namespace WebCore {
PassRefPtr<IndexedDatabase> IndexedDatabase::get()
PassRefPtr<IndexedDatabase> IndexedDatabase::create()
{
return ChromiumBridge::indexedDatabase();
}
......
2010-03-29 Jeremy Orlow <jorlow@chromium.org>
Reviewed by Darin Fisher.
More IndexedDB work
https://bugs.webkit.org/show_bug.cgi?id=36770
Start the implementation of WebIndexedDatabase (for entrance back into WebKit).
* WebKit.gyp:
* public/WebIndexedDatabase.h:
* src/WebIndexedDatabaseImpl.cpp: Added.
(WebKit::WebIndexedDatabase::create):
(WebKit::WebIndexedDatabaseImpl::~WebIndexedDatabaseImpl):
(WebKit::WebIndexedDatabaseImpl::open):
* src/WebIndexedDatabaseImpl.h: Added.
2010-03-29 Rafael Weinstein <rafaelw@chromium.org>
Reviewed by Adam Barth.
......
......@@ -333,6 +333,8 @@
'src/WebImageCG.cpp',
'src/WebImageDecoder.cpp',
'src/WebImageSkia.cpp',
'src/WebIndexedDatabaseImpl.cpp',
'src/WebIndexedDatabaseImpl.h',
'src/WebInputElement.cpp',
'src/WebInputEvent.cpp',
'src/WebInputEventConversion.cpp',
......
......@@ -25,6 +25,7 @@
* (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 WebIndexedDatabase_h
#define WebIndexedDatabase_h
......@@ -41,7 +42,7 @@ class WebString;
// http://dev.w3.org/2006/webapi/WebSimpleDB/
class WebIndexedDatabase {
public:
// FIXME: Implement entry back into WebKit for this API.
WEBKIT_API static WebIndexedDatabase* create();
virtual ~WebIndexedDatabase() { }
......
......@@ -29,25 +29,31 @@
*/
#include "config.h"
#include "WebIndexedDatabaseImpl.h"
#include "WebIDBDatabaseError.h"
#include <wtf/OwnPtr.h>
#if ENABLE(INDEXED_DATABASE)
#include "V8IDBRequest.h"
#include "SerializedScriptValue.h"
#include "V8Proxy.h"
namespace WebKit {
namespace WebCore {
WebIndexedDatabase* WebIndexedDatabase::create()
{
return new WebIndexedDatabaseImpl();
}
v8::Handle<v8::Value> V8IDBRequest::resultAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
WebIndexedDatabaseImpl::~WebIndexedDatabaseImpl()
{
IDBRequest* request = V8IDBRequest::toNative(info.Holder());
SerializedScriptValue* result = request->result();
if (!result)
return v8::Null();
}
return result->deserialize();
void WebIndexedDatabaseImpl::open(const WebString& name, const WebString& description, bool modifyDatabase, int& exceptionCode, WebIDBCallbacks<WebIDBDatabase>* callbacksPtr)
{
OwnPtr<WebIDBCallbacks<WebIDBDatabase>*> callbacks(callbacksPtr);
callbacks->onError(WebIDBDatabaseError(0, "Not implemented"));
// FIXME: Implement for realz.
}
} // namespace WebCore
} // namespace WebKit
#endif
#endif // ENABLE(INDEXED_DATABASE)
......@@ -25,21 +25,21 @@
* (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=INDEXED_DATABASE,
EventTarget
] IDBRequest {
void abort();
const unsigned short INITIAL = 0;
const unsigned short LOADING = 1;
const unsigned short DONE = 2;
readonly attribute unsigned short readyState;
readonly attribute IDBDatabaseError error;
readonly attribute [CustomGetter] any result;
attribute EventListener onsuccess;
attribute EventListener onerror;
};
#ifndef WebIndexedDatabaseImpl_h
#define WebIndexedDatabaseImpl_h
}
#include "WebIndexedDatabase.h"
namespace WebKit {
class WebIndexedDatabaseImpl : public WebIndexedDatabase {
public:
virtual ~WebIndexedDatabaseImpl();
virtual void open(const WebString& name, const WebString& description, bool modifyDatabase, int& exceptionCode, WebIDBCallbacks<WebIDBDatabase>* callbacks);
};
} // namespace WebKit
#endif // WebIndexedDatabaseImpl_h