Commit d72d2928 authored by eric@webkit.org's avatar eric@webkit.org

2010-05-27 Eric Uhrhane <ericu@chromium.org>

        Reviewed by Adam Barth.

        Add v8 bindings for async DB API in workers
        https://bugs.webkit.org/show_bug.cgi?id=39145

        No new tests.  This should share layout tests with JSC.

        Tweak the callback generation to switch lots of Frame* to ScriptExecutionContext*, and use the context passed in to handleEvent where possible.
        * bindings/scripts/CodeGeneratorV8.pm:

        As with CodeGeneratorV8; these are pretty much all tiny tweaks.
        We do have to use a slightly different patch for callback invocation in invokeCallback, as V8Proxy::retrieve() doesn't work in the worker context.
        * bindings/v8/custom/V8CustomPositionCallback.cpp:
        (WebCore::V8CustomPositionCallback::handleEvent):
        * bindings/v8/custom/V8CustomPositionErrorCallback.cpp:
        (WebCore::V8CustomPositionErrorCallback::handleEvent):
        * bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp:
        (WebCore::V8SQLStatementErrorCallback::handleEvent):
        * bindings/v8/custom/V8CustomVoidCallback.cpp:
        (WebCore::V8CustomVoidCallback::V8CustomVoidCallback):
        (WebCore::V8CustomVoidCallback::handleEvent):
        (WebCore::invokeCallback):
        * bindings/v8/custom/V8CustomVoidCallback.h:
        (WebCore::V8CustomVoidCallback::create):
        * bindings/v8/custom/V8DOMWindowCustom.cpp:
        (WebCore::V8DOMWindow::openDatabaseCallback):
        * bindings/v8/custom/V8DatabaseCustom.cpp:
        (WebCore::V8Database::changeVersionCallback):
        (WebCore::createTransaction):
        * bindings/v8/custom/V8DatabaseSyncCustom.cpp:
        (WebCore::V8DatabaseSync::changeVersionCallback):
        (WebCore::createTransaction):
        * bindings/v8/custom/V8NotificationCenterCustom.cpp:
        (WebCore::V8NotificationCenter::requestPermissionCallback):
        * bindings/v8/custom/V8SQLTransactionCustom.cpp:
        (WebCore::V8SQLTransaction::executeSqlCallback):

        Add openDatabaseCallback.
        * bindings/v8/custom/V8WorkerContextCustom.cpp:
        (WebCore::V8WorkerContext::openDatabaseCallback):
        Remove an obsolete parameter.
        (WebCore::V8WorkerContext::openDatabaseSyncCallback):
2010-05-27  Eric Uhrhane  <ericu@chromium.org>

        Reviewed by Adam Barth.

        Add v8 bindings for async DB API in workers
        https://bugs.webkit.org/show_bug.cgi?id=39145

        * src/DatabaseObserver.cpp:
        We should check that we're on the context thread now, not the main
        thread.
        (WebCore::DatabaseObserver::databaseOpened):
        (WebCore::DatabaseObserver::databaseModified):
        (WebCore::DatabaseObserver::databaseClosed):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@60330 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 019c8ffa
