| 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 static ModulesInitializer& modulesInitializer() | 74 static ModulesInitializer& modulesInitializer() |
| 75 { | 75 { |
| 76 DEFINE_STATIC_LOCAL(OwnPtr<ModulesInitializer>, initializer, (adoptPtr(new M
odulesInitializer))); | 76 DEFINE_STATIC_LOCAL(OwnPtr<ModulesInitializer>, initializer, (adoptPtr(new M
odulesInitializer))); |
| 77 return *initializer; | 77 return *initializer; |
| 78 } | 78 } |
| 79 | 79 |
| 80 void initialize(Platform* platform) | 80 void initialize(Platform* platform) |
| 81 { | 81 { |
| 82 Platform::initialize(platform); | 82 Platform::initialize(platform); |
| 83 | 83 |
| 84 V8Initializer::initializeMainThread(); |
| 85 |
| 84 modulesInitializer().initialize(); | 86 modulesInitializer().initialize(); |
| 85 | 87 |
| 86 V8Initializer::initializeMainThread(); | |
| 87 | |
| 88 // currentThread is null if we are running on a thread without a message loo
p. | 88 // currentThread is null if we are running on a thread without a message loo
p. |
| 89 if (WebThread* currentThread = platform->currentThread()) { | 89 if (WebThread* currentThread = platform->currentThread()) { |
| 90 DCHECK(!s_endOfTaskRunner); | 90 DCHECK(!s_endOfTaskRunner); |
| 91 s_endOfTaskRunner = new EndOfTaskRunner; | 91 s_endOfTaskRunner = new EndOfTaskRunner; |
| 92 currentThread->addTaskObserver(s_endOfTaskRunner); | 92 currentThread->addTaskObserver(s_endOfTaskRunner); |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 void shutdown() | 96 void shutdown() |
| 97 { | 97 { |
| 98 ThreadState::current()->cleanupMainThread(); | 98 ThreadState::current()->cleanupMainThread(); |
| 99 | 99 |
| 100 // currentThread() is null if we are running on a thread without a message l
oop. | 100 // currentThread() is null if we are running on a thread without a message l
oop. |
| 101 if (Platform::current()->currentThread()) { | 101 if (Platform::current()->currentThread()) { |
| 102 // We don't need to (cannot) remove s_endOfTaskRunner from the current | 102 // We don't need to (cannot) remove s_endOfTaskRunner from the current |
| 103 // message loop, because the message loop is already destructed before | 103 // message loop, because the message loop is already destructed before |
| 104 // the shutdown() is called. | 104 // the shutdown() is called. |
| 105 delete s_endOfTaskRunner; | 105 delete s_endOfTaskRunner; |
| 106 s_endOfTaskRunner = nullptr; | 106 s_endOfTaskRunner = nullptr; |
| 107 } | 107 } |
| 108 | 108 |
| 109 modulesInitializer().shutdown(); |
| 110 |
| 109 V8Initializer::shutdownMainThread(); | 111 V8Initializer::shutdownMainThread(); |
| 110 | 112 |
| 111 modulesInitializer().shutdown(); | |
| 112 | |
| 113 Platform::shutdown(); | 113 Platform::shutdown(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 v8::Isolate* mainThreadIsolate() | 116 v8::Isolate* mainThreadIsolate() |
| 117 { | 117 { |
| 118 return V8PerIsolateData::mainThreadIsolate(); | 118 return V8PerIsolateData::mainThreadIsolate(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 // TODO(tkent): The following functions to wrap LayoutTestSupport should be | 121 // TODO(tkent): The following functions to wrap LayoutTestSupport should be |
| 122 // moved to public/platform/. | 122 // moved to public/platform/. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 DCHECK(!reloadPages); | 170 DCHECK(!reloadPages); |
| 171 Page::refreshPlugins(); | 171 Page::refreshPlugins(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void decommitFreeableMemory() | 174 void decommitFreeableMemory() |
| 175 { | 175 { |
| 176 WTF::Partitions::decommitFreeableMemory(); | 176 WTF::Partitions::decommitFreeableMemory(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 } // namespace blink | 179 } // namespace blink |
| OLD | NEW |