Exemplo n.º 1
0
void initialize(WebKitPlatformSupport* webKitPlatformSupport)
{
    initializeWithoutV8(webKitPlatformSupport);

    v8::V8::SetEntropySource(&generateEntropy);
    v8::V8::Initialize();
    WebCore::V8PerIsolateData::ensureInitialized(v8::Isolate::GetCurrent());

#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);
    }
#endif
}
void initialize(Platform* platform)
{
    initializeWithoutV8(platform);

    v8::V8::SetEntropySource(&generateEntropy);
    v8::V8::SetArrayBufferAllocator(WebCore::v8ArrayBufferAllocator());
    static const char* kTypedArraysFlag = "--harmony_array_buffer --harmony_typed_arrays";
    v8::V8::SetFlagsFromString(kTypedArraysFlag, strlen(kTypedArraysFlag));
    v8::V8::Initialize();
    WebCore::V8PerIsolateData::ensureInitialized(v8::Isolate::GetCurrent());

    // currentThread will always be non-null in production, but can be null in Chromium unit tests.
    if (WebThread* currentThread = platform->currentThread()) {
#ifndef NDEBUG
        v8::V8::AddCallCompletedCallback(&assertV8RecursionScope);
#endif
        ASSERT(!s_endOfTaskRunner);
        s_endOfTaskRunner = new EndOfTaskRunner;
        currentThread->addTaskObserver(s_endOfTaskRunner);
    }
}
Exemplo n.º 3
0
void initialize(Platform* platform)
{
    initializeWithoutV8(platform);

    v8::V8::InitializePlatform(gin::V8Platform::Get());
    v8::Isolate* isolate = v8::Isolate::New();
    isolate->Enter();
    WebCore::V8Initializer::initializeMainThreadIfNeeded(isolate);
    v8::V8::SetEntropySource(&generateEntropy);
    v8::V8::SetArrayBufferAllocator(WebCore::v8ArrayBufferAllocator());
    v8::V8::Initialize();
    WebCore::V8PerIsolateData::ensureInitialized(isolate);

    s_isolateInterruptor = new WebCore::V8IsolateInterruptor(v8::Isolate::GetCurrent());
    WebCore::ThreadState::current()->addInterruptor(s_isolateInterruptor);

    // currentThread will always be non-null in production, but can be null in Chromium unit tests.
    if (WebThread* currentThread = platform->currentThread()) {
        ASSERT(!s_endOfTaskRunner);
        s_endOfTaskRunner = new EndOfTaskRunner;
        currentThread->addTaskObserver(s_endOfTaskRunner);
    }
}