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

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

Issue 656463004: Use the scheduling mechanism provided by the platform (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added shutdown call. Created 6 years, 2 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"
54 #include "public/platform/Platform.h" 53 #include "public/platform/Platform.h"
55 #include "public/platform/WebPrerenderingSupport.h" 54 #include "public/platform/WebPrerenderingSupport.h"
55 #include "public/platform/WebScheduler.h"
56 #include "public/platform/WebThread.h" 56 #include "public/platform/WebThread.h"
57 #include "web/IndexedDBClientImpl.h" 57 #include "web/IndexedDBClientImpl.h"
58 #include "web/WebMediaPlayerClientImpl.h" 58 #include "web/WebMediaPlayerClientImpl.h"
59 #include "wtf/Assertions.h" 59 #include "wtf/Assertions.h"
60 #include "wtf/CryptographicallyRandomNumber.h" 60 #include "wtf/CryptographicallyRandomNumber.h"
61 #include "wtf/MainThread.h" 61 #include "wtf/MainThread.h"
62 #include "wtf/WTF.h" 62 #include "wtf/WTF.h"
63 #include "wtf/text/AtomicString.h" 63 #include "wtf/text/AtomicString.h"
64 #include "wtf/text/TextEncoding.h" 64 #include "wtf/text/TextEncoding.h"
65 #include <v8.h> 65 #include <v8.h>
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 return Platform::current()->monotonicallyIncreasingTime(); 125 return Platform::current()->monotonicallyIncreasingTime();
126 } 126 }
127 127
128 static void cryptographicallyRandomValues(unsigned char* buffer, size_t length) 128 static void cryptographicallyRandomValues(unsigned char* buffer, size_t length)
129 { 129 {
130 Platform::current()->cryptographicallyRandomValues(buffer, length); 130 Platform::current()->cryptographicallyRandomValues(buffer, length);
131 } 131 }
132 132
133 static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* con text) 133 static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* con text)
134 { 134 {
135 Scheduler::shared()->postTask(FROM_HERE, bind(function, context)); 135 Platform::current()->callOnMainThread(function, context);
136 } 136 }
137 137
138 void initializeWithoutV8(Platform* platform) 138 void initializeWithoutV8(Platform* platform)
139 { 139 {
140 ASSERT(!s_webKitInitialized); 140 ASSERT(!s_webKitInitialized);
141 s_webKitInitialized = true; 141 s_webKitInitialized = true;
142 142
143 ASSERT(platform); 143 ASSERT(platform);
144 Platform::initialize(platform); 144 Platform::initialize(platform);
145 145
146 WTF::setRandomSource(cryptographicallyRandomValues); 146 WTF::setRandomSource(cryptographicallyRandomValues);
147 WTF::initialize(currentTimeFunction, monotonicallyIncreasingTimeFunction); 147 WTF::initialize(currentTimeFunction, monotonicallyIncreasingTimeFunction);
148 WTF::initializeMainThread(callOnMainThreadFunction); 148 WTF::initializeMainThread(callOnMainThreadFunction);
149 Heap::init(); 149 Heap::init();
150 Scheduler::initializeOnMainThread();
151 150
152 ThreadState::attachMainThread(); 151 ThreadState::attachMainThread();
153 // currentThread will always be non-null in production, but can be null in C hromium unit tests. 152 // currentThread will always be non-null in production, but can be null in C hromium unit tests.
154 if (WebThread* currentThread = platform->currentThread()) { 153 if (WebThread* currentThread = platform->currentThread()) {
155 ASSERT(!s_pendingGCRunner); 154 ASSERT(!s_pendingGCRunner);
156 s_pendingGCRunner = new PendingGCRunner; 155 s_pendingGCRunner = new PendingGCRunner;
157 currentThread->addTaskObserver(s_pendingGCRunner); 156 currentThread->addTaskObserver(s_pendingGCRunner);
158 157
159 ASSERT(!s_messageLoopInterruptor); 158 ASSERT(!s_messageLoopInterruptor);
160 s_messageLoopInterruptor = new MessageLoopInterruptor(currentThread); 159 s_messageLoopInterruptor = new MessageLoopInterruptor(currentThread);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 212
214 V8PerIsolateData::destroy(isolate); 213 V8PerIsolateData::destroy(isolate);
215 214
216 shutdownWithoutV8(); 215 shutdownWithoutV8();
217 } 216 }
218 217
219 void shutdownWithoutV8() 218 void shutdownWithoutV8()
220 { 219 {
221 ASSERT(!s_endOfTaskRunner); 220 ASSERT(!s_endOfTaskRunner);
222 CoreInitializer::shutdown(); 221 CoreInitializer::shutdown();
223 Scheduler::shutdown(); 222 if (WebScheduler* scheduler = Platform::current()->scheduler())
223 scheduler->shutdown();
224 Heap::shutdown(); 224 Heap::shutdown();
225 WTF::shutdown(); 225 WTF::shutdown();
226 Platform::shutdown(); 226 Platform::shutdown();
227 WebPrerenderingSupport::shutdown(); 227 WebPrerenderingSupport::shutdown();
228 } 228 }
229 229
230 void setLayoutTestMode(bool value) 230 void setLayoutTestMode(bool value)
231 { 231 {
232 LayoutTestSupport::setIsRunningLayoutTest(value); 232 LayoutTestSupport::setIsRunningLayoutTest(value);
233 } 233 }
(...skipping 21 matching lines...) Expand all
255 channel->state = WTFLogChannelOn; 255 channel->state = WTFLogChannelOn;
256 #endif // !LOG_DISABLED 256 #endif // !LOG_DISABLED
257 } 257 }
258 258
259 void resetPluginCache(bool reloadPages) 259 void resetPluginCache(bool reloadPages)
260 { 260 {
261 Page::refreshPlugins(reloadPages); 261 Page::refreshPlugins(reloadPages);
262 } 262 }
263 263
264 } // namespace blink 264 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698