| 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 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 gpu_channel_->DestroyChannel(); | 957 gpu_channel_->DestroyChannel(); |
| 958 | 958 |
| 959 ChildThreadImpl::Shutdown(); | 959 ChildThreadImpl::Shutdown(); |
| 960 | 960 |
| 961 // Shut down the message loop (if provided when the RenderThreadImpl was | 961 // Shut down the message loop (if provided when the RenderThreadImpl was |
| 962 // constructed) and the renderer scheduler before shutting down Blink. This | 962 // constructed) and the renderer scheduler before shutting down Blink. This |
| 963 // prevents a scenario where a pending task in the message loop accesses Blink | 963 // prevents a scenario where a pending task in the message loop accesses Blink |
| 964 // objects after Blink shuts down. | 964 // objects after Blink shuts down. |
| 965 renderer_scheduler_->SetRAILModeObserver(nullptr); | 965 renderer_scheduler_->SetRAILModeObserver(nullptr); |
| 966 renderer_scheduler_->Shutdown(); | 966 renderer_scheduler_->Shutdown(); |
| 967 | |
| 968 ChildThreadImpl::ShutdownDiscardableSharedMemoryManager(); | |
| 969 | |
| 970 if (main_message_loop_) | 967 if (main_message_loop_) |
| 971 base::RunLoop().RunUntilIdle(); | 968 base::RunLoop().RunUntilIdle(); |
| 972 | 969 |
| 970 if (blink_platform_impl_) { |
| 971 blink_platform_impl_->Shutdown(); |
| 972 // This must be at the very end of the shutdown sequence. |
| 973 // blink::shutdown() must be called after all strong references from |
| 974 // Chromium to Blink are cleared. |
| 975 blink::shutdown(); |
| 976 } |
| 977 |
| 978 // Delay shutting down DiscardableSharedMemoryManager until blink::shutdown |
| 979 // is complete, because blink::shutdown destructs Blink Resources and they |
| 980 // may try to unlock their underlying discardable memory. |
| 981 ChildThreadImpl::ShutdownDiscardableSharedMemoryManager(); |
| 982 |
| 983 // The message loop must be cleared after shutting down |
| 984 // the DiscardableSharedMemoryManager, which needs to send messages |
| 985 // to the browser process. |
| 973 main_message_loop_.reset(); | 986 main_message_loop_.reset(); |
| 974 | 987 |
| 975 lazy_tls.Pointer()->Set(nullptr); | 988 lazy_tls.Pointer()->Set(nullptr); |
| 976 } | 989 } |
| 977 | 990 |
| 978 bool RenderThreadImpl::Send(IPC::Message* msg) { | 991 bool RenderThreadImpl::Send(IPC::Message* msg) { |
| 979 // There are cases where we want to pump asynchronous messages while waiting | 992 // There are cases where we want to pump asynchronous messages while waiting |
| 980 // synchronously for the replies to the message to be sent here. However, this | 993 // synchronously for the replies to the message to be sent here. However, this |
| 981 // may create an opportunity for re-entrancy into WebKit and other subsystems, | 994 // may create an opportunity for re-entrancy into WebKit and other subsystems, |
| 982 // so we need to take care to disable callbacks, timers, and pending network | 995 // so we need to take care to disable callbacks, timers, and pending network |
| (...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2213 if (blink::mainThreadIsolate()) { | 2226 if (blink::mainThreadIsolate()) { |
| 2214 blink::mainThreadIsolate()->MemoryPressureNotification( | 2227 blink::mainThreadIsolate()->MemoryPressureNotification( |
| 2215 v8::MemoryPressureLevel::kCritical); | 2228 v8::MemoryPressureLevel::kCritical); |
| 2216 blink::MemoryPressureNotificationToWorkerThreadIsolates( | 2229 blink::MemoryPressureNotificationToWorkerThreadIsolates( |
| 2217 v8::MemoryPressureLevel::kCritical); | 2230 v8::MemoryPressureLevel::kCritical); |
| 2218 } | 2231 } |
| 2219 } | 2232 } |
| 2220 | 2233 |
| 2221 | 2234 |
| 2222 } // namespace content | 2235 } // namespace content |
| OLD | NEW |