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

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: Rebased. 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // currentThread will always be non-null in production, but can be null in C hromium unit tests. 167 // currentThread will always be non-null in production, but can be null in C hromium unit tests.
167 if (WebThread* currentThread = platform->currentThread()) { 168 if (WebThread* currentThread = platform->currentThread()) {
168 ASSERT(!s_pendingGCRunner); 169 ASSERT(!s_pendingGCRunner);
169 s_pendingGCRunner = new WebCore::PendingGCRunner; 170 s_pendingGCRunner = new WebCore::PendingGCRunner;
170 currentThread->addTaskObserver(s_pendingGCRunner); 171 currentThread->addTaskObserver(s_pendingGCRunner);
171 172
172 ASSERT(!s_messageLoopInterruptor); 173 ASSERT(!s_messageLoopInterruptor);
173 s_messageLoopInterruptor = new WebCore::MessageLoopInterruptor(currentTh read); 174 s_messageLoopInterruptor = new WebCore::MessageLoopInterruptor(currentTh read);
174 WebCore::ThreadState::current()->addInterruptor(s_messageLoopInterruptor ); 175 WebCore::ThreadState::current()->addInterruptor(s_messageLoopInterruptor );
175 } 176 }
177 WebCore::Scheduler::initializeOnMainThread();
176 178
177 DEFINE_STATIC_LOCAL(WebCore::ModulesInitializer, initializer, ()); 179 DEFINE_STATIC_LOCAL(WebCore::ModulesInitializer, initializer, ());
178 initializer.init(); 180 initializer.init();
179 181
180 // There are some code paths (for example, running WebKit in the browser 182 // There are some code paths (for example, running WebKit in the browser
181 // process and calling into LocalStorage before anything else) where the 183 // process and calling into LocalStorage before anything else) where the
182 // UTF8 string encoding tables are used on a background thread before 184 // UTF8 string encoding tables are used on a background thread before
183 // they're set up. This is a problem because their set up routines assert 185 // they're set up. This is a problem because their set up routines assert
184 // they're running on the main WebKitThread. It might be possible to make 186 // they're running on the main WebKitThread. It might be possible to make
185 // the initialization thread-safe, but given that so many code paths use 187 // the initialization thread-safe, but given that so many code paths use
(...skipping 10 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