OSDN Git Service

Cherry-pick WebKit change 56112 to add WORKERS guards to V8 bindings
authorSteve Block <steveblock@google.com>
Wed, 17 Mar 2010 15:01:37 +0000 (15:01 +0000)
committerSteve Block <steveblock@google.com>
Wed, 17 Mar 2010 15:39:51 +0000 (15:39 +0000)
The motivation for this change is to allow us to disable workers on Android,
because V8 on Android does not have the required locking.

See http://trac.webkit.org/changeset/56112

Change-Id: Ieee214f4765af3188bbdc51c56f14883f6a6779c

WebCore/bindings/v8/V8DOMWrapper.cpp
WebCore/bindings/v8/V8Proxy.cpp

index d2ed659..0f96a74 100644 (file)
@@ -212,6 +212,7 @@ v8::Local<v8::Function> V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType
     return getConstructorForContext(type, context);
 }
 
+#if ENABLE(WORKERS)
 v8::Local<v8::Function> V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType type, WorkerContext*)
 {
     WorkerContextExecutionProxy* proxy = WorkerContextExecutionProxy::retrieve();
@@ -224,6 +225,7 @@ v8::Local<v8::Function> V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType
 
     return getConstructorForContext(type, context);
 }
+#endif
 
 void V8DOMWrapper::setHiddenWindowReference(Frame* frame, const int internalIndex, v8::Handle<v8::Object> jsObject)
 {
@@ -296,8 +298,10 @@ v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, V8ClassI
             v8::Handle<v8::Object> globalPrototype = v8::Handle<v8::Object>::Cast(context->Global()->GetPrototype());
             if (globalObjectPrototypeIsDOMWindow(globalPrototype))
                 proxy = V8Proxy::retrieve(V8DOMWindow::toNative(globalPrototype)->frame());
+#if ENABLE(WORKERS)
             else
                 workerContext = V8WorkerContext::toNative(globalPrototype);
+#endif
         }
     }
 
index 9b1fff5..85db554 100644 (file)
@@ -910,9 +910,11 @@ v8::Local<v8::Context> toV8Context(ScriptExecutionContext* context, const WorldC
     if (context->isDocument()) {
         if (V8Proxy* proxy = V8Proxy::retrieve(context))
             return worldContext.adjustedContext(proxy);
+#if ENABLE(WORKERS)
     } else if (context->isWorkerContext()) {
         if (WorkerContextExecutionProxy* proxy = static_cast<WorkerContext*>(context)->script()->proxy())
             return proxy->context();
+#endif
     }
     return v8::Local<v8::Context>();
 }