| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 return *initializer; | 75 return *initializer; |
| 76 } | 76 } |
| 77 | 77 |
| 78 void initialize(Platform* platform) { | 78 void initialize(Platform* platform) { |
| 79 Platform::initialize(platform); | 79 Platform::initialize(platform); |
| 80 | 80 |
| 81 V8Initializer::initializeMainThread(); | 81 V8Initializer::initializeMainThread(); |
| 82 | 82 |
| 83 modulesInitializer().initialize(); | 83 modulesInitializer().initialize(); |
| 84 | 84 |
| 85 if (Platform::isMessageLoopReady()) |
| 86 initializeMojo(); |
| 87 |
| 85 // currentThread is null if we are running on a thread without a message loop. | 88 // currentThread is null if we are running on a thread without a message loop. |
| 86 if (WebThread* currentThread = platform->currentThread()) { | 89 if (WebThread* currentThread = platform->currentThread()) { |
| 87 DCHECK(!s_endOfTaskRunner); | 90 DCHECK(!s_endOfTaskRunner); |
| 88 s_endOfTaskRunner = new EndOfTaskRunner; | 91 s_endOfTaskRunner = new EndOfTaskRunner; |
| 89 currentThread->addTaskObserver(s_endOfTaskRunner); | 92 currentThread->addTaskObserver(s_endOfTaskRunner); |
| 90 } | 93 } |
| 91 } | 94 } |
| 92 | 95 |
| 96 void initializeMojo() { |
| 97 modulesInitializer().initializeMojo(); |
| 98 } |
| 99 |
| 93 void shutdown() { | 100 void shutdown() { |
| 94 ThreadState::current()->cleanupMainThread(); | 101 ThreadState::current()->cleanupMainThread(); |
| 95 | 102 |
| 96 // currentThread() is null if we are running on a thread without a message | 103 // currentThread() is null if we are running on a thread without a message |
| 97 // loop. | 104 // loop. |
| 98 if (WebThread* currentThread = Platform::current()->currentThread()) { | 105 if (WebThread* currentThread = Platform::current()->currentThread()) { |
| 99 currentThread->removeTaskObserver(s_endOfTaskRunner); | 106 currentThread->removeTaskObserver(s_endOfTaskRunner); |
| 100 s_endOfTaskRunner = nullptr; | 107 s_endOfTaskRunner = nullptr; |
| 101 } | 108 } |
| 102 | 109 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 void MemoryPressureNotificationToWorkerThreadIsolates( | 161 void MemoryPressureNotificationToWorkerThreadIsolates( |
| 155 v8::MemoryPressureLevel level) { | 162 v8::MemoryPressureLevel level) { |
| 156 WorkerBackingThread::MemoryPressureNotificationToWorkerThreadIsolates(level); | 163 WorkerBackingThread::MemoryPressureNotificationToWorkerThreadIsolates(level); |
| 157 } | 164 } |
| 158 | 165 |
| 159 void setRAILModeOnWorkerThreadIsolates(v8::RAILMode railMode) { | 166 void setRAILModeOnWorkerThreadIsolates(v8::RAILMode railMode) { |
| 160 WorkerBackingThread::setRAILModeOnWorkerThreadIsolates(railMode); | 167 WorkerBackingThread::setRAILModeOnWorkerThreadIsolates(railMode); |
| 161 } | 168 } |
| 162 | 169 |
| 163 } // namespace blink | 170 } // namespace blink |
| OLD | NEW |