| 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 |
| 974 if (main_message_loop_) | 977 if (main_message_loop_) |
| 975 base::RunLoop().RunUntilIdle(); | 978 base::RunLoop().RunUntilIdle(); |
| 976 | 979 |
| 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. | |
| 993 main_message_loop_.reset(); | 980 main_message_loop_.reset(); |
| 994 | 981 |
| 995 lazy_tls.Pointer()->Set(nullptr); | 982 lazy_tls.Pointer()->Set(nullptr); |
| 996 } | 983 } |
| 997 | 984 |
| 998 bool RenderThreadImpl::Send(IPC::Message* msg) { | 985 bool RenderThreadImpl::Send(IPC::Message* msg) { |
| 999 // There are cases where we want to pump asynchronous messages while waiting | 986 // There are cases where we want to pump asynchronous messages while waiting |
| 1000 // synchronously for the replies to the message to be sent here. However, this | 987 // synchronously for the replies to the message to be sent here. However, this |
| 1001 // may create an opportunity for re-entrancy into WebKit and other subsystems, | 988 // may create an opportunity for re-entrancy into WebKit and other subsystems, |
| 1002 // so we need to take care to disable callbacks, timers, and pending network | 989 // 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... |
| 2229 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) | 2216 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) |
| 2230 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; | 2217 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; |
| 2231 | 2218 |
| 2232 blink::mainThreadIsolate()->MemoryPressureNotification( | 2219 blink::mainThreadIsolate()->MemoryPressureNotification( |
| 2233 v8_memory_pressure_level); | 2220 v8_memory_pressure_level); |
| 2234 blink::MemoryPressureNotificationToWorkerThreadIsolates( | 2221 blink::MemoryPressureNotificationToWorkerThreadIsolates( |
| 2235 v8_memory_pressure_level); | 2222 v8_memory_pressure_level); |
| 2236 } | 2223 } |
| 2237 | 2224 |
| 2238 } // namespace content | 2225 } // namespace content |
| OLD | NEW |