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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 AnimationClock::notifyTaskStart(); | 74 AnimationClock::notifyTaskStart(); |
75 } | 75 } |
76 void didProcessTask() override | 76 void didProcessTask() override |
77 { | 77 { |
78 Microtask::performCheckpoint(mainThreadIsolate()); | 78 Microtask::performCheckpoint(mainThreadIsolate()); |
79 V8GCController::reportDOMMemoryUsageToV8(mainThreadIsolate()); | 79 V8GCController::reportDOMMemoryUsageToV8(mainThreadIsolate()); |
80 V8Initializer::reportRejectedPromisesOnMainThread(); | 80 V8Initializer::reportRejectedPromisesOnMainThread(); |
81 } | 81 } |
82 }; | 82 }; |
83 | 83 |
84 class MainThreadTaskRunner: public WebThread::Task { | 84 class MainThreadTaskRunner: public WebTaskRunner::Task { |
85 WTF_MAKE_NONCOPYABLE(MainThreadTaskRunner); | 85 WTF_MAKE_NONCOPYABLE(MainThreadTaskRunner); |
86 public: | 86 public: |
87 MainThreadTaskRunner(WTF::MainThreadFunction* function, void* context) | 87 MainThreadTaskRunner(WTF::MainThreadFunction* function, void* context) |
88 : m_function(function) | 88 : m_function(function) |
89 , m_context(context) { } | 89 , m_context(context) { } |
90 | 90 |
91 void run() override | 91 void run() override |
92 { | 92 { |
93 m_function(m_context); | 93 m_function(m_context); |
94 } | 94 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 Platform::current()->histogramEnumeration(name, sample, boundaryValue); | 149 Platform::current()->histogramEnumeration(name, sample, boundaryValue); |
150 } | 150 } |
151 | 151 |
152 static void cryptographicallyRandomValues(unsigned char* buffer, size_t length) | 152 static void cryptographicallyRandomValues(unsigned char* buffer, size_t length) |
153 { | 153 { |
154 Platform::current()->cryptographicallyRandomValues(buffer, length); | 154 Platform::current()->cryptographicallyRandomValues(buffer, length); |
155 } | 155 } |
156 | 156 |
157 static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* con
text) | 157 static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* con
text) |
158 { | 158 { |
159 Platform::current()->mainThread()->postTask(FROM_HERE, new MainThreadTaskRun
ner(function, context)); | 159 Platform::current()->mainThread()->defaultTaskRunner()->postTask(FROM_HERE,
new MainThreadTaskRunner(function, context)); |
160 } | 160 } |
161 | 161 |
162 static void adjustAmountOfExternalAllocatedMemory(int size) | 162 static void adjustAmountOfExternalAllocatedMemory(int size) |
163 { | 163 { |
164 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size); | 164 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size); |
165 } | 165 } |
166 | 166 |
167 void initializeWithoutV8(Platform* platform) | 167 void initializeWithoutV8(Platform* platform) |
168 { | 168 { |
169 ASSERT(!s_webKitInitialized); | 169 ASSERT(!s_webKitInitialized); |
170 s_webKitInitialized = true; | 170 s_webKitInitialized = true; |
171 | 171 |
172 ASSERT(platform); | 172 ASSERT(platform); |
173 Platform::initialize(platform); | 173 Platform::initialize(platform); |
174 | 174 |
175 WTF::setRandomSource(cryptographicallyRandomValues); | 175 WTF::setRandomSource(cryptographicallyRandomValues); |
176 WTF::initialize(currentTimeFunction, monotonicallyIncreasingTimeFunction, sy
stemTraceTimeFunction, histogramEnumerationFunction, adjustAmountOfExternalAlloc
atedMemory); | 176 WTF::initialize(currentTimeFunction, monotonicallyIncreasingTimeFunction, sy
stemTraceTimeFunction, histogramEnumerationFunction, adjustAmountOfExternalAlloc
atedMemory); |
177 WTF::initializeMainThread(callOnMainThreadFunction); | 177 WTF::initializeMainThread(callOnMainThreadFunction); |
178 Heap::init(); | 178 Heap::init(); |
179 | 179 |
180 ThreadState::attachMainThread(); | 180 ThreadState::attachMainThread(); |
181 // currentThread() is null if we are running on a thread without a message l
oop. | 181 // currentThread() is null if we are running on a thread without a message l
oop. |
182 if (WebThread* currentThread = platform->currentThread()) { | 182 if (WebThread* currentThread = platform->currentThread()) { |
183 ASSERT(!s_pendingGCRunner); | 183 ASSERT(!s_pendingGCRunner); |
184 s_pendingGCRunner = new PendingGCRunner; | 184 s_pendingGCRunner = new PendingGCRunner; |
185 currentThread->addTaskObserver(s_pendingGCRunner); | 185 currentThread->addTaskObserver(s_pendingGCRunner); |
186 | 186 |
187 OwnPtr<MessageLoopInterruptor> interruptor = adoptPtr(new MessageLoopInt
erruptor(currentThread)); | 187 OwnPtr<MessageLoopInterruptor> interruptor = adoptPtr(new MessageLoopInt
erruptor(currentThread->defaultTaskRunner())); |
188 ThreadState::current()->addInterruptor(interruptor.release()); | 188 ThreadState::current()->addInterruptor(interruptor.release()); |
189 } | 189 } |
190 | 190 |
191 DEFINE_STATIC_LOCAL(ModulesInitializer, initializer, ()); | 191 DEFINE_STATIC_LOCAL(ModulesInitializer, initializer, ()); |
192 initializer.init(); | 192 initializer.init(); |
193 | 193 |
194 setIndexedDBClientCreateFunction(IndexedDBClientImpl::create); | 194 setIndexedDBClientCreateFunction(IndexedDBClientImpl::create); |
195 } | 195 } |
196 | 196 |
197 void shutdown() | 197 void shutdown() |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 ASSERT(!reloadPages); | 279 ASSERT(!reloadPages); |
280 Page::refreshPlugins(); | 280 Page::refreshPlugins(); |
281 } | 281 } |
282 | 282 |
283 void decommitFreeableMemory() | 283 void decommitFreeableMemory() |
284 { | 284 { |
285 WTF::Partitions::decommitFreeableMemory(); | 285 WTF::Partitions::decommitFreeableMemory(); |
286 } | 286 } |
287 | 287 |
288 } // namespace blink | 288 } // namespace blink |
OLD | NEW |