Chromium Code Reviews| 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 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 970 ChildThreadImpl::Shutdown(); | 970 ChildThreadImpl::Shutdown(); |
| 971 | 971 |
| 972 // Shut down the message loop (if provided when the RenderThreadImpl was | 972 // Shut down the message loop (if provided when the RenderThreadImpl was |
| 973 // constructed) and the renderer scheduler before shutting down Blink. This | 973 // constructed) and the renderer scheduler before shutting down Blink. This |
| 974 // prevents a scenario where a pending task in the message loop accesses Blink | 974 // prevents a scenario where a pending task in the message loop accesses Blink |
| 975 // objects after Blink shuts down. | 975 // objects after Blink shuts down. |
| 976 renderer_scheduler_->SetRAILModeObserver(nullptr); | 976 renderer_scheduler_->SetRAILModeObserver(nullptr); |
| 977 renderer_scheduler_->Shutdown(); | 977 renderer_scheduler_->Shutdown(); |
| 978 if (main_message_loop_) | 978 if (main_message_loop_) |
| 979 base::RunLoop().RunUntilIdle(); | 979 base::RunLoop().RunUntilIdle(); |
| 980 main_message_loop_ = nullptr; | |
| 980 | 981 |
| 981 if (blink_platform_impl_) { | 982 if (blink_platform_impl_) { |
| 982 blink_platform_impl_->Shutdown(); | 983 blink_platform_impl_->Shutdown(); |
| 983 // This must be at the very end of the shutdown sequence. | 984 // This must be at the very end of the shutdown sequence. |
| 984 // blink::shutdown() must be called after all strong references from | 985 // blink::shutdown() must be called after all strong references from |
| 985 // Chromium to Blink are cleared. | 986 // Chromium to Blink are cleared. |
| 986 blink::shutdown(); | 987 blink::shutdown(); |
| 987 } | 988 } |
| 988 | 989 |
| 989 // Delay shutting down DiscardableSharedMemoryManager until blink::shutdown | 990 // Delay shutting down DiscardableSharedMemoryManager until blink::shutdown |
| 990 // is complete, because blink::shutdown destructs Blink Resources and they | 991 // is complete, because blink::shutdown destructs Blink Resources and they |
| 991 // may try to unlock their underlying discardable memory. | 992 // may try to unlock their underlying discardable memory. |
| 992 ChildThreadImpl::ShutdownDiscardableSharedMemoryManager(); | 993 ChildThreadImpl::ShutdownDiscardableSharedMemoryManager(); |
| 993 | 994 |
| 994 // The message loop must be cleared after shutting down | |
| 995 // the DiscardableSharedMemoryManager, which needs to send messages | |
| 996 // to the browser process. | |
|
esprehn
2016/07/19 16:42:54
You're doing the opposite of what the comment says
tzik
2016/07/19 17:26:52
The comment looks inaccurate to me.
ChildDiscardab
| |
| 997 main_message_loop_.reset(); | |
| 998 | |
| 999 lazy_tls.Pointer()->Set(nullptr); | 995 lazy_tls.Pointer()->Set(nullptr); |
| 1000 } | 996 } |
| 1001 | 997 |
| 1002 bool RenderThreadImpl::Send(IPC::Message* msg) { | 998 bool RenderThreadImpl::Send(IPC::Message* msg) { |
| 1003 // 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 |
| 1004 // 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 |
| 1005 // 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, |
| 1006 // 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 |
| 1007 // loads that could trigger such callbacks. | 1003 // loads that could trigger such callbacks. |
| 1008 bool pumping_events = false; | 1004 bool pumping_events = false; |
| (...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2229 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) | 2225 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) |
| 2230 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; | 2226 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; |
| 2231 | 2227 |
| 2232 blink::mainThreadIsolate()->MemoryPressureNotification( | 2228 blink::mainThreadIsolate()->MemoryPressureNotification( |
| 2233 v8_memory_pressure_level); | 2229 v8_memory_pressure_level); |
| 2234 blink::MemoryPressureNotificationToWorkerThreadIsolates( | 2230 blink::MemoryPressureNotificationToWorkerThreadIsolates( |
| 2235 v8_memory_pressure_level); | 2231 v8_memory_pressure_level); |
| 2236 } | 2232 } |
| 2237 | 2233 |
| 2238 } // namespace content | 2234 } // namespace content |
| OLD | NEW |