summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-17 16:13:09 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-17 16:13:09 +0000
commitd49af7fb105915e2298b9d9c4de11d02022ded3d (patch)
tree815c3510ed095c94e00827bc998c391d1f841768 /webkit
parent0f55d5c67c4b80b85aa56313dc09fc1b99518692 (diff)
downloadchromium_src-d49af7fb105915e2298b9d9c4de11d02022ded3d.zip
chromium_src-d49af7fb105915e2298b9d9c4de11d02022ded3d.tar.gz
chromium_src-d49af7fb105915e2298b9d9c4de11d02022ded3d.tar.bz2
Enable building worker and use command line switch to turn on this feature.
Review URL: http://codereview.chromium.org/41029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11870 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rwxr-xr-xwebkit/build/V8Bindings/build-generated-files.sh2
-rw-r--r--webkit/build/webkit_common_defines.vsprops2
-rw-r--r--webkit/port/bindings/v8/V8WorkerCustom.cpp6
-rw-r--r--webkit/port/bindings/v8/WorkerContextExecutionProxy.cpp10
-rw-r--r--webkit/port/bindings/v8/WorkerContextExecutionProxy.h4
5 files changed, 22 insertions, 2 deletions
diff --git a/webkit/build/V8Bindings/build-generated-files.sh b/webkit/build/V8Bindings/build-generated-files.sh
index f3e41f3..46a3dc0 100755
--- a/webkit/build/V8Bindings/build-generated-files.sh
+++ b/webkit/build/V8Bindings/build-generated-files.sh
@@ -43,7 +43,7 @@ export ENCODINGS_PREFIX=""
# To see what FEATURE_DEFINES Apple uses, look at:
# webkit/third_party/WebCore/Configurations/WebCore.xcconfig
-export FEATURE_DEFINES="ENABLE_VIDEO ENABLE_SVG ENABLE_SVG_ANIMATION ENABLE_SVG_AS_IMAGE ENABLE_SVG_FONTS ENABLE_SVG_FOREIGN_OBJECT ENABLE_SVG_USE ENABLE_XPATH ENABLE_XSLT"
+export FEATURE_DEFINES="ENABLE_WORKERS ENABLE_VIDEO ENABLE_SVG ENABLE_SVG_ANIMATION ENABLE_SVG_AS_IMAGE ENABLE_SVG_FONTS ENABLE_SVG_FOREIGN_OBJECT ENABLE_SVG_USE ENABLE_XPATH ENABLE_XSLT"
# Adjust the number of jobs spawned according to the CPU count.
if [ -z "$NUMBER_OF_PROCESSORS" ]; then
diff --git a/webkit/build/webkit_common_defines.vsprops b/webkit/build/webkit_common_defines.vsprops
index 0ea8266..e2ff37a5 100644
--- a/webkit/build/webkit_common_defines.vsprops
+++ b/webkit/build/webkit_common_defines.vsprops
@@ -6,6 +6,6 @@
>
<Tool
Name="VCCLCompilerTool"
- PreprocessorDefinitions="ENABLE_DATABASE=1;ENABLE_DASHBOARD_SUPPORT=0;ENABLE_JAVASCRIPT_DEBUGGER=0;ENABLE_JSC_MULTIPLE_THREADS=0;ENABLE_ICONDATABASE=0;ENABLE_XSLT=1;ENABLE_XPATH=1;ENABLE_SVG=1;ENABLE_SVG_ANIMATION=1;ENABLE_SVG_AS_IMAGE=1;ENABLE_SVG_USE=1;ENABLE_SVG_FOREIGN_OBJECT=1;ENABLE_SVG_FONTS=1;ENABLE_VIDEO=1;ENABLE_WORKERS=0;WEBCORE_NAVIGATOR_PLATFORM=&quot;\&quot;Win32\&quot;&quot;;USE_GOOGLE_URL_LIBRARY;USE_SYSTEM_MALLOC=1;CRASH=__debugbreak;BUILDING_CHROMIUM__=1"
+ PreprocessorDefinitions="ENABLE_DATABASE=1;ENABLE_DASHBOARD_SUPPORT=0;ENABLE_JAVASCRIPT_DEBUGGER=0;ENABLE_JSC_MULTIPLE_THREADS=0;ENABLE_ICONDATABASE=0;ENABLE_XSLT=1;ENABLE_XPATH=1;ENABLE_SVG=1;ENABLE_SVG_ANIMATION=1;ENABLE_SVG_AS_IMAGE=1;ENABLE_SVG_USE=1;ENABLE_SVG_FOREIGN_OBJECT=1;ENABLE_SVG_FONTS=1;ENABLE_VIDEO=1;ENABLE_WORKERS=1;WEBCORE_NAVIGATOR_PLATFORM=&quot;\&quot;Win32\&quot;&quot;;USE_GOOGLE_URL_LIBRARY;USE_SYSTEM_MALLOC=1;CRASH=__debugbreak;BUILDING_CHROMIUM__=1"
/>
</VisualStudioPropertySheet>
diff --git a/webkit/port/bindings/v8/V8WorkerCustom.cpp b/webkit/port/bindings/v8/V8WorkerCustom.cpp
index 7426383..47be71c 100644
--- a/webkit/port/bindings/v8/V8WorkerCustom.cpp
+++ b/webkit/port/bindings/v8/V8WorkerCustom.cpp
@@ -34,6 +34,7 @@
#include "v8_binding.h"
#include "v8_custom.h"
#include "v8_proxy.h"
+#include "WorkerContextExecutionProxy.h"
#include "ExceptionCode.h"
#include "Frame.h"
@@ -48,6 +49,11 @@ namespace WebCore {
CALLBACK_FUNC_DECL(WorkerConstructor) {
INC_STATS(L"DOM.Worker.Constructor");
+ if (!WorkerContextExecutionProxy::IsWebWorkersEnabled()) {
+ V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR, "Worker is not enabled.");
+ return v8::Undefined();
+ }
+
if (!args.IsConstructCall()) {
V8Proxy::ThrowError(V8Proxy::TYPE_ERROR,
"DOM object constructor cannot be called as a function.");
diff --git a/webkit/port/bindings/v8/WorkerContextExecutionProxy.cpp b/webkit/port/bindings/v8/WorkerContextExecutionProxy.cpp
index b9ccf66..bfc4dec 100644
--- a/webkit/port/bindings/v8/WorkerContextExecutionProxy.cpp
+++ b/webkit/port/bindings/v8/WorkerContextExecutionProxy.cpp
@@ -45,6 +45,16 @@
namespace WebCore {
+static bool g_worker_enabled = false;
+
+bool WorkerContextExecutionProxy::IsWebWorkersEnabled() {
+ return g_worker_enabled;
+}
+
+void WorkerContextExecutionProxy::EnableWebWorkers(bool value) {
+ g_worker_enabled = true;
+}
+
WorkerContextExecutionProxy::WorkerContextExecutionProxy(
WorkerContext* workerContext)
: m_workerContext(workerContext),
diff --git a/webkit/port/bindings/v8/WorkerContextExecutionProxy.h b/webkit/port/bindings/v8/WorkerContextExecutionProxy.h
index 2aaa160..9a5a0aa 100644
--- a/webkit/port/bindings/v8/WorkerContextExecutionProxy.h
+++ b/webkit/port/bindings/v8/WorkerContextExecutionProxy.h
@@ -88,6 +88,10 @@ class WorkerContextExecutionProxy {
static v8::Handle<v8::Value> EventTargetToV8Object(EventTarget* target);
static v8::Handle<v8::Value> WorkerContextToV8Object(WorkerContext* wc);
+ // Enables HTML5 worker support.
+ static void EnableWebWorkers(bool value);
+ static bool IsWebWorkersEnabled();
+
private:
void InitContextIfNeeded();
void Dispose();