| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "core/page/Frame.h" | 42 #include "core/page/Frame.h" |
| 43 #include "core/page/Page.h" | 43 #include "core/page/Page.h" |
| 44 #include "core/page/Settings.h" | 44 #include "core/page/Settings.h" |
| 45 #include "core/platform/EventTracer.h" | 45 #include "core/platform/EventTracer.h" |
| 46 #include "core/platform/LayoutTestSupport.h" | 46 #include "core/platform/LayoutTestSupport.h" |
| 47 #include "core/platform/Logging.h" | 47 #include "core/platform/Logging.h" |
| 48 #include "core/platform/graphics/chromium/ImageDecodingStore.h" | 48 #include "core/platform/graphics/chromium/ImageDecodingStore.h" |
| 49 #include "core/platform/graphics/chromium/MediaPlayerPrivateChromium.h" | 49 #include "core/platform/graphics/chromium/MediaPlayerPrivateChromium.h" |
| 50 #include "core/workers/WorkerContextProxy.h" | 50 #include "core/workers/WorkerContextProxy.h" |
| 51 #include "wtf/Assertions.h" | 51 #include "wtf/Assertions.h" |
| 52 #include "wtf/CryptographicallyRandomNumber.h" |
| 53 #include "wtf/CurrentTime.h" |
| 52 #include "wtf/MainThread.h" | 54 #include "wtf/MainThread.h" |
| 53 #include "wtf/Threading.h" | 55 #include "wtf/Threading.h" |
| 54 #include "wtf/UnusedParam.h" | 56 #include "wtf/UnusedParam.h" |
| 55 #include "wtf/text/AtomicString.h" | 57 #include "wtf/text/AtomicString.h" |
| 56 #include "wtf/text/TextEncoding.h" | 58 #include "wtf/text/TextEncoding.h" |
| 57 #include <public/Platform.h> | 59 #include <public/Platform.h> |
| 58 #include <public/WebPrerenderingSupport.h> | 60 #include <public/WebPrerenderingSupport.h> |
| 59 #include <public/WebThread.h> | 61 #include <public/WebThread.h> |
| 60 #include <v8.h> | 62 #include <v8.h> |
| 61 | 63 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 if (WebThread* currentThread = platform->currentThread()) { | 111 if (WebThread* currentThread = platform->currentThread()) { |
| 110 #ifndef NDEBUG | 112 #ifndef NDEBUG |
| 111 v8::V8::AddCallCompletedCallback(&assertV8RecursionScope); | 113 v8::V8::AddCallCompletedCallback(&assertV8RecursionScope); |
| 112 #endif | 114 #endif |
| 113 ASSERT(!s_endOfTaskRunner); | 115 ASSERT(!s_endOfTaskRunner); |
| 114 s_endOfTaskRunner = new EndOfTaskRunner; | 116 s_endOfTaskRunner = new EndOfTaskRunner; |
| 115 currentThread->addTaskObserver(s_endOfTaskRunner); | 117 currentThread->addTaskObserver(s_endOfTaskRunner); |
| 116 } | 118 } |
| 117 } | 119 } |
| 118 | 120 |
| 121 static double currentTimeFunction() |
| 122 { |
| 123 return Platform::current()->currentTime(); |
| 124 } |
| 125 |
| 126 static double monotonicallyIncreasingTimeFunction() |
| 127 { |
| 128 return Platform::current()->monotonicallyIncreasingTime(); |
| 129 } |
| 130 |
| 131 static void cryptographicallyRandomValues(unsigned char* buffer, size_t length) |
| 132 { |
| 133 Platform::current()->cryptographicallyRandomValues(buffer, length); |
| 134 } |
| 135 |
| 136 static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* con
text) |
| 137 { |
| 138 Platform::current()->callOnMainThread(function, context); |
| 139 } |
| 140 |
| 119 void initializeWithoutV8(Platform* platform) | 141 void initializeWithoutV8(Platform* platform) |
| 120 { | 142 { |
| 121 ASSERT(!s_webKitInitialized); | 143 ASSERT(!s_webKitInitialized); |
| 122 s_webKitInitialized = true; | 144 s_webKitInitialized = true; |
| 123 | 145 |
| 124 ASSERT(platform); | 146 ASSERT(platform); |
| 125 Platform::initialize(platform); | 147 Platform::initialize(platform); |
| 126 | 148 |
| 127 WTF::initializeThreading(); | 149 WTF::setRandomSource(cryptographicallyRandomValues); |
| 128 WTF::initializeMainThread(); | 150 WTF::initialize(currentTimeFunction, monotonicallyIncreasingTimeFunction); |
| 151 WTF::initializeMainThread(callOnMainThreadFunction); |
| 129 WebCore::init(); | 152 WebCore::init(); |
| 130 WebCore::ImageDecodingStore::initializeOnce(); | 153 WebCore::ImageDecodingStore::initializeOnce(); |
| 131 | 154 |
| 132 // There are some code paths (for example, running WebKit in the browser | 155 // There are some code paths (for example, running WebKit in the browser |
| 133 // process and calling into LocalStorage before anything else) where the | 156 // process and calling into LocalStorage before anything else) where the |
| 134 // UTF8 string encoding tables are used on a background thread before | 157 // UTF8 string encoding tables are used on a background thread before |
| 135 // they're set up. This is a problem because their set up routines assert | 158 // they're set up. This is a problem because their set up routines assert |
| 136 // they're running on the main WebKitThread. It might be possible to make | 159 // they're running on the main WebKitThread. It might be possible to make |
| 137 // the initialization thread-safe, but given that so many code paths use | 160 // the initialization thread-safe, but given that so many code paths use |
| 138 // this, initializing this lazily probably doesn't buy us much. | 161 // this, initializing this lazily probably doesn't buy us much. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 UNUSED_PARAM(name); | 209 UNUSED_PARAM(name); |
| 187 #endif // !LOG_DISABLED | 210 #endif // !LOG_DISABLED |
| 188 } | 211 } |
| 189 | 212 |
| 190 void resetPluginCache(bool reloadPages) | 213 void resetPluginCache(bool reloadPages) |
| 191 { | 214 { |
| 192 WebCore::Page::refreshPlugins(reloadPages); | 215 WebCore::Page::refreshPlugins(reloadPages); |
| 193 } | 216 } |
| 194 | 217 |
| 195 } // namespace WebKit | 218 } // namespace WebKit |
| OLD | NEW |