2010-05-27 Eric Uhrhane <ericu@chromium.org>
Reviewed by Adam Barth.
Add v8 bindings for async DB API in workers
https://bugs.webkit.org/show_bug.cgi?id=39145
No new tests. This should share layout tests with JSC.
Tweak the callback generation to switch lots of Frame* to ScriptExecutionContext*, and use the context passed in to handleEvent where possible.
* bindings/scripts/CodeGeneratorV8.pm:
As with CodeGeneratorV8; these are pretty much all tiny tweaks.
We do have to use a slightly different patch for callback invocation in invokeCallback, as V8Proxy::retrieve() doesn't work in the worker context.
* bindings/v8/custom/V8CustomPositionCallback.cpp:
(WebCore::V8CustomPositionCallback::handleEvent):
* bindings/v8/custom/V8CustomPositionErrorCallback.cpp:
(WebCore::V8CustomPositionErrorCallback::handleEvent):
* bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp:
(WebCore::V8SQLStatementErrorCallback::handleEvent):
* bindings/v8/custom/V8CustomVoidCallback.cpp:
(WebCore::V8CustomVoidCallback::V8CustomVoidCallback):
(WebCore::V8CustomVoidCallback::handleEvent):
(WebCore::invokeCallback):
* bindings/v8/custom/V8CustomVoidCallback.h:
(WebCore::V8CustomVoidCallback::create):
* bindings/v8/custom/V8DOMWindowCustom.cpp:
(WebCore::V8DOMWindow::openDatabaseCallback):
* bindings/v8/custom/V8DatabaseCustom.cpp:
(WebCore::V8Database::changeVersionCallback):
(WebCore::createTransaction):
* bindings/v8/custom/V8DatabaseSyncCustom.cpp:
(WebCore::V8DatabaseSync::changeVersionCallback):
(WebCore::createTransaction):
* bindings/v8/custom/V8NotificationCenterCustom.cpp:
(WebCore::V8NotificationCenter::requestPermissionCallback):
* bindings/v8/custom/V8SQLTransactionCustom.cpp:
(WebCore::V8SQLTransaction::executeSqlCallback):
Add openDatabaseCallback.
* bindings/v8/custom/V8WorkerContextCustom.cpp:
(WebCore::V8WorkerContext::openDatabaseCallback):
Remove an obsolete parameter.
(WebCore::V8WorkerContext::openDatabaseSyncCallback):
2010-05-27 Pavel Feldman <pfeldman@chromium.org>
Reviewed by Yury Semikhatsky.
......
......@@ -2154,15 +2154,14 @@ sub GenerateCallbackHeader
push(@headerContent, "#include <wtf/Forward.h>\n");
push(@headerContent, "\nnamespace WebCore {\n\n");
push(@headerContent, "class Frame;\n\n");
push(@headerContent, "class $className : public $interfaceName {\n");
push(@headerContent, <<END);
public:
static PassRefPtr<${className}> create(v8::Local<v8::Value> value, Frame* frame)
static PassRefPtr<${className}> create(v8::Local<v8::Value> value)
{
ASSERT(value->IsObject());
return adoptRef(new ${className}(value->ToObject(), frame));
return adoptRef(new ${className}(value->ToObject()));
}
virtual ~${className}();
......@@ -2192,10 +2191,9 @@ END
push(@headerContent, <<END);
private:
${className}(v8::Local<v8::Object>, Frame*);
${className}(v8::Local<v8::Object>);
v8::Persistent<v8::Object> m_callback;
RefPtr<Frame> m_frame;
WorldContextHandle m_worldContext;
};
......@@ -2218,15 +2216,13 @@ sub GenerateCallbackImplementation
# - Add default header template
push(@implFixedHeader, GenerateImplementationContentHeader($dataNode));
$implIncludes{"Frame.h"} = 1;
$implIncludes{"ScriptExecutionContext.h"} = 1;
$implIncludes{"V8CustomVoidCallback.h"} = 1;
push(@implContent, "namespace WebCore {\n\n");
push(@implContent, <<END);
${className}::${className}(v8::Local<v8::Object> callback, Frame* frame)
${className}::${className}(v8::Local<v8::Object> callback)
: m_callback(v8::Persistent<v8::Object>::New(callback))
, m_frame(frame)
, m_worldContext(UseCurrentWorld)
{
}
......@@ -2274,9 +2270,8 @@ END
push(@implContent, join(",\n", @argvs));
push(@implContent, "\n };\n\n");
push(@implContent, " RefPtr<Frame> protect(m_frame);\n\n");
push(@implContent, " bool callbackReturnValue = false;\n");
push(@implContent, " return !invokeCallback(m_callback, " . scalar(@params). ", argv, callbackReturnValue);\n");
push(@implContent, " return !invokeCallback(m_callback, " . scalar(@params) . ", argv, callbackReturnValue, context);\n");
push(@implContent, "}\n");
}
}
......
......@@ -23,7 +23,6 @@
#if ENABLE(DATABASE)
#include "Frame.h"
#include "ScriptExecutionContext.h"
#include "V8Class1.h"
#include "V8Class2.h"
......@@ -32,9 +31,8 @@
namespace WebCore {
V8TestCallback::V8TestCallback(v8::Local<v8::Object> callback, Frame* frame)
V8TestCallback::V8TestCallback(v8::Local<v8::Object> callback)
: m_callback(v8::Persistent<v8::Object>::New(callback))
, m_frame(frame)
, m_worldContext(UseCurrentWorld)
{
}
......@@ -60,10 +58,8 @@ bool V8TestCallback::callbackWithClass1Param(ScriptExecutionContext* context, Cl
toV8(class1Param)
};
RefPtr<Frame> protect(m_frame);
bool callbackReturnValue = false;
return !invokeCallback(m_callback, 1, argv, callbackReturnValue);
return !invokeCallback(m_callback, 1, argv, callbackReturnValue, context);
}
bool V8TestCallback::callbackWithClass2Param(ScriptExecutionContext* context, Class2* class2Param, const String& strArg)
......@@ -81,10 +77,8 @@ bool V8TestCallback::callbackWithClass2Param(ScriptExecutionContext* context, Cl
toV8(strArg)
};
RefPtr<Frame> protect(m_frame);
bool callbackReturnValue = false;
return !invokeCallback(m_callback, 2, argv, callbackReturnValue);
return !invokeCallback(m_callback, 2, argv, callbackReturnValue, context);
}
} // namespace WebCore
......
......@@ -30,14 +30,12 @@
namespace WebCore {
class Frame;
class V8TestCallback : public TestCallback {
public:
static PassRefPtr<V8TestCallback> create(v8::Local<v8::Value> value, Frame* frame)
static PassRefPtr<V8TestCallback> create(v8::Local<v8::Value> value)
{
ASSERT(value->IsObject());
return adoptRef(new V8TestCallback(value->ToObject(), frame));
return adoptRef(new V8TestCallback(value->ToObject()));
}
virtual ~V8TestCallback();
......@@ -49,10 +47,9 @@ public:
virtual int customCallback(ScriptExecutionContext*, Class5* class5Param, Class6* class6Param);
private:
V8TestCallback(v8::Local<v8::Object>, Frame*);
V8TestCallback(v8::Local<v8::Object>);
v8::Persistent<v8::Object> m_callback;
RefPtr<Frame> m_frame;
WorldContextHandle m_worldContext;
};
......
......@@ -61,7 +61,7 @@ void V8CustomPositionCallback::handleEvent(Geoposition* position)
RefPtr<Frame> protector(m_frame);
bool callbackReturnValue = false;
invokeCallback(m_callback, 1, argv, callbackReturnValue);
invokeCallback(m_callback, 1, argv, callbackReturnValue, m_frame->document());
}
} // namespace WebCore
......@@ -61,7 +61,7 @@ void V8CustomPositionErrorCallback::handleEvent(PositionError* error)
RefPtr<Frame> protector(m_frame);
bool callbackReturnValue = false;
invokeCallback(m_callback, 1, argv, callbackReturnValue);
invokeCallback(m_callback, 1, argv, callbackReturnValue, m_frame->document());
}
} // namespace WebCore
......@@ -34,9 +34,9 @@
#include "V8SQLStatementErrorCallback.h"
#include "Frame.h"
#include "ScriptExecutionContext.h"
#include "V8CustomVoidCallback.h"
#include "V8Proxy.h"
#include "V8SQLError.h"
#include "V8SQLTransaction.h"
......@@ -57,15 +57,15 @@ bool V8SQLStatementErrorCallback::handleEvent(ScriptExecutionContext* context, S
toV8(error)
};
// Protect the frame until the callback returns.
RefPtr<Frame> protector(m_frame);
// Protect the context until the callback returns.
RefPtr<ScriptExecutionContext> protector(context);
bool callbackReturnValue = false;
// Step 6: If the error callback returns false, then move on to the next
// statement, if any, or onto the next overall step otherwise. Otherwise,
// the error callback did not return false, or there was no error callback.
// Jump to the last step in the overall steps.
return invokeCallback(m_callback, 2, argv, callbackReturnValue) || callbackReturnValue;
return invokeCallback(m_callback, 2, argv, callbackReturnValue, context) || callbackReturnValue;
}
} // namespace WebCore
......
......@@ -31,14 +31,15 @@
#include "config.h"
#include "V8CustomVoidCallback.h"
#include "Frame.h"
#include "ScriptExecutionContext.h"
#include "V8Binding.h"
#include "V8Proxy.h"
namespace WebCore {
V8CustomVoidCallback::V8CustomVoidCallback(v8::Local<v8::Object> callback, Frame* frame)
V8CustomVoidCallback::V8CustomVoidCallback(v8::Local<v8::Object> callback, ScriptExecutionContext *context)
: m_callback(v8::Persistent<v8::Object>::New(callback))
, m_frame(frame)
, m_scriptExecutionContext(context)
{
}
......@@ -51,20 +52,17 @@ void V8CustomVoidCallback::handleEvent()
{
v8::HandleScope handleScope;
v8::Handle<v8::Context> context = V8Proxy::context(m_frame.get());
if (context.IsEmpty())
v8::Handle<v8::Context> v8Context = toV8Context(m_scriptExecutionContext.get(), WorldContextHandle(UseCurrentWorld));
if (v8Context.IsEmpty())
return;
v8::Context::Scope scope(context);
// Protect the frame until the callback returns.
RefPtr<Frame> protector(m_frame);
v8::Context::Scope scope(v8Context);
bool callbackReturnValue = false;
invokeCallback(m_callback, 0, 0, callbackReturnValue);
invokeCallback(m_callback, 0, 0, callbackReturnValue, m_scriptExecutionContext.get());
}
bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue)
bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ScriptExecutionContext* scriptExecutionContext)
{
v8::TryCatch exceptionCatcher;
......@@ -83,15 +81,12 @@ bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8
v8::Handle<v8::Object> thisObject = v8::Context::GetCurrent()->Global();
V8Proxy* proxy = V8Proxy::retrieve();
ASSERT(proxy);
v8::Handle<v8::Value> result = proxy->callFunction(callbackFunction, thisObject, argc, argv);
v8::Handle<v8::Value> result = callbackFunction->Call(thisObject, argc, argv);
callbackReturnValue = !result.IsEmpty() && result->BooleanValue();
if (exceptionCatcher.HasCaught()) {
v8::Local<v8::Message> message = exceptionCatcher.Message();
proxy->frame()->document()->reportException(toWebCoreString(message->Get()), message->GetLineNumber(), toWebCoreString(message->GetScriptResourceName()));
scriptExecutionContext->reportException(toWebCoreString(message->Get()), message->GetLineNumber(), toWebCoreString(message->GetScriptResourceName()));
return true;
}
......
......@@ -38,28 +38,28 @@
namespace WebCore {
class Frame;
class ScriptExecutionContext;
class V8CustomVoidCallback : public VoidCallback {
public:
static PassRefPtr<V8CustomVoidCallback> create(v8::Local<v8::Value> value, Frame* frame)
static PassRefPtr<V8CustomVoidCallback> create(v8::Local<v8::Value> value, ScriptExecutionContext* context)
{
ASSERT(value->IsObject());
return adoptRef(new V8CustomVoidCallback(value->ToObject(), frame));
return adoptRef(new V8CustomVoidCallback(value->ToObject(), context));
}
virtual ~V8CustomVoidCallback();
virtual void handleEvent();
private:
V8CustomVoidCallback(v8::Local<v8::Object>, Frame*);
V8CustomVoidCallback(v8::Local<v8::Object>, ScriptExecutionContext* context);
v8::Persistent<v8::Object> m_callback;
RefPtr<Frame> m_frame;
RefPtr<ScriptExecutionContext> m_scriptExecutionContext;
};
// Returns false if callback failed (null, wrong type, or threw exception).
bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue);
bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ScriptExecutionContext* scriptExecutionContext);
} // namespace WebCore
......
......@@ -809,7 +809,7 @@ v8::Handle<v8::Value> V8DOMWindow::openDatabaseCallback(const v8::Arguments& arg
if (!args[4]->IsObject())
return throwError(TYPE_MISMATCH_ERR);
creationCallback = V8DatabaseCallback::create(args[4], imp->frame());
creationCallback = V8DatabaseCallback::create(args[4]);
}
ExceptionCode ec = 0;
......
......@@ -55,8 +55,8 @@ v8::Handle<v8::Value> V8Database::changeVersionCallback(const v8::Arguments& arg
Database* database = V8Database::toNative(args.Holder());
Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
if (!frame)
ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext();
if (!scriptExecutionContext)
return v8::Undefined();
RefPtr<V8SQLTransactionCallback> callback;
......@@ -64,7 +64,7 @@ v8::Handle<v8::Value> V8Database::changeVersionCallback(const v8::Arguments& arg
if (!args[2]->IsObject())
return throwError(TYPE_MISMATCH_ERR);
callback = V8SQLTransactionCallback::create(args[2], frame);
callback = V8SQLTransactionCallback::create(args[2]);
}
RefPtr<V8SQLTransactionErrorCallback> errorCallback;
......@@ -72,7 +72,7 @@ v8::Handle<v8::Value> V8Database::changeVersionCallback(const v8::Arguments& arg
if (!args[3]->IsObject())
return throwError(TYPE_MISMATCH_ERR);
errorCallback = V8SQLTransactionErrorCallback::create(args[3], frame);
errorCallback = V8SQLTransactionErrorCallback::create(args[3]);
}
RefPtr<V8CustomVoidCallback> successCallback;
......@@ -80,7 +80,7 @@ v8::Handle<v8::Value> V8Database::changeVersionCallback(const v8::Arguments& arg
if (!args[4]->IsObject())
return throwError(TYPE_MISMATCH_ERR);
successCallback = V8CustomVoidCallback::create(args[4], frame);
successCallback = V8CustomVoidCallback::create(args[4], scriptExecutionContext);
}
database->changeVersion(oldVersion, newVersion, callback.release(), errorCallback.release(), successCallback.release());
......@@ -98,18 +98,17 @@ static v8::Handle<v8::Value> createTransaction(const v8::Arguments& args, bool r
Database* database = V8Database::toNative(args.Holder());
Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
if (!frame)
ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext();
if (!scriptExecutionContext)
return v8::Undefined();
RefPtr<V8SQLTransactionCallback> callback = V8SQLTransactionCallback::create(args[0], frame);
RefPtr<V8SQLTransactionCallback> callback = V8SQLTransactionCallback::create(args[0]);
RefPtr<V8SQLTransactionErrorCallback> errorCallback;
if (args.Length() > 1 && !isUndefinedOrNull(args[1])) {
if (!args[1]->IsObject())
return throwError(TYPE_MISMATCH_ERR);
errorCallback = V8SQLTransactionErrorCallback::create(args[1], frame);
errorCallback = V8SQLTransactionErrorCallback::create(args[1]);
}
RefPtr<V8CustomVoidCallback> successCallback;
......@@ -117,7 +116,7 @@ static v8::Handle<v8::Value> createTransaction(const v8::Arguments& args, bool r
if (!args[2]->IsObject())
return throwError(TYPE_MISMATCH_ERR);
successCallback = V8CustomVoidCallback::create(args[2], frame);
successCallback = V8CustomVoidCallback::create(args[2], scriptExecutionContext);
}
database->transaction(callback.release(), errorCallback.release(), successCallback.release(), readOnly);
......
......@@ -58,7 +58,7 @@ v8::Handle<v8::Value> V8DatabaseSync::changeVersionCallback(const v8::Arguments&
if (!args[2]->IsObject())
return throwError(TYPE_MISMATCH_ERR);
callback = V8SQLTransactionSyncCallback::create(args[2], 0);
callback = V8SQLTransactionSyncCallback::create(args[2]);
}
ExceptionCode ec = 0;
......@@ -78,7 +78,7 @@ static v8::Handle<v8::Value> createTransaction(const v8::Arguments& args, bool r
DatabaseSync* database = V8DatabaseSync::toNative(args.Holder());
RefPtr<V8SQLTransactionSyncCallback> callback = V8SQLTransactionSyncCallback::create(args[0], 0);
RefPtr<V8SQLTransactionSyncCallback> callback = V8SQLTransactionSyncCallback::create(args[0]);
ExceptionCode ec = 0;
database->transaction(callback.release(), readOnly, ec);
......
......@@ -90,7 +90,7 @@ v8::Handle<v8::Value> V8NotificationCenter::requestPermissionCallback(const v8::
if (!args[0]->IsObject())
return throwError("Callback must be of valid type.", V8Proxy::TypeError);
callback = V8CustomVoidCallback::create(args[0], V8Proxy::retrieveFrameForCurrentContext());
callback = V8CustomVoidCallback::create(args[0], context);
}
notificationCenter->requestPermission(callback.release());
......
......@@ -89,24 +89,22 @@ v8::Handle<v8::Value> V8SQLTransaction::executeSqlCallback(const v8::Arguments&
SQLTransaction* transaction = V8SQLTransaction::toNative(args.Holder());
Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
ScriptExecutionContext* executionContext = getScriptExecutionContext();
if (!executionContext)
return v8::Undefined();
RefPtr<SQLStatementCallback> callback;
if (args.Length() > 2 && !isUndefinedOrNull(args[2])) {
if (!args[2]->IsObject())
return throwError(TYPE_MISMATCH_ERR);
if (frame)
callback = V8SQLStatementCallback::create(args[2], frame);
callback = V8SQLStatementCallback::create(args[2]);
}
RefPtr<SQLStatementErrorCallback> errorCallback;
if (args.Length() > 3 && !isUndefinedOrNull(args[3])) {
if (!args[3]->IsObject())
return throwError(TYPE_MISMATCH_ERR);
if (frame)
errorCallback = V8SQLStatementErrorCallback::create(args[3], frame);
errorCallback = V8SQLStatementErrorCallback::create(args[3]);
}
ExceptionCode ec = 0;
......
......@@ -34,6 +34,7 @@
#include "V8WorkerContext.h"
#if ENABLE(DATABASE)
#include "Database.h"
#include "V8Database.h"
#include "V8DatabaseCallback.h"
#include "V8DatabaseSync.h"
......@@ -143,12 +144,33 @@ v8::Handle<v8::Value> toV8(WorkerContext* impl)
}
#if ENABLE(DATABASE)
v8::Handle<v8::Value> V8WorkerContext::openDatabaseCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WorkerContext.openDatabase()");
// Implementation coming soon.
return throwError(NOT_SUPPORTED_ERR);
}
v8::Handle<v8::Value> V8WorkerContext::openDatabaseCallback(const v8::Arguments& args)
{
INC_STATS("DOM.V8WorkerContext.openDatabase()");
if (args.Length() < 4)
return throwError(SYNTAX_ERR);
EXCEPTION_BLOCK(String, name, toWebCoreString(args[0]));
EXCEPTION_BLOCK(String, version, toWebCoreString(args[1]));
EXCEPTION_BLOCK(String, displayName, toWebCoreString(args[2]));
EXCEPTION_BLOCK(unsigned long, estimatedSize, args[3]->Uint32Value());
WorkerContext* workerContext = V8WorkerContext::toNative(args.Holder());
RefPtr<DatabaseCallback> creationCallback;
if (args.Length() >= 5) {
if (!args[4]->IsObject())
return throwError(TYPE_MISMATCH_ERR);
creationCallback = V8DatabaseCallback::create(args[4]);
}
ExceptionCode ec = 0;
v8::Handle<v8::Value> result = toV8(workerContext->openDatabase(name, version, displayName, estimatedSize, creationCallback.release(), ec));
V8Proxy::setDOMException(ec);
return result;
}
v8::Handle<v8::Value> V8WorkerContext::openDatabaseSyncCallback(const v8::Arguments& args)
{
......@@ -168,7 +190,7 @@ v8::Handle<v8::Value> V8WorkerContext::openDatabaseSyncCallback(const v8::Argume
if (!args[4]->IsObject())
return throwError(TYPE_MISMATCH_ERR);
creationCallback = V8DatabaseCallback::create(args[4], 0);
creationCallback = V8DatabaseCallback::create(args[4]);
}
ExceptionCode ec = 0;
......
2010-05-27 Eric Uhrhane <ericu@chromium.org>
Reviewed by Adam Barth.
Add v8 bindings for async DB API in workers
https://bugs.webkit.org/show_bug.cgi?id=39145
* src/DatabaseObserver.cpp:
We should check that we're on the context thread now, not the main
thread.
(WebCore::DatabaseObserver::databaseOpened):
(WebCore::DatabaseObserver::databaseModified):
(WebCore::DatabaseObserver::databaseClosed):
2010-05-27 Yury Semikhatsky <yurys@chromium.org>
Reviewed by Pavel Feldman.
......
......@@ -67,19 +67,19 @@ bool DatabaseObserver::canEstablishDatabase(ScriptExecutionContext* scriptExecut
void DatabaseObserver::databaseOpened(Database* database)
{
ASSERT(isMainThread());
ASSERT(database->scriptExecutionContext()->isContextThread());
WebDatabase::observer()->databaseOpened(WebDatabase(database));
}
void DatabaseObserver::databaseModified(Database* database)
{
ASSERT(isMainThread());
ASSERT(database->scriptExecutionContext()->isContextThread());
WebDatabase::observer()->databaseModified(WebDatabase(database));
}
void DatabaseObserver::databaseClosed(Database* database)
{
ASSERT(isMainThread());
ASSERT(database->scriptExecutionContext()->isContextThread());
WebDatabase::observer()->databaseClosed(WebDatabase(database));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment