| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/allocator/allocator_extension.h" | 13 #include "base/allocator/allocator_extension.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/debug/crash_logging.h" | 15 #include "base/debug/crash_logging.h" |
| 16 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
| 17 #include "base/location.h" | |
| 18 #include "base/logging.h" | 17 #include "base/logging.h" |
| 19 #include "base/macros.h" | 18 #include "base/macros.h" |
| 20 #include "base/memory/discardable_memory_allocator.h" | 19 #include "base/memory/discardable_memory_allocator.h" |
| 21 #include "base/memory/ptr_util.h" | 20 #include "base/memory/ptr_util.h" |
| 22 #include "base/memory/shared_memory.h" | 21 #include "base/memory/shared_memory.h" |
| 23 #include "base/metrics/field_trial.h" | 22 #include "base/metrics/field_trial.h" |
| 24 #include "base/metrics/histogram.h" | 23 #include "base/metrics/histogram.h" |
| 25 #include "base/path_service.h" | 24 #include "base/path_service.h" |
| 26 #include "base/single_thread_task_runner.h" | 25 #include "base/run_loop.h" |
| 27 #include "base/strings/string16.h" | 26 #include "base/strings/string16.h" |
| 28 #include "base/strings/string_number_conversions.h" | 27 #include "base/strings/string_number_conversions.h" |
| 29 #include "base/strings/string_split.h" | 28 #include "base/strings/string_split.h" |
| 30 #include "base/strings/string_tokenizer.h" | 29 #include "base/strings/string_tokenizer.h" |
| 31 #include "base/strings/sys_string_conversions.h" | 30 #include "base/strings/sys_string_conversions.h" |
| 32 #include "base/strings/utf_string_conversions.h" | 31 #include "base/strings/utf_string_conversions.h" |
| 33 #include "base/threading/simple_thread.h" | 32 #include "base/threading/simple_thread.h" |
| 34 #include "base/threading/thread_local.h" | 33 #include "base/threading/thread_local.h" |
| 35 #include "base/threading/thread_restrictions.h" | 34 #include "base/threading/thread_restrictions.h" |
| 36 #include "base/threading/thread_task_runner_handle.h" | 35 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 | 961 |
| 963 // Context providers must be released prior to destroying the GPU channel. | 962 // Context providers must be released prior to destroying the GPU channel. |
| 964 shared_worker_context_provider_ = nullptr; | 963 shared_worker_context_provider_ = nullptr; |
| 965 shared_main_thread_contexts_ = nullptr; | 964 shared_main_thread_contexts_ = nullptr; |
| 966 | 965 |
| 967 if (gpu_channel_.get()) | 966 if (gpu_channel_.get()) |
| 968 gpu_channel_->DestroyChannel(); | 967 gpu_channel_->DestroyChannel(); |
| 969 | 968 |
| 970 ChildThreadImpl::Shutdown(); | 969 ChildThreadImpl::Shutdown(); |
| 971 | 970 |
| 972 // Shut down the message loop and the renderer scheduler before shutting down | 971 // Shut down the message loop (if provided when the RenderThreadImpl was |
| 973 // Blink. This prevents a scenario where a pending task in the message loop | 972 // constructed) and the renderer scheduler before shutting down Blink. This |
| 974 // accesses Blink objects after Blink shuts down. | 973 // prevents a scenario where a pending task in the message loop accesses Blink |
| 974 // objects after Blink shuts down. |
| 975 renderer_scheduler_->SetRAILModeObserver(nullptr); | 975 renderer_scheduler_->SetRAILModeObserver(nullptr); |
| 976 renderer_scheduler_->Shutdown(); | 976 renderer_scheduler_->Shutdown(); |
| 977 if (main_message_loop_) | 977 if (main_message_loop_) |
| 978 main_message_loop_->RunUntilIdle(); | 978 base::RunLoop().RunUntilIdle(); |
| 979 | 979 |
| 980 if (blink_platform_impl_) { | 980 if (blink_platform_impl_) { |
| 981 blink_platform_impl_->Shutdown(); | 981 blink_platform_impl_->Shutdown(); |
| 982 // This must be at the very end of the shutdown sequence. | 982 // This must be at the very end of the shutdown sequence. |
| 983 // blink::shutdown() must be called after all strong references from | 983 // blink::shutdown() must be called after all strong references from |
| 984 // Chromium to Blink are cleared. | 984 // Chromium to Blink are cleared. |
| 985 blink::shutdown(); | 985 blink::shutdown(); |
| 986 } | 986 } |
| 987 | 987 |
| 988 // Delay shutting down DiscardableSharedMemoryManager until blink::shutdown | 988 // Delay shutting down DiscardableSharedMemoryManager until blink::shutdown |
| (...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2228 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) | 2228 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) |
| 2229 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; | 2229 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; |
| 2230 | 2230 |
| 2231 blink::mainThreadIsolate()->MemoryPressureNotification( | 2231 blink::mainThreadIsolate()->MemoryPressureNotification( |
| 2232 v8_memory_pressure_level); | 2232 v8_memory_pressure_level); |
| 2233 blink::MemoryPressureNotificationToWorkerThreadIsolates( | 2233 blink::MemoryPressureNotificationToWorkerThreadIsolates( |
| 2234 v8_memory_pressure_level); | 2234 v8_memory_pressure_level); |
| 2235 } | 2235 } |
| 2236 | 2236 |
| 2237 } // namespace content | 2237 } // namespace content |
| OLD | NEW |