Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: Source/web/WebKit.cpp

Issue 364873002: Introduce a basic Blink Scheduler (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Cleaned up includes + build fix. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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"
53 #include "public/platform/Platform.h" 54 #include "public/platform/Platform.h"
54 #include "public/platform/WebPrerenderingSupport.h" 55 #include "public/platform/WebPrerenderingSupport.h"
55 #include "public/platform/WebThread.h" 56 #include "public/platform/WebThread.h"
56 #include "web/IndexedDBClientImpl.h" 57 #include "web/IndexedDBClientImpl.h"
57 #include "web/WebMediaPlayerClientImpl.h" 58 #include "web/WebMediaPlayerClientImpl.h"
58 #include "wtf/Assertions.h" 59 #include "wtf/Assertions.h"
59 #include "wtf/CryptographicallyRandomNumber.h" 60 #include "wtf/CryptographicallyRandomNumber.h"
60 #include "wtf/MainThread.h" 61 #include "wtf/MainThread.h"
61 #include "wtf/WTF.h" 62 #include "wtf/WTF.h"
62 #include "wtf/text/AtomicString.h" 63 #include "wtf/text/AtomicString.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 return Platform::current()->monotonicallyIncreasingTime(); 140 return Platform::current()->monotonicallyIncreasingTime();
140 } 141 }
141 142
142 static void cryptographicallyRandomValues(unsigned char* buffer, size_t length) 143 static void cryptographicallyRandomValues(unsigned char* buffer, size_t length)
143 { 144 {
144 Platform::current()->cryptographicallyRandomValues(buffer, length); 145 Platform::current()->cryptographicallyRandomValues(buffer, length);
145 } 146 }
146 147
147 static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* con text) 148 static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* con text)
148 { 149 {
149 Platform::current()->callOnMainThread(function, context); 150 WebCore::Scheduler::shared()->postTask(bind(function, context));
150 } 151 }
151 152
152 void initializeWithoutV8(Platform* platform) 153 void initializeWithoutV8(Platform* platform)
153 { 154 {
154 ASSERT(!s_webKitInitialized); 155 ASSERT(!s_webKitInitialized);
155 s_webKitInitialized = true; 156 s_webKitInitialized = true;
156 157
157 ASSERT(platform); 158 ASSERT(platform);
158 Platform::initialize(platform); 159 Platform::initialize(platform);
159 160
160 WTF::setRandomSource(cryptographicallyRandomValues); 161 WTF::setRandomSource(cryptographicallyRandomValues);
161 WTF::initialize(currentTimeFunction, monotonicallyIncreasingTimeFunction); 162 WTF::initialize(currentTimeFunction, monotonicallyIncreasingTimeFunction);
162 WTF::initializeMainThread(callOnMainThreadFunction); 163 WTF::initializeMainThread(callOnMainThreadFunction);
163 WebCore::Heap::init(); 164 WebCore::Heap::init();
165 WebCore::Scheduler::initializeOnMainThread();
164 166
165 WebCore::ThreadState::attachMainThread(); 167 WebCore::ThreadState::attachMainThread();
166 // currentThread will always be non-null in production, but can be null in C hromium unit tests. 168 // currentThread will always be non-null in production, but can be null in C hromium unit tests.
167 if (WebThread* currentThread = platform->currentThread()) { 169 if (WebThread* currentThread = platform->currentThread()) {
168 ASSERT(!s_pendingGCRunner); 170 ASSERT(!s_pendingGCRunner);
169 s_pendingGCRunner = new WebCore::PendingGCRunner; 171 s_pendingGCRunner = new WebCore::PendingGCRunner;
170 currentThread->addTaskObserver(s_pendingGCRunner); 172 currentThread->addTaskObserver(s_pendingGCRunner);
171 173
172 ASSERT(!s_messageLoopInterruptor); 174 ASSERT(!s_messageLoopInterruptor);
173 s_messageLoopInterruptor = new WebCore::MessageLoopInterruptor(currentTh read); 175 s_messageLoopInterruptor = new WebCore::MessageLoopInterruptor(currentTh read);
(...skipping 22 matching lines...) Expand all
196 // currentThread will always be non-null in production, but can be null in C hromium unit tests. 198 // currentThread will always be non-null in production, but can be null in C hromium unit tests.
197 if (Platform::current()->currentThread()) { 199 if (Platform::current()->currentThread()) {
198 ASSERT(s_endOfTaskRunner); 200 ASSERT(s_endOfTaskRunner);
199 Platform::current()->currentThread()->removeTaskObserver(s_endOfTaskRunn er); 201 Platform::current()->currentThread()->removeTaskObserver(s_endOfTaskRunn er);
200 delete s_endOfTaskRunner; 202 delete s_endOfTaskRunner;
201 s_endOfTaskRunner = 0; 203 s_endOfTaskRunner = 0;
202 } 204 }
203 205
204 ASSERT(s_isolateInterruptor); 206 ASSERT(s_isolateInterruptor);
205 WebCore::ThreadState::current()->removeInterruptor(s_isolateInterruptor); 207 WebCore::ThreadState::current()->removeInterruptor(s_isolateInterruptor);
208 WebCore::Scheduler::shutdown();
206 209
207 // currentThread will always be non-null in production, but can be null in C hromium unit tests. 210 // currentThread will always be non-null in production, but can be null in C hromium unit tests.
208 if (Platform::current()->currentThread()) { 211 if (Platform::current()->currentThread()) {
209 ASSERT(s_pendingGCRunner); 212 ASSERT(s_pendingGCRunner);
210 delete s_pendingGCRunner; 213 delete s_pendingGCRunner;
211 s_pendingGCRunner = 0; 214 s_pendingGCRunner = 0;
212 215
213 ASSERT(s_messageLoopInterruptor); 216 ASSERT(s_messageLoopInterruptor);
214 WebCore::ThreadState::current()->removeInterruptor(s_messageLoopInterrup tor); 217 WebCore::ThreadState::current()->removeInterruptor(s_messageLoopInterrup tor);
215 delete s_messageLoopInterruptor; 218 delete s_messageLoopInterruptor;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 channel->state = WTFLogChannelOn; 269 channel->state = WTFLogChannelOn;
267 #endif // !LOG_DISABLED 270 #endif // !LOG_DISABLED
268 } 271 }
269 272
270 void resetPluginCache(bool reloadPages) 273 void resetPluginCache(bool reloadPages)
271 { 274 {
272 WebCore::Page::refreshPlugins(reloadPages); 275 WebCore::Page::refreshPlugins(reloadPages);
273 } 276 }
274 277
275 } // namespace blink 278 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698