diff options
author | Feng Qian <fqian@google.com> | 2009-04-24 17:10:18 -0700 |
---|---|---|
committer | Feng Qian <fqian@google.com> | 2009-04-24 17:10:18 -0700 |
commit | 1d46464ff4a2f0c744bdf3e04966bc3e692f3017 (patch) | |
tree | 8e24e9d6bd858060f6ea8fa646fadf202281081e | |
parent | 109a58c31072b14f5b2c0493ed6c5a1855f82fd7 (diff) | |
download | external_webkit-1d46464ff4a2f0c744bdf3e04966bc3e692f3017.zip external_webkit-1d46464ff4a2f0c744bdf3e04966bc3e692f3017.tar.gz external_webkit-1d46464ff4a2f0c744bdf3e04966bc3e692f3017.tar.bz2 |
Fix the threading issue.
Make a new thread initialization V8::initializeThreading similar to JSC::initializeThreading.
-rw-r--r-- | V8Binding/V8Binding.derived.mk | 1 | ||||
-rw-r--r-- | V8Binding/v8/V8InitializeThreading.cpp | 44 | ||||
-rw-r--r-- | V8Binding/v8/V8InitializeThreading.h | 39 | ||||
-rw-r--r-- | WebCore/Android.mk | 4 | ||||
-rw-r--r-- | WebCore/loader/icon/IconDatabase.cpp | 9 | ||||
-rw-r--r-- | WebKit/android/jni/WebCoreFrameBridge.cpp | 5 |
6 files changed, 98 insertions, 4 deletions
diff --git a/V8Binding/V8Binding.derived.mk b/V8Binding/V8Binding.derived.mk index 2515887..fb71732 100644 --- a/V8Binding/V8Binding.derived.mk +++ b/V8Binding/V8Binding.derived.mk @@ -109,6 +109,7 @@ WEBCORE_SRC_FILES := $(WEBCORE_SRC_FILES) \ bridge/jni/jni_utility.cpp LOCAL_SRC_FILES := \ + v8/V8InitializeThreading.cpp \ v8/JSDOMBinding.cpp \ v8/JSXPathNSResolver.cpp \ v8/NPV8Object.cpp \ diff --git a/V8Binding/v8/V8InitializeThreading.cpp b/V8Binding/v8/V8InitializeThreading.cpp new file mode 100644 index 0000000..869e374 --- /dev/null +++ b/V8Binding/v8/V8InitializeThreading.cpp @@ -0,0 +1,44 @@ +/* + * 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 "V8InitializeThreading.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/v8/V8InitializeThreading.h b/V8Binding/v8/V8InitializeThreading.h new file mode 100644 index 0000000..e548441 --- /dev/null +++ b/V8Binding/v8/V8InitializeThreading.h @@ -0,0 +1,39 @@ +/* + * 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/WebCore/Android.mk b/WebCore/Android.mk index 356aa1d..e1cba75 100644 --- a/WebCore/Android.mk +++ b/WebCore/Android.mk @@ -648,8 +648,8 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ plugins/npapi.cpp \ \ plugins/android/PluginDataAndroid.cpp \ - plugins/android/PluginPackageAndroid.cpp \ - plugins/android/PluginViewAndroid.cpp \ + plugins/android/PluginPackageAndroid.cpp \ + plugins/android/PluginViewAndroid.cpp \ \ rendering/AutoTableLayout.cpp \ rendering/CounterNode.cpp \ diff --git a/WebCore/loader/icon/IconDatabase.cpp b/WebCore/loader/icon/IconDatabase.cpp index 9d5bd20..7e339c1 100644 --- a/WebCore/loader/icon/IconDatabase.cpp +++ b/WebCore/loader/icon/IconDatabase.cpp @@ -40,11 +40,16 @@ #include "PageURLRecord.h" #include "SQLiteStatement.h" #include "SQLiteTransaction.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 "V8InitializeThreading.h" +#endif + #if PLATFORM(WIN_OS) #include <windows.h> #include <winbase.h> @@ -109,7 +114,7 @@ IconDatabase* iconDatabase() #if USE(JSC) JSC::initializeThreading(); #elif USE(V8) - // TODO(fqian): Do something for V8 + V8::initializeThreading(); #endif sharedIconDatabase = new IconDatabase; } diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp index 5322f5d..b7e042b 100644 --- a/WebKit/android/jni/WebCoreFrameBridge.cpp +++ b/WebKit/android/jni/WebCoreFrameBridge.cpp @@ -61,6 +61,8 @@ #include "JSDOMWindow.h" #include <runtime/InitializeThreading.h> #include <runtime/JSLock.h> +#elif USE(V8) +#include "V8InitializeThreading.h" #endif // USE(JSC) #include "KURL.h" @@ -689,7 +691,10 @@ static void CreateFrame(JNIEnv* env, jobject obj, jobject javaview, jobject jAss { #if USE(JSC) JSC::initializeThreading(); +#elif USE(V8) + V8::initializeThreading(); #endif + #ifdef ANDROID_INSTRUMENT TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); #endif |