| 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 16 matching lines...) Expand all Loading... |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "public/web/WebKit.h" | 31 #include "public/web/WebKit.h" |
| 32 | 32 |
| 33 #include "bindings/core/v8/Microtask.h" | 33 #include "bindings/core/v8/Microtask.h" |
| 34 #include "bindings/core/v8/V8Binding.h" | 34 #include "bindings/core/v8/V8Binding.h" |
| 35 #include "bindings/core/v8/V8GCController.h" | 35 #include "bindings/core/v8/V8GCController.h" |
| 36 #include "bindings/core/v8/V8Initializer.h" | 36 #include "bindings/core/v8/V8Initializer.h" |
| 37 #include "core/Init.h" | |
| 38 #include "core/animation/AnimationClock.h" | 37 #include "core/animation/AnimationClock.h" |
| 39 #include "core/page/Page.h" | 38 #include "core/page/Page.h" |
| 40 #include "gin/public/v8_platform.h" | 39 #include "gin/public/v8_platform.h" |
| 41 #include "modules/InitModules.h" | 40 #include "modules/ModulesInitializer.h" |
| 42 #include "platform/LayoutTestSupport.h" | 41 #include "platform/LayoutTestSupport.h" |
| 43 #include "platform/Logging.h" | 42 #include "platform/Logging.h" |
| 44 #include "platform/heap/Heap.h" | 43 #include "platform/heap/Heap.h" |
| 45 #include "public/platform/Platform.h" | 44 #include "public/platform/Platform.h" |
| 46 #include "public/platform/WebThread.h" | 45 #include "public/platform/WebThread.h" |
| 47 #include "web/IndexedDBClientImpl.h" | 46 #include "web/IndexedDBClientImpl.h" |
| 48 #include "wtf/Assertions.h" | 47 #include "wtf/Assertions.h" |
| 49 #include "wtf/MainThread.h" | 48 #include "wtf/MainThread.h" |
| 50 #include "wtf/Partitions.h" | 49 #include "wtf/Partitions.h" |
| 51 #include "wtf/WTF.h" | 50 #include "wtf/WTF.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 78 static ModulesInitializer& modulesInitializer() | 77 static ModulesInitializer& modulesInitializer() |
| 79 { | 78 { |
| 80 DEFINE_STATIC_LOCAL(OwnPtr<ModulesInitializer>, initializer, (adoptPtr(new M
odulesInitializer))); | 79 DEFINE_STATIC_LOCAL(OwnPtr<ModulesInitializer>, initializer, (adoptPtr(new M
odulesInitializer))); |
| 81 return *initializer; | 80 return *initializer; |
| 82 } | 81 } |
| 83 | 82 |
| 84 void initialize(Platform* platform) | 83 void initialize(Platform* platform) |
| 85 { | 84 { |
| 86 Platform::initialize(platform); | 85 Platform::initialize(platform); |
| 87 | 86 |
| 88 modulesInitializer().init(); | 87 modulesInitializer().initialize(); |
| 89 setIndexedDBClientCreateFunction(IndexedDBClientImpl::create); | 88 setIndexedDBClientCreateFunction(IndexedDBClientImpl::create); |
| 90 | 89 |
| 91 V8Initializer::initializeMainThread(); | 90 V8Initializer::initializeMainThread(); |
| 92 | 91 |
| 93 // currentThread is null if we are running on a thread without a message loo
p. | 92 // currentThread is null if we are running on a thread without a message loo
p. |
| 94 if (WebThread* currentThread = platform->currentThread()) { | 93 if (WebThread* currentThread = platform->currentThread()) { |
| 95 ASSERT(!s_endOfTaskRunner); | 94 ASSERT(!s_endOfTaskRunner); |
| 96 s_endOfTaskRunner = new EndOfTaskRunner; | 95 s_endOfTaskRunner = new EndOfTaskRunner; |
| 97 currentThread->addTaskObserver(s_endOfTaskRunner); | 96 currentThread->addTaskObserver(s_endOfTaskRunner); |
| 98 } | 97 } |
| 99 } | 98 } |
| 100 | 99 |
| 101 v8::Isolate* mainThreadIsolate() | |
| 102 { | |
| 103 return V8PerIsolateData::mainThreadIsolate(); | |
| 104 } | |
| 105 | |
| 106 void shutdown() | 100 void shutdown() |
| 107 { | 101 { |
| 108 ThreadState::current()->cleanupMainThread(); | 102 ThreadState::current()->cleanupMainThread(); |
| 109 | 103 |
| 110 // currentThread() is null if we are running on a thread without a message l
oop. | 104 // currentThread() is null if we are running on a thread without a message l
oop. |
| 111 if (Platform::current()->currentThread()) { | 105 if (Platform::current()->currentThread()) { |
| 112 // We don't need to (cannot) remove s_endOfTaskRunner from the current | 106 // We don't need to (cannot) remove s_endOfTaskRunner from the current |
| 113 // message loop, because the message loop is already destructed before | 107 // message loop, because the message loop is already destructed before |
| 114 // the shutdown() is called. | 108 // the shutdown() is called. |
| 115 delete s_endOfTaskRunner; | 109 delete s_endOfTaskRunner; |
| 116 s_endOfTaskRunner = nullptr; | 110 s_endOfTaskRunner = nullptr; |
| 117 } | 111 } |
| 118 | 112 |
| 119 V8Initializer::shutdownMainThread(); | 113 V8Initializer::shutdownMainThread(); |
| 120 | 114 |
| 121 modulesInitializer().shutdown(); | 115 modulesInitializer().shutdown(); |
| 122 | 116 |
| 123 Platform::shutdown(); | 117 Platform::shutdown(); |
| 124 } | 118 } |
| 125 | 119 |
| 120 v8::Isolate* mainThreadIsolate() |
| 121 { |
| 122 return V8PerIsolateData::mainThreadIsolate(); |
| 123 } |
| 124 |
| 126 // TODO(tkent): The following functions to wrap LayoutTestSupport should be | 125 // TODO(tkent): The following functions to wrap LayoutTestSupport should be |
| 127 // moved to public/platform/. | 126 // moved to public/platform/. |
| 128 | 127 |
| 129 void setLayoutTestMode(bool value) | 128 void setLayoutTestMode(bool value) |
| 130 { | 129 { |
| 131 LayoutTestSupport::setIsRunningLayoutTest(value); | 130 LayoutTestSupport::setIsRunningLayoutTest(value); |
| 132 } | 131 } |
| 133 | 132 |
| 134 bool layoutTestMode() | 133 bool layoutTestMode() |
| 135 { | 134 { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 ASSERT(!reloadPages); | 174 ASSERT(!reloadPages); |
| 176 Page::refreshPlugins(); | 175 Page::refreshPlugins(); |
| 177 } | 176 } |
| 178 | 177 |
| 179 void decommitFreeableMemory() | 178 void decommitFreeableMemory() |
| 180 { | 179 { |
| 181 WTF::Partitions::decommitFreeableMemory(); | 180 WTF::Partitions::decommitFreeableMemory(); |
| 182 } | 181 } |
| 183 | 182 |
| 184 } // namespace blink | 183 } // namespace blink |
| OLD | NEW |