diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-07 11:21:11 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-07 11:21:11 +0200 |
commit | 2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (patch) | |
tree | 988e8c5b116dd0466244ae2fe5af8ee9be926d76 /Source/WebKit/chromium/src/WebKit.cpp | |
parent | dd91e772430dc294e3bf478c119ef8d43c0a3358 (diff) | |
download | qtwebkit-2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47.tar.gz |
Imported WebKit commit 7e538425aa020340619e927792f3d895061fb54b (http://svn.webkit.org/repository/webkit/trunk@116286)
Diffstat (limited to 'Source/WebKit/chromium/src/WebKit.cpp')
-rw-r--r-- | Source/WebKit/chromium/src/WebKit.cpp | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/Source/WebKit/chromium/src/WebKit.cpp b/Source/WebKit/chromium/src/WebKit.cpp index 77858c4e7..da54cca50 100644 --- a/Source/WebKit/chromium/src/WebKit.cpp +++ b/Source/WebKit/chromium/src/WebKit.cpp @@ -37,23 +37,24 @@ #include "Settings.h" #include "TextEncoding.h" #include "V8Binding.h" +#include "V8RecursionScope.h" #include "WebKitMutationObserver.h" -#include "platform/WebKitPlatformSupport.h" #include "WebMediaPlayerClientImpl.h" #include "WebSocket.h" -#include "platform/WebThread.h" #include "WorkerContextExecutionProxy.h" +#include "platform/WebKitPlatformSupport.h" +#include "platform/WebThread.h" #include "v8.h" - -#if OS(DARWIN) -#include "WebSystemInterface.h" -#endif - +#include <public/Platform.h> #include <wtf/Assertions.h> #include <wtf/MainThread.h> #include <wtf/Threading.h> #include <wtf/text/AtomicString.h> +#if OS(DARWIN) +#include "WebSystemInterface.h" +#endif + namespace WebKit { #if ENABLE(MUTATION_OBSERVERS) @@ -88,6 +89,13 @@ static bool generateEntropy(unsigned char* buffer, size_t length) return false; } +#ifndef NDEBUG +static void assertV8RecursionScope() +{ + ASSERT(!isMainThread() || WebCore::V8RecursionScope::properlyUsed()); +} +#endif + void initialize(WebKitPlatformSupport* webKitPlatformSupport) { initializeWithoutV8(webKitPlatformSupport); @@ -99,6 +107,9 @@ void initialize(WebKitPlatformSupport* webKitPlatformSupport) #if ENABLE(MUTATION_OBSERVERS) // currentThread will always be non-null in production, but can be null in Chromium unit tests. if (WebThread* currentThread = webKitPlatformSupport->currentThread()) { +#ifndef NDEBUG + v8::V8::AddCallCompletedCallback(&assertV8RecursionScope); +#endif ASSERT(!s_endOfTaskRunner); s_endOfTaskRunner = new EndOfTaskRunner; currentThread->addTaskObserver(s_endOfTaskRunner); @@ -118,6 +129,7 @@ void initializeWithoutV8(WebKitPlatformSupport* webKitPlatformSupport) ASSERT(webKitPlatformSupport); ASSERT(!s_webKitPlatformSupport); s_webKitPlatformSupport = webKitPlatformSupport; + Platform::initialize(s_webKitPlatformSupport); WTF::initializeThreading(); WTF::initializeMainThread(); @@ -136,8 +148,13 @@ void initializeWithoutV8(WebKitPlatformSupport* webKitPlatformSupport) void shutdown() { + // WebKit might have been initialized without V8, so be careful not to invoke + // V8 specific functions, if V8 was not properly initialized. #if ENABLE(MUTATION_OBSERVERS) if (s_endOfTaskRunner) { +#ifndef NDEBUG + v8::V8::RemoveCallCompletedCallback(&assertV8RecursionScope); +#endif ASSERT(s_webKitPlatformSupport->currentThread()); s_webKitPlatformSupport->currentThread()->removeTaskObserver(s_endOfTaskRunner); delete s_endOfTaskRunner; @@ -145,6 +162,7 @@ void shutdown() } #endif s_webKitPlatformSupport = 0; + Platform::shutdown(); } WebKitPlatformSupport* webKitPlatformSupport() |