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 v8::V8::SetAutorunMicrotasks(isolate, false); | 115 v8::V8::SetAutorunMicrotasks(isolate, false); |
113 WebCore::V8PerIsolateData::ensureInitialized(isolate); | 116 WebCore::V8PerIsolateData::ensureInitialized(isolate); |
114 | 117 |
115 s_isolateInterruptor = new WebCore::V8IsolateInterruptor(v8::Isolate::GetCur
rent()); | 118 s_isolateInterruptor = new WebCore::V8IsolateInterruptor(v8::Isolate::GetCur
rent()); |
116 WebCore::ThreadState::current()->addInterruptor(s_isolateInterruptor); | 119 WebCore::ThreadState::current()->addInterruptor(s_isolateInterruptor); |
117 | 120 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 #ifndef NDEBUG | 201 #ifndef NDEBUG |
199 v8::V8::RemoveCallCompletedCallback(&assertV8RecursionScope); | 202 v8::V8::RemoveCallCompletedCallback(&assertV8RecursionScope); |
200 #endif | 203 #endif |
201 Platform::current()->currentThread()->removeTaskObserver(s_endOfTaskRunn
er); | 204 Platform::current()->currentThread()->removeTaskObserver(s_endOfTaskRunn
er); |
202 delete s_endOfTaskRunner; | 205 delete s_endOfTaskRunner; |
203 s_endOfTaskRunner = 0; | 206 s_endOfTaskRunner = 0; |
204 } | 207 } |
205 | 208 |
206 ASSERT(s_isolateInterruptor); | 209 ASSERT(s_isolateInterruptor); |
207 WebCore::ThreadState::current()->removeInterruptor(s_isolateInterruptor); | 210 WebCore::ThreadState::current()->removeInterruptor(s_isolateInterruptor); |
| 211 v8::Isolate* isolate = WebCore::V8PerIsolateData::mainThreadIsolate(); |
208 | 212 |
209 WebCore::V8PerIsolateData::dispose(WebCore::V8PerIsolateData::mainThreadIsol
ate()); | 213 WebCore::V8PerIsolateData::dispose(isolate); |
210 v8::V8::Dispose(); | 214 isolate->Exit(); |
| 215 isolate->Dispose(); |
211 | 216 |
212 shutdownWithoutV8(); | 217 shutdownWithoutV8(); |
213 } | 218 } |
214 | 219 |
215 void shutdownWithoutV8() | 220 void shutdownWithoutV8() |
216 { | 221 { |
217 ASSERT(!s_endOfTaskRunner); | 222 ASSERT(!s_endOfTaskRunner); |
218 WebCore::ImageDecodingStore::shutdown(); | 223 WebCore::ImageDecodingStore::shutdown(); |
219 WebCore::shutdown(); | 224 WebCore::shutdown(); |
220 // currentThread will always be non-null in production, but can be null in C
hromium unit tests. | 225 // currentThread will always be non-null in production, but can be null in C
hromium unit tests. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 channel->state = WTFLogChannelOn; | 267 channel->state = WTFLogChannelOn; |
263 #endif // !LOG_DISABLED | 268 #endif // !LOG_DISABLED |
264 } | 269 } |
265 | 270 |
266 void resetPluginCache(bool reloadPages) | 271 void resetPluginCache(bool reloadPages) |
267 { | 272 { |
268 WebCore::Page::refreshPlugins(reloadPages); | 273 WebCore::Page::refreshPlugins(reloadPages); |
269 } | 274 } |
270 | 275 |
271 } // namespace blink | 276 } // namespace blink |
OLD | NEW |