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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 static double currentTimeFunction() | 136 static double currentTimeFunction() |
137 { | 137 { |
138 return Platform::current()->currentTime(); | 138 return Platform::current()->currentTime(); |
139 } | 139 } |
140 | 140 |
141 static double monotonicallyIncreasingTimeFunction() | 141 static double monotonicallyIncreasingTimeFunction() |
142 { | 142 { |
143 return Platform::current()->monotonicallyIncreasingTime(); | 143 return Platform::current()->monotonicallyIncreasingTime(); |
144 } | 144 } |
145 | 145 |
| 146 static void histogramEnumerationFunction(const char* name, int sample, int bound
aryValue) |
| 147 { |
| 148 Platform::current()->histogramEnumeration(name, sample, boundaryValue); |
| 149 } |
| 150 |
146 static void cryptographicallyRandomValues(unsigned char* buffer, size_t length) | 151 static void cryptographicallyRandomValues(unsigned char* buffer, size_t length) |
147 { | 152 { |
148 Platform::current()->cryptographicallyRandomValues(buffer, length); | 153 Platform::current()->cryptographicallyRandomValues(buffer, length); |
149 } | 154 } |
150 | 155 |
151 static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* con
text) | 156 static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* con
text) |
152 { | 157 { |
153 Platform::current()->mainThread()->postTask(FROM_HERE, new MainThreadTaskRun
ner(function, context)); | 158 Platform::current()->mainThread()->postTask(FROM_HERE, new MainThreadTaskRun
ner(function, context)); |
154 } | 159 } |
155 | 160 |
156 void initializeWithoutV8(Platform* platform) | 161 void initializeWithoutV8(Platform* platform) |
157 { | 162 { |
158 ASSERT(!s_webKitInitialized); | 163 ASSERT(!s_webKitInitialized); |
159 s_webKitInitialized = true; | 164 s_webKitInitialized = true; |
160 | 165 |
161 ASSERT(platform); | 166 ASSERT(platform); |
162 Platform::initialize(platform); | 167 Platform::initialize(platform); |
163 | 168 |
164 WTF::setRandomSource(cryptographicallyRandomValues); | 169 WTF::setRandomSource(cryptographicallyRandomValues); |
165 WTF::initialize(currentTimeFunction, monotonicallyIncreasingTimeFunction); | 170 WTF::initialize(currentTimeFunction, monotonicallyIncreasingTimeFunction, hi
stogramEnumerationFunction); |
166 WTF::initializeMainThread(callOnMainThreadFunction); | 171 WTF::initializeMainThread(callOnMainThreadFunction); |
167 Heap::init(); | 172 Heap::init(); |
168 | 173 |
169 ThreadState::attachMainThread(); | 174 ThreadState::attachMainThread(); |
170 // currentThread() is null if we are running on a thread without a message l
oop. | 175 // currentThread() is null if we are running on a thread without a message l
oop. |
171 if (WebThread* currentThread = platform->currentThread()) { | 176 if (WebThread* currentThread = platform->currentThread()) { |
172 ASSERT(!s_pendingGCRunner); | 177 ASSERT(!s_pendingGCRunner); |
173 s_pendingGCRunner = new PendingGCRunner; | 178 s_pendingGCRunner = new PendingGCRunner; |
174 currentThread->addTaskObserver(s_pendingGCRunner); | 179 currentThread->addTaskObserver(s_pendingGCRunner); |
175 | 180 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 #endif // !LOG_DISABLED | 280 #endif // !LOG_DISABLED |
276 } | 281 } |
277 | 282 |
278 void resetPluginCache(bool reloadPages) | 283 void resetPluginCache(bool reloadPages) |
279 { | 284 { |
280 ASSERT(!reloadPages); | 285 ASSERT(!reloadPages); |
281 Page::refreshPlugins(); | 286 Page::refreshPlugins(); |
282 } | 287 } |
283 | 288 |
284 } // namespace blink | 289 } // namespace blink |
OLD | NEW |