| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "gin/public/v8_platform.h" | 43 #include "gin/public/v8_platform.h" |
| 44 #include "modules/InitModules.h" | 44 #include "modules/InitModules.h" |
| 45 #include "platform/LayoutTestSupport.h" | 45 #include "platform/LayoutTestSupport.h" |
| 46 #include "platform/Logging.h" | 46 #include "platform/Logging.h" |
| 47 #include "platform/RuntimeEnabledFeatures.h" | 47 #include "platform/RuntimeEnabledFeatures.h" |
| 48 #include "platform/graphics/ImageDecodingStore.h" | 48 #include "platform/graphics/ImageDecodingStore.h" |
| 49 #include "platform/graphics/media/MediaPlayer.h" | 49 #include "platform/graphics/media/MediaPlayer.h" |
| 50 #include "platform/heap/Heap.h" | 50 #include "platform/heap/Heap.h" |
| 51 #include "platform/heap/glue/MessageLoopInterruptor.h" | 51 #include "platform/heap/glue/MessageLoopInterruptor.h" |
| 52 #include "platform/heap/glue/PendingGCRunner.h" | 52 #include "platform/heap/glue/PendingGCRunner.h" |
| 53 #include "platform/scheduler/Scheduler.h" | |
| 54 #include "public/platform/Platform.h" | 53 #include "public/platform/Platform.h" |
| 55 #include "public/platform/WebPrerenderingSupport.h" | 54 #include "public/platform/WebPrerenderingSupport.h" |
| 55 #include "public/platform/WebScheduler.h" |
| 56 #include "public/platform/WebThread.h" | 56 #include "public/platform/WebThread.h" |
| 57 #include "web/IndexedDBClientImpl.h" | 57 #include "web/IndexedDBClientImpl.h" |
| 58 #include "web/WebMediaPlayerClientImpl.h" | 58 #include "web/WebMediaPlayerClientImpl.h" |
| 59 #include "wtf/Assertions.h" | 59 #include "wtf/Assertions.h" |
| 60 #include "wtf/CryptographicallyRandomNumber.h" | 60 #include "wtf/CryptographicallyRandomNumber.h" |
| 61 #include "wtf/MainThread.h" | 61 #include "wtf/MainThread.h" |
| 62 #include "wtf/WTF.h" | 62 #include "wtf/WTF.h" |
| 63 #include "wtf/text/AtomicString.h" | 63 #include "wtf/text/AtomicString.h" |
| 64 #include "wtf/text/TextEncoding.h" | 64 #include "wtf/text/TextEncoding.h" |
| 65 #include <v8.h> | 65 #include <v8.h> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 return Platform::current()->monotonicallyIncreasingTime(); | 126 return Platform::current()->monotonicallyIncreasingTime(); |
| 127 } | 127 } |
| 128 | 128 |
| 129 static void cryptographicallyRandomValues(unsigned char* buffer, size_t length) | 129 static void cryptographicallyRandomValues(unsigned char* buffer, size_t length) |
| 130 { | 130 { |
| 131 Platform::current()->cryptographicallyRandomValues(buffer, length); | 131 Platform::current()->cryptographicallyRandomValues(buffer, length); |
| 132 } | 132 } |
| 133 | 133 |
| 134 static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* con
text) | 134 static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* con
text) |
| 135 { | 135 { |
| 136 Scheduler::shared()->postTask(FROM_HERE, bind(function, context)); | 136 Platform::current()->callOnMainThread(function, context); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void initializeWithoutV8(Platform* platform) | 139 void initializeWithoutV8(Platform* platform) |
| 140 { | 140 { |
| 141 ASSERT(!s_webKitInitialized); | 141 ASSERT(!s_webKitInitialized); |
| 142 s_webKitInitialized = true; | 142 s_webKitInitialized = true; |
| 143 | 143 |
| 144 ASSERT(platform); | 144 ASSERT(platform); |
| 145 Platform::initialize(platform); | 145 Platform::initialize(platform); |
| 146 | 146 |
| 147 WTF::setRandomSource(cryptographicallyRandomValues); | 147 WTF::setRandomSource(cryptographicallyRandomValues); |
| 148 WTF::initialize(currentTimeFunction, monotonicallyIncreasingTimeFunction); | 148 WTF::initialize(currentTimeFunction, monotonicallyIncreasingTimeFunction); |
| 149 WTF::initializeMainThread(callOnMainThreadFunction); | 149 WTF::initializeMainThread(callOnMainThreadFunction); |
| 150 Heap::init(); | 150 Heap::init(); |
| 151 Scheduler::initializeOnMainThread(); | |
| 152 | 151 |
| 153 ThreadState::attachMainThread(); | 152 ThreadState::attachMainThread(); |
| 154 // currentThread will always be non-null in production, but can be null in C
hromium unit tests. | 153 // currentThread will always be non-null in production, but can be null in C
hromium unit tests. |
| 155 if (WebThread* currentThread = platform->currentThread()) { | 154 if (WebThread* currentThread = platform->currentThread()) { |
| 156 ASSERT(!s_pendingGCRunner); | 155 ASSERT(!s_pendingGCRunner); |
| 157 s_pendingGCRunner = new PendingGCRunner; | 156 s_pendingGCRunner = new PendingGCRunner; |
| 158 currentThread->addTaskObserver(s_pendingGCRunner); | 157 currentThread->addTaskObserver(s_pendingGCRunner); |
| 159 | 158 |
| 160 ASSERT(!s_messageLoopInterruptor); | 159 ASSERT(!s_messageLoopInterruptor); |
| 161 s_messageLoopInterruptor = new MessageLoopInterruptor(currentThread); | 160 s_messageLoopInterruptor = new MessageLoopInterruptor(currentThread); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 213 |
| 215 V8PerIsolateData::destroy(isolate); | 214 V8PerIsolateData::destroy(isolate); |
| 216 | 215 |
| 217 shutdownWithoutV8(); | 216 shutdownWithoutV8(); |
| 218 } | 217 } |
| 219 | 218 |
| 220 void shutdownWithoutV8() | 219 void shutdownWithoutV8() |
| 221 { | 220 { |
| 222 ASSERT(!s_endOfTaskRunner); | 221 ASSERT(!s_endOfTaskRunner); |
| 223 CoreInitializer::shutdown(); | 222 CoreInitializer::shutdown(); |
| 224 Scheduler::shutdown(); | 223 if (WebScheduler* scheduler = Platform::current()->scheduler()) |
| 224 scheduler->shutdown(); |
| 225 Heap::shutdown(); | 225 Heap::shutdown(); |
| 226 WTF::shutdown(); | 226 WTF::shutdown(); |
| 227 Platform::shutdown(); | 227 Platform::shutdown(); |
| 228 WebPrerenderingSupport::shutdown(); | 228 WebPrerenderingSupport::shutdown(); |
| 229 } | 229 } |
| 230 | 230 |
| 231 void setLayoutTestMode(bool value) | 231 void setLayoutTestMode(bool value) |
| 232 { | 232 { |
| 233 LayoutTestSupport::setIsRunningLayoutTest(value); | 233 LayoutTestSupport::setIsRunningLayoutTest(value); |
| 234 } | 234 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 256 channel->state = WTFLogChannelOn; | 256 channel->state = WTFLogChannelOn; |
| 257 #endif // !LOG_DISABLED | 257 #endif // !LOG_DISABLED |
| 258 } | 258 } |
| 259 | 259 |
| 260 void resetPluginCache(bool reloadPages) | 260 void resetPluginCache(bool reloadPages) |
| 261 { | 261 { |
| 262 Page::refreshPlugins(reloadPages); | 262 Page::refreshPlugins(reloadPages); |
| 263 } | 263 } |
| 264 | 264 |
| 265 } // namespace blink | 265 } // namespace blink |
| OLD | NEW |