OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <utility> | 10 #include <utility> |
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 gpu_channel_->DestroyChannel(); | 964 gpu_channel_->DestroyChannel(); |
965 | 965 |
966 ChildThreadImpl::Shutdown(); | 966 ChildThreadImpl::Shutdown(); |
967 | 967 |
968 // Shut down the message loop (if provided when the RenderThreadImpl was | 968 // Shut down the message loop (if provided when the RenderThreadImpl was |
969 // constructed) and the renderer scheduler before shutting down Blink. This | 969 // constructed) and the renderer scheduler before shutting down Blink. This |
970 // prevents a scenario where a pending task in the message loop accesses Blink | 970 // prevents a scenario where a pending task in the message loop accesses Blink |
971 // objects after Blink shuts down. | 971 // objects after Blink shuts down. |
972 renderer_scheduler_->SetRAILModeObserver(nullptr); | 972 renderer_scheduler_->SetRAILModeObserver(nullptr); |
973 renderer_scheduler_->Shutdown(); | 973 renderer_scheduler_->Shutdown(); |
974 | |
975 ChildThreadImpl::ShutdownDiscardableSharedMemoryManager(); | |
976 | |
977 if (main_message_loop_) | 974 if (main_message_loop_) |
978 base::RunLoop().RunUntilIdle(); | 975 base::RunLoop().RunUntilIdle(); |
979 | 976 |
| 977 if (blink_platform_impl_) { |
| 978 blink_platform_impl_->Shutdown(); |
| 979 // This must be at the very end of the shutdown sequence. |
| 980 // blink::shutdown() must be called after all strong references from |
| 981 // Chromium to Blink are cleared. |
| 982 blink::shutdown(); |
| 983 } |
| 984 |
| 985 // Delay shutting down DiscardableSharedMemoryManager until blink::shutdown |
| 986 // is complete, because blink::shutdown destructs Blink Resources and they |
| 987 // may try to unlock their underlying discardable memory. |
| 988 ChildThreadImpl::ShutdownDiscardableSharedMemoryManager(); |
| 989 |
| 990 // The message loop must be cleared after shutting down |
| 991 // the DiscardableSharedMemoryManager, which needs to send messages |
| 992 // to the browser process. |
980 main_message_loop_.reset(); | 993 main_message_loop_.reset(); |
981 | 994 |
982 lazy_tls.Pointer()->Set(nullptr); | 995 lazy_tls.Pointer()->Set(nullptr); |
983 } | 996 } |
984 | 997 |
985 bool RenderThreadImpl::Send(IPC::Message* msg) { | 998 bool RenderThreadImpl::Send(IPC::Message* msg) { |
986 // There are cases where we want to pump asynchronous messages while waiting | 999 // There are cases where we want to pump asynchronous messages while waiting |
987 // synchronously for the replies to the message to be sent here. However, this | 1000 // synchronously for the replies to the message to be sent here. However, this |
988 // may create an opportunity for re-entrancy into WebKit and other subsystems, | 1001 // may create an opportunity for re-entrancy into WebKit and other subsystems, |
989 // so we need to take care to disable callbacks, timers, and pending network | 1002 // so we need to take care to disable callbacks, timers, and pending network |
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2216 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) | 2229 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) |
2217 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; | 2230 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; |
2218 | 2231 |
2219 blink::mainThreadIsolate()->MemoryPressureNotification( | 2232 blink::mainThreadIsolate()->MemoryPressureNotification( |
2220 v8_memory_pressure_level); | 2233 v8_memory_pressure_level); |
2221 blink::MemoryPressureNotificationToWorkerThreadIsolates( | 2234 blink::MemoryPressureNotificationToWorkerThreadIsolates( |
2222 v8_memory_pressure_level); | 2235 v8_memory_pressure_level); |
2223 } | 2236 } |
2224 | 2237 |
2225 } // namespace content | 2238 } // namespace content |
OLD | NEW |