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 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 | 961 |
962 // Shut down the message loop (if provided when the RenderThreadImpl was | 962 // Shut down the message loop (if provided when the RenderThreadImpl was |
963 // constructed) and the renderer scheduler before shutting down Blink. This | 963 // constructed) and the renderer scheduler before shutting down Blink. This |
964 // prevents a scenario where a pending task in the message loop accesses Blink | 964 // prevents a scenario where a pending task in the message loop accesses Blink |
965 // objects after Blink shuts down. | 965 // objects after Blink shuts down. |
966 renderer_scheduler_->SetRAILModeObserver(nullptr); | 966 renderer_scheduler_->SetRAILModeObserver(nullptr); |
967 renderer_scheduler_->Shutdown(); | 967 renderer_scheduler_->Shutdown(); |
968 | 968 |
969 ChildThreadImpl::ShutdownDiscardableSharedMemoryManager(); | 969 ChildThreadImpl::ShutdownDiscardableSharedMemoryManager(); |
970 | 970 |
| 971 if (main_message_loop_) |
| 972 base::RunLoop().RunUntilIdle(); |
| 973 |
| 974 main_message_loop_.reset(); |
| 975 |
971 lazy_tls.Pointer()->Set(nullptr); | 976 lazy_tls.Pointer()->Set(nullptr); |
972 } | 977 } |
973 | 978 |
974 bool RenderThreadImpl::Send(IPC::Message* msg) { | 979 bool RenderThreadImpl::Send(IPC::Message* msg) { |
975 // There are cases where we want to pump asynchronous messages while waiting | 980 // There are cases where we want to pump asynchronous messages while waiting |
976 // synchronously for the replies to the message to be sent here. However, this | 981 // synchronously for the replies to the message to be sent here. However, this |
977 // may create an opportunity for re-entrancy into WebKit and other subsystems, | 982 // may create an opportunity for re-entrancy into WebKit and other subsystems, |
978 // so we need to take care to disable callbacks, timers, and pending network | 983 // so we need to take care to disable callbacks, timers, and pending network |
979 // loads that could trigger such callbacks. | 984 // loads that could trigger such callbacks. |
980 bool pumping_events = false; | 985 bool pumping_events = false; |
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2205 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) | 2210 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) |
2206 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; | 2211 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; |
2207 | 2212 |
2208 blink::mainThreadIsolate()->MemoryPressureNotification( | 2213 blink::mainThreadIsolate()->MemoryPressureNotification( |
2209 v8_memory_pressure_level); | 2214 v8_memory_pressure_level); |
2210 blink::MemoryPressureNotificationToWorkerThreadIsolates( | 2215 blink::MemoryPressureNotificationToWorkerThreadIsolates( |
2211 v8_memory_pressure_level); | 2216 v8_memory_pressure_level); |
2212 } | 2217 } |
2213 | 2218 |
2214 } // namespace content | 2219 } // namespace content |
OLD | NEW |