| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "RuntimeEnabledFeatures.h" | 35 #include "RuntimeEnabledFeatures.h" |
| 36 #include "WebMediaPlayerClientImpl.h" | 36 #include "WebMediaPlayerClientImpl.h" |
| 37 #include "bindings/v8/V8Binding.h" | 37 #include "bindings/v8/V8Binding.h" |
| 38 #include "bindings/v8/V8Initializer.h" | 38 #include "bindings/v8/V8Initializer.h" |
| 39 #include "bindings/v8/V8RecursionScope.h" | 39 #include "bindings/v8/V8RecursionScope.h" |
| 40 #include "core/Init.h" | 40 #include "core/Init.h" |
| 41 #include "core/dom/Microtask.h" | 41 #include "core/dom/Microtask.h" |
| 42 #include "core/page/Page.h" | 42 #include "core/page/Page.h" |
| 43 #include "core/frame/Settings.h" | 43 #include "core/frame/Settings.h" |
| 44 #include "core/workers/WorkerGlobalScopeProxy.h" | 44 #include "core/workers/WorkerGlobalScopeProxy.h" |
| 45 #include "gin/public/v8_platform.h" |
| 45 #include "platform/LayoutTestSupport.h" | 46 #include "platform/LayoutTestSupport.h" |
| 46 #include "platform/Logging.h" | 47 #include "platform/Logging.h" |
| 47 #include "platform/graphics/ImageDecodingStore.h" | 48 #include "platform/graphics/ImageDecodingStore.h" |
| 48 #include "platform/graphics/media/MediaPlayer.h" | 49 #include "platform/graphics/media/MediaPlayer.h" |
| 49 #include "platform/heap/Heap.h" | 50 #include "platform/heap/Heap.h" |
| 50 #include "platform/heap/glue/MessageLoopInterruptor.h" | 51 #include "platform/heap/glue/MessageLoopInterruptor.h" |
| 51 #include "platform/heap/glue/PendingGCRunner.h" | 52 #include "platform/heap/glue/PendingGCRunner.h" |
| 52 #include "public/platform/Platform.h" | 53 #include "public/platform/Platform.h" |
| 53 #include "public/platform/WebPrerenderingSupport.h" | 54 #include "public/platform/WebPrerenderingSupport.h" |
| 54 #include "public/platform/WebThread.h" | 55 #include "public/platform/WebThread.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 static void assertV8RecursionScope() | 98 static void assertV8RecursionScope() |
| 98 { | 99 { |
| 99 ASSERT(!isMainThread() || WebCore::V8RecursionScope::properlyUsed(v8::Isolat
e::GetCurrent())); | 100 ASSERT(!isMainThread() || WebCore::V8RecursionScope::properlyUsed(v8::Isolat
e::GetCurrent())); |
| 100 } | 101 } |
| 101 #endif | 102 #endif |
| 102 | 103 |
| 103 void initialize(Platform* platform) | 104 void initialize(Platform* platform) |
| 104 { | 105 { |
| 105 initializeWithoutV8(platform); | 106 initializeWithoutV8(platform); |
| 106 | 107 |
| 107 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 108 v8::V8::InitializePlatform(gin::V8Platform::Get()); |
| 109 v8::Isolate* isolate = v8::Isolate::New(); |
| 110 isolate->Enter(); |
| 108 WebCore::V8Initializer::initializeMainThreadIfNeeded(isolate); | 111 WebCore::V8Initializer::initializeMainThreadIfNeeded(isolate); |
| 109 v8::V8::SetEntropySource(&generateEntropy); | 112 v8::V8::SetEntropySource(&generateEntropy); |
| 110 v8::V8::SetArrayBufferAllocator(WebCore::v8ArrayBufferAllocator()); | 113 v8::V8::SetArrayBufferAllocator(WebCore::v8ArrayBufferAllocator()); |
| 111 v8::V8::Initialize(); | 114 v8::V8::Initialize(); |
| 112 WebCore::V8PerIsolateData::ensureInitialized(isolate); | 115 WebCore::V8PerIsolateData::ensureInitialized(isolate); |
| 113 | 116 |
| 114 s_isolateInterruptor = new WebCore::V8IsolateInterruptor(v8::Isolate::GetCur
rent()); | 117 s_isolateInterruptor = new WebCore::V8IsolateInterruptor(v8::Isolate::GetCur
rent()); |
| 115 WebCore::ThreadState::current()->addInterruptor(s_isolateInterruptor); | 118 WebCore::ThreadState::current()->addInterruptor(s_isolateInterruptor); |
| 116 | 119 |
| 117 // currentThread will always be non-null in production, but can be null in C
hromium unit tests. | 120 // currentThread will always be non-null in production, but can be null in C
hromium unit tests. |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 ASSERT(s_messageLoopInterruptor); | 219 ASSERT(s_messageLoopInterruptor); |
| 217 WebCore::ThreadState::current()->removeInterruptor(s_messageLoopInterrup
tor); | 220 WebCore::ThreadState::current()->removeInterruptor(s_messageLoopInterrup
tor); |
| 218 delete s_messageLoopInterruptor; | 221 delete s_messageLoopInterruptor; |
| 219 s_messageLoopInterruptor = 0; | 222 s_messageLoopInterruptor = 0; |
| 220 } | 223 } |
| 221 | 224 |
| 222 // Detach the main thread before starting the shutdown sequence | 225 // Detach the main thread before starting the shutdown sequence |
| 223 // so that the main thread won't get involved in a GC during the shutdown. | 226 // so that the main thread won't get involved in a GC during the shutdown. |
| 224 WebCore::ThreadState::detachMainThread(); | 227 WebCore::ThreadState::detachMainThread(); |
| 225 | 228 |
| 226 WebCore::V8PerIsolateData::dispose(WebCore::V8PerIsolateData::mainThreadIsol
ate()); | 229 v8::Isolate* isolate = WebCore::V8PerIsolateData::mainThreadIsolate(); |
| 227 v8::V8::Dispose(); | 230 WebCore::V8PerIsolateData::dispose(isolate); |
| 231 isolate->Exit(); |
| 232 isolate->Dispose(); |
| 228 | 233 |
| 229 shutdownWithoutV8(); | 234 shutdownWithoutV8(); |
| 230 } | 235 } |
| 231 | 236 |
| 232 void shutdownWithoutV8() | 237 void shutdownWithoutV8() |
| 233 { | 238 { |
| 234 ASSERT(!s_endOfTaskRunner); | 239 ASSERT(!s_endOfTaskRunner); |
| 235 WebCore::ImageDecodingStore::shutdown(); | 240 WebCore::ImageDecodingStore::shutdown(); |
| 236 WebCore::shutdown(); | 241 WebCore::shutdown(); |
| 237 WebCore::Heap::shutdown(); | 242 WebCore::Heap::shutdown(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 268 channel->state = WTFLogChannelOn; | 273 channel->state = WTFLogChannelOn; |
| 269 #endif // !LOG_DISABLED | 274 #endif // !LOG_DISABLED |
| 270 } | 275 } |
| 271 | 276 |
| 272 void resetPluginCache(bool reloadPages) | 277 void resetPluginCache(bool reloadPages) |
| 273 { | 278 { |
| 274 WebCore::Page::refreshPlugins(reloadPages); | 279 WebCore::Page::refreshPlugins(reloadPages); |
| 275 } | 280 } |
| 276 | 281 |
| 277 } // namespace blink | 282 } // namespace blink |
| OLD | NEW |