void initializeWithoutV8(Platform* platform) { ASSERT(!s_webKitInitialized); s_webKitInitialized = true; ASSERT(platform); //Platform::initialize(platform); // weolar:因为Platform::initialize需要创建mainthread,所以等初始化好了main thread再调用,放到后面去。 WTF::setRandomSource(cryptographicallyRandomValues); WTF::initialize(currentTimeFunction, monotonicallyIncreasingTimeFunction, systemTraceTimeFunction, histogramEnumerationFunction, adjustAmountOfExternalAllocatedMemory); WTF::initializeMainThread(callOnMainThreadFunction); Platform::initialize(platform); Heap::init(); ThreadState::attachMainThread(); // currentThread() is null if we are running on a thread without a message loop. if (WebThread* currentThread = platform->currentThread()) { ASSERT(!s_pendingGCRunner); s_pendingGCRunner = new PendingGCRunner; currentThread->addTaskObserver(s_pendingGCRunner); ASSERT(!s_messageLoopInterruptor); s_messageLoopInterruptor = new MessageLoopInterruptor(currentThread); ThreadState::current()->addInterruptor(s_messageLoopInterruptor); } DEFINE_STATIC_LOCAL(ModulesInitializer, initializer, ()); initializer.init(); #ifdef MINIBLINK_NOT_IMPLEMENTED setIndexedDBClientCreateFunction(IndexedDBClientImpl::create); #endif // MINIBLINK_NOT_IMPLEMENTED MediaPlayer::setMediaEngineCreateFunction(WebMediaPlayerClientImpl::create); }
void initializeWithoutV8(Platform* platform) { ASSERT(!s_webKitInitialized); s_webKitInitialized = true; ASSERT(platform); Platform::initialize(platform); WTF::setRandomSource(cryptographicallyRandomValues); WTF::initialize(currentTimeFunction, monotonicallyIncreasingTimeFunction); WTF::initializeMainThread(callOnMainThreadFunction); Heap::init(); ThreadState::attachMainThread(); // currentThread will always be non-null in production, but can be null in Chromium unit tests. if (WebThread* currentThread = platform->currentThread()) { ASSERT(!s_pendingGCRunner); s_pendingGCRunner = new PendingGCRunner; currentThread->addTaskObserver(s_pendingGCRunner); ASSERT(!s_messageLoopInterruptor); s_messageLoopInterruptor = new MessageLoopInterruptor(currentThread); ThreadState::current()->addInterruptor(s_messageLoopInterruptor); } DEFINE_STATIC_LOCAL(ModulesInitializer, initializer, ()); initializer.init(); // There are some code paths (for example, running WebKit in the browser // process and calling into LocalStorage before anything else) where the // UTF8 string encoding tables are used on a background thread before // they're set up. This is a problem because their set up routines assert // they're running on the main WebKitThread. It might be possible to make // the initialization thread-safe, but given that so many code paths use // this, initializing this lazily probably doesn't buy us much. WTF::UTF8Encoding(); setIndexedDBClientCreateFunction(IndexedDBClientImpl::create); MediaPlayer::setMediaEngineCreateFunction(WebMediaPlayerClientImpl::create); }
void initializeWithoutV8(Platform* platform) { ASSERT(!s_webKitInitialized); s_webKitInitialized = true; ASSERT(platform); Platform::initialize(platform); WTF::initialize(currentTimeFunction, monotonicallyIncreasingTimeFunction, histogramEnumerationFunction, adjustAmountOfExternalAllocatedMemory); WTF::initializeMainThread(callOnMainThreadFunction); Heap::init(); ThreadState::attachMainThread(); // currentThread() is null if we are running on a thread without a message loop. if (WebThread* currentThread = platform->currentThread()) { ASSERT(!s_gcTaskRunner); s_gcTaskRunner = new GCTaskRunner(currentThread); } DEFINE_STATIC_LOCAL(ModulesInitializer, initializer, ()); initializer.init(); setIndexedDBClientCreateFunction(IndexedDBClientImpl::create); }