diff options
-rw-r--r-- | V8Binding/V8Binding.derived.mk | 2 | ||||
-rw-r--r-- | V8Binding/binding/InitializeThreading.cpp | 45 | ||||
-rw-r--r-- | V8Binding/binding/InitializeThreading.h | 40 | ||||
-rw-r--r-- | V8Binding/jni/jni_npobject.cpp | 2 | ||||
-rw-r--r-- | V8Binding/npapi/npruntime.h | 4 | ||||
-rw-r--r-- | WebCore/Android.v8.mk | 1 | ||||
-rw-r--r-- | WebCore/loader/icon/IconDatabase.cpp | 11 | ||||
-rw-r--r-- | WebCore/storage/Database.cpp | 5 | ||||
-rw-r--r-- | WebKit/android/jni/WebCoreFrameBridge.cpp | 11 |
9 files changed, 114 insertions, 7 deletions
diff --git a/V8Binding/V8Binding.derived.mk b/V8Binding/V8Binding.derived.mk index e0bb883..0bfd6a1 100644 --- a/V8Binding/V8Binding.derived.mk +++ b/V8Binding/V8Binding.derived.mk @@ -23,6 +23,7 @@ BINDING_C_INCLUDES := \ $(LOCAL_PATH)/v8/include \ $(WEBCORE_PATH)/bindings/v8 \ $(WEBCORE_PATH)/bindings/v8/custom \ + $(LOCAL_PATH)/binding \ $(LOCAL_PATH)/npapi \ $(LOCAL_PATH)/jni \ $(JAVASCRIPTCORE_PATH)/wtf \ @@ -161,6 +162,7 @@ WEBCORE_SRC_FILES := $(WEBCORE_SRC_FILES) \ endif LOCAL_SRC_FILES := \ + binding/InitializeThreading.cpp \ jni/jni_class.cpp \ jni/jni_instance.cpp \ jni/jni_npobject.cpp \ diff --git a/V8Binding/binding/InitializeThreading.cpp b/V8Binding/binding/InitializeThreading.cpp new file mode 100644 index 0000000..8577369 --- /dev/null +++ b/V8Binding/binding/InitializeThreading.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2008 Apple 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 "InitializeThreading.h" +#include <wtf/Threading.h> + +namespace V8 { + +void initializeThreading() { + static bool initializedThreading = false; + if (!initializedThreading) { + WTF::initializeThreading(); + initializedThreading = true; + } +} + +} // namespace JSC + + diff --git a/V8Binding/binding/InitializeThreading.h b/V8Binding/binding/InitializeThreading.h new file mode 100644 index 0000000..47b3957 --- /dev/null +++ b/V8Binding/binding/InitializeThreading.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2008 Apple 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 InitializeThreading_h +#define InitializeThreading_h + +namespace V8 { + + // This function must be called from the main thread. It is safe to call it repeatedly. + // Darwin is an exception to this rule: it is OK to call this function from any thread, even reentrantly. + void initializeThreading(); +} + +#endif // InitializeThreading_h + diff --git a/V8Binding/jni/jni_npobject.cpp b/V8Binding/jni/jni_npobject.cpp index 3765452..9f59045 100644 --- a/V8Binding/jni/jni_npobject.cpp +++ b/V8Binding/jni/jni_npobject.cpp @@ -68,7 +68,7 @@ static NPClass JavaNPObjectClass = { NPObject* JavaInstanceToNPObject(JavaInstance* instance) { - JavaNPObject* object = reinterpret_cast<JavaNPObject*>(NPN_CreateObject(0, &JavaNPObjectClass)); + JavaNPObject* object = reinterpret_cast<JavaNPObject*>(_NPN_CreateObject(0, &JavaNPObjectClass)); object->_instance = instance; return reinterpret_cast<NPObject*>(object); } diff --git a/V8Binding/npapi/npruntime.h b/V8Binding/npapi/npruntime.h index ec26680..b0ca9e4 100644 --- a/V8Binding/npapi/npruntime.h +++ b/V8Binding/npapi/npruntime.h @@ -308,7 +308,7 @@ struct NPObject { function it is the responsibility of that implementation to set the initial retain count to 1. */ -NPObject *NPN_CreateObject(NPP npp, NPClass *aClass); +NPObject *_NPN_CreateObject(NPP npp, NPClass *aClass); /* Increment the NPObject's reference count. @@ -320,7 +320,7 @@ NPObject *NPN_RetainObject (NPObject *obj); count goes to zero, the class's destroy function is invoke if specified, otherwise the object is freed directly. */ -void NPN_ReleaseObject (NPObject *obj); +void _NPN_ReleaseObject (NPObject *obj); /* Functions to access script objects represented by NPObject. diff --git a/WebCore/Android.v8.mk b/WebCore/Android.v8.mk index bf3d131..cd1b423 100644 --- a/WebCore/Android.v8.mk +++ b/WebCore/Android.v8.mk @@ -143,6 +143,7 @@ LOCAL_SRC_FILES := \ css/MediaQuery.cpp \ css/MediaQueryEvaluator.cpp \ css/MediaQueryExp.cpp \ + css/RGBColor.cpp \ ifeq ($(ENABLE_SVG), true) LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ diff --git a/WebCore/loader/icon/IconDatabase.cpp b/WebCore/loader/icon/IconDatabase.cpp index 9c026d7..1835f69 100644 --- a/WebCore/loader/icon/IconDatabase.cpp +++ b/WebCore/loader/icon/IconDatabase.cpp @@ -39,11 +39,16 @@ #include "SQLiteStatement.h" #include "SQLiteTransaction.h" #include "SuddenTermination.h" -#include <runtime/InitializeThreading.h> #include <wtf/CurrentTime.h> #include <wtf/MainThread.h> #include <wtf/StdLibExtras.h> +#if USE(JSC) +#include <runtime/InitializeThreading.h> +#elif USE(V8) +#include "InitializeThreading.h" +#endif + // For methods that are meant to support API from the main thread - should not be called internally #define ASSERT_NOT_SYNC_THREAD() ASSERT(!m_syncThreadRunning || !IS_ICON_SYNC_THREAD()) @@ -93,7 +98,11 @@ static IconDatabaseClient* defaultClient() IconDatabase* iconDatabase() { if (!sharedIconDatabase) { +#if USE(JSC) JSC::initializeThreading(); +#elif USE(V8) + V8::initializeThreading(); +#endif sharedIconDatabase = new IconDatabase; } return sharedIconDatabase; diff --git a/WebCore/storage/Database.cpp b/WebCore/storage/Database.cpp index 2292a0a..5504cb1 100644 --- a/WebCore/storage/Database.cpp +++ b/WebCore/storage/Database.cpp @@ -56,6 +56,8 @@ #if USE(JSC) #include "JSDOMWindow.h" #include <runtime/InitializeThreading.h> +#elif USE(V8) +#include "InitializeThreading.h" #endif namespace WebCore { @@ -147,6 +149,9 @@ Database::Database(Document* document, const String& name, const String& expecte JSC::initializeThreading(); // Database code violates the normal JSCore contract by calling jsUnprotect from a secondary thread, and thus needs additional locking. JSDOMWindow::commonJSGlobalData()->heap.setGCProtectNeedsLocking(); +#elif USE(V8) + // TODO(benm): do we need the extra locking in V8 too? (See JSC comment above) + V8::initializeThreading(); #endif m_guid = guidForOriginAndName(m_securityOrigin->toString(), name); diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp index 6048c98..d042c92 100644 --- a/WebKit/android/jni/WebCoreFrameBridge.cpp +++ b/WebKit/android/jni/WebCoreFrameBridge.cpp @@ -26,7 +26,7 @@ #define LOG_TAG "webcoreglue" #include <config.h> -#include <runtime/InitializeThreading.h> + #include <wtf/Platform.h> #include "android_graphics.h" @@ -63,8 +63,10 @@ #if USE(JSC) #include "GCController.h" #include "JSDOMWindow.h" +#include <runtime/InitializeThreading.h> #include <runtime/JSLock.h> #elif USE(V8) +#include "InitializeThreading.h" #include "jni_npobject.h" #include "jni_instance.h" #endif // USE(JSC) @@ -716,8 +718,11 @@ static void CallPolicyFunction(JNIEnv* env, jobject obj, jint func, jint decisio static void CreateFrame(JNIEnv* env, jobject obj, jobject javaview, jobject jAssetManager, jobject historyList) { - // TODO(andreip): Where did the V8InitializeThreading.h disappear? +#if USE(JSC) JSC::initializeThreading(); +#elif USE(V8) + V8::initializeThreading(); +#endif #ifdef ANDROID_INSTRUMENT TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); @@ -1087,7 +1092,7 @@ static void AddJavascriptInterface(JNIEnv *env, jobject obj, jint nativeFramePoi // the ref count when the object is not reachable from JavaScript // side. Code here must release the reference count increased by // JavaInstanceToNPObject. - NPN_ReleaseObject(obj); + _NPN_ReleaseObject(obj); JSC::Bindings::releaseCharactersForJString(interfaceName, name); } #endif |