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

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

Issue 2159123002: Shutdown renderer main message loop before blink::shutdown() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 4 years, 4 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
« no previous file with comments | « media/blink/run_all_unittests.cc ('k') | third_party/WebKit/public/web/WebKit.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } // namespace 73 } // namespace
74 74
75 static WebThread::TaskObserver* s_endOfTaskRunner = nullptr; 75 static WebThread::TaskObserver* s_endOfTaskRunner = nullptr;
76 76
77 static ModulesInitializer& modulesInitializer() 77 static ModulesInitializer& modulesInitializer()
78 { 78 {
79 DEFINE_STATIC_LOCAL(std::unique_ptr<ModulesInitializer>, initializer, (wrapU nique(new ModulesInitializer))); 79 DEFINE_STATIC_LOCAL(std::unique_ptr<ModulesInitializer>, initializer, (wrapU nique(new ModulesInitializer)));
80 return *initializer; 80 return *initializer;
81 } 81 }
82 82
83 void initialize(Platform* platform) 83 void initialize()
84 { 84 {
85 Platform::initialize(platform); 85 DCHECK(Platform::current());
86 86
87 V8Initializer::initializeMainThread(); 87 V8Initializer::initializeMainThread();
88 88
89 modulesInitializer().initialize(); 89 modulesInitializer().initialize();
90 90
91 // currentThread is null if we are running on a thread without a message loo p. 91 // currentThread is null if we are running on a thread without a message loo p.
92 if (WebThread* currentThread = platform->currentThread()) { 92 if (WebThread* currentThread = Platform::current()->currentThread()) {
93 DCHECK(!s_endOfTaskRunner); 93 DCHECK(!s_endOfTaskRunner);
94 s_endOfTaskRunner = new EndOfTaskRunner; 94 s_endOfTaskRunner = new EndOfTaskRunner;
95 currentThread->addTaskObserver(s_endOfTaskRunner); 95 currentThread->addTaskObserver(s_endOfTaskRunner);
96 } 96 }
97 } 97 }
98 98
99 void shutdown() 99 void shutdown()
100 { 100 {
101 ThreadState::current()->cleanupMainThread(); 101 ThreadState::current()->cleanupMainThread();
102 102
103 // currentThread() is null if we are running on a thread without a message l oop. 103 // currentThread() is null if we are running on a thread without a message l oop.
104 if (Platform::current()->currentThread()) { 104 if (Platform::current()->currentThread()) {
105 // We don't need to (cannot) remove s_endOfTaskRunner from the current 105 // We don't need to (cannot) remove s_endOfTaskRunner from the current
106 // message loop, because the message loop is already destructed before 106 // message loop, because the message loop is already destructed before
107 // the shutdown() is called. 107 // the shutdown() is called.
108 delete s_endOfTaskRunner; 108 delete s_endOfTaskRunner;
109 s_endOfTaskRunner = nullptr; 109 s_endOfTaskRunner = nullptr;
110 } 110 }
111 111
112 modulesInitializer().shutdown(); 112 modulesInitializer().shutdown();
113 113
114 V8Initializer::shutdownMainThread(); 114 V8Initializer::shutdownMainThread();
115
116 Platform::shutdown();
117 } 115 }
118 116
119 v8::Isolate* mainThreadIsolate() 117 v8::Isolate* mainThreadIsolate()
120 { 118 {
121 return V8PerIsolateData::mainThreadIsolate(); 119 return V8PerIsolateData::mainThreadIsolate();
122 } 120 }
123 121
124 // TODO(tkent): The following functions to wrap LayoutTestSupport should be 122 // TODO(tkent): The following functions to wrap LayoutTestSupport should be
125 // moved to public/platform/. 123 // moved to public/platform/.
126 124
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 WorkerBackingThread:: 183 WorkerBackingThread::
186 MemoryPressureNotificationToWorkerThreadIsolates(level); 184 MemoryPressureNotificationToWorkerThreadIsolates(level);
187 } 185 }
188 186
189 void setRAILModeOnWorkerThreadIsolates(v8::RAILMode railMode) 187 void setRAILModeOnWorkerThreadIsolates(v8::RAILMode railMode)
190 { 188 {
191 WorkerBackingThread::setRAILModeOnWorkerThreadIsolates(railMode); 189 WorkerBackingThread::setRAILModeOnWorkerThreadIsolates(railMode);
192 } 190 }
193 191
194 } // namespace blink 192 } // namespace blink
OLDNEW
« no previous file with comments | « media/blink/run_all_unittests.cc ('k') | third_party/WebKit/public/web/WebKit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698