| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 static double monotonicallyIncreasingTimeFunction() | 142 static double monotonicallyIncreasingTimeFunction() |
| 143 { | 143 { |
| 144 return Platform::current()->monotonicallyIncreasingTime(); | 144 return Platform::current()->monotonicallyIncreasingTime(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 static void cryptographicallyRandomValues(unsigned char* buffer, size_t length) | 147 static void cryptographicallyRandomValues(unsigned char* buffer, size_t length) |
| 148 { | 148 { |
| 149 base::RandBytes(buffer, length); | 149 base::RandBytes(buffer, length); |
| 150 } | 150 } |
| 151 | 151 |
| 152 static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* con
text) | |
| 153 { | |
| 154 Platform::current()->callOnMainThread(function, context); | |
| 155 } | |
| 156 | |
| 157 void initializeWithoutV8(Platform* platform) | 152 void initializeWithoutV8(Platform* platform) |
| 158 { | 153 { |
| 159 ASSERT(!s_webKitInitialized); | 154 ASSERT(!s_webKitInitialized); |
| 160 s_webKitInitialized = true; | 155 s_webKitInitialized = true; |
| 161 | 156 |
| 162 ASSERT(platform); | 157 ASSERT(platform); |
| 163 Platform::initialize(platform); | 158 Platform::initialize(platform); |
| 164 | 159 |
| 165 WTF::setRandomSource(cryptographicallyRandomValues); | 160 WTF::setRandomSource(cryptographicallyRandomValues); |
| 166 WTF::initialize(currentTimeFunction, monotonicallyIncreasingTimeFunction); | 161 WTF::initialize(currentTimeFunction, monotonicallyIncreasingTimeFunction); |
| 167 WTF::initializeMainThread(callOnMainThreadFunction); | 162 WTF::initializeMainThread(); |
| 168 | 163 |
| 169 DEFINE_STATIC_LOCAL(CoreInitializer, initializer, ()); | 164 DEFINE_STATIC_LOCAL(CoreInitializer, initializer, ()); |
| 170 initializer.init(); | 165 initializer.init(); |
| 171 | 166 |
| 172 // There are some code paths (for example, running WebKit in the browser | 167 // There are some code paths (for example, running WebKit in the browser |
| 173 // process and calling into LocalStorage before anything else) where the | 168 // process and calling into LocalStorage before anything else) where the |
| 174 // UTF8 string encoding tables are used on a background thread before | 169 // UTF8 string encoding tables are used on a background thread before |
| 175 // they're set up. This is a problem because their set up routines assert | 170 // they're set up. This is a problem because their set up routines assert |
| 176 // they're running on the main WebKitThread. It might be possible to make | 171 // they're running on the main WebKitThread. It might be possible to make |
| 177 // the initialization thread-safe, but given that so many code paths use | 172 // the initialization thread-safe, but given that so many code paths use |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 void enableLogChannel(const char* name) | 216 void enableLogChannel(const char* name) |
| 222 { | 217 { |
| 223 #if !LOG_DISABLED | 218 #if !LOG_DISABLED |
| 224 WTFLogChannel* channel = getChannelFromName(name); | 219 WTFLogChannel* channel = getChannelFromName(name); |
| 225 if (channel) | 220 if (channel) |
| 226 channel->state = WTFLogChannelOn; | 221 channel->state = WTFLogChannelOn; |
| 227 #endif // !LOG_DISABLED | 222 #endif // !LOG_DISABLED |
| 228 } | 223 } |
| 229 | 224 |
| 230 } // namespace blink | 225 } // namespace blink |
| OLD | NEW |