| 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/at_exit.h" | 14 #include "base/at_exit.h" |
| 15 #include "base/base_features.h" |
| 15 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 16 #include "base/debug/crash_logging.h" | 17 #include "base/debug/crash_logging.h" |
| 17 #include "base/lazy_instance.h" | 18 #include "base/lazy_instance.h" |
| 18 #include "base/logging.h" | 19 #include "base/logging.h" |
| 19 #include "base/macros.h" | 20 #include "base/macros.h" |
| 20 #include "base/memory/discardable_memory_allocator.h" | 21 #include "base/memory/discardable_memory_allocator.h" |
| 21 #include "base/memory/memory_coordinator_client_registry.h" | 22 #include "base/memory/memory_coordinator_client_registry.h" |
| 22 #include "base/memory/ptr_util.h" | 23 #include "base/memory/ptr_util.h" |
| 23 #include "base/memory/shared_memory.h" | 24 #include "base/memory/shared_memory.h" |
| 24 #include "base/metrics/field_trial.h" | 25 #include "base/metrics/field_trial.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 #include "content/common/features.h" | 73 #include "content/common/features.h" |
| 73 #include "content/common/field_trial_recorder.mojom.h" | 74 #include "content/common/field_trial_recorder.mojom.h" |
| 74 #include "content/common/frame_messages.h" | 75 #include "content/common/frame_messages.h" |
| 75 #include "content/common/frame_owner_properties.h" | 76 #include "content/common/frame_owner_properties.h" |
| 76 #include "content/common/render_process_messages.h" | 77 #include "content/common/render_process_messages.h" |
| 77 #include "content/common/resource_messages.h" | 78 #include "content/common/resource_messages.h" |
| 78 #include "content/common/site_isolation_policy.h" | 79 #include "content/common/site_isolation_policy.h" |
| 79 #include "content/common/view_messages.h" | 80 #include "content/common/view_messages.h" |
| 80 #include "content/common/worker_messages.h" | 81 #include "content/common/worker_messages.h" |
| 81 #include "content/public/common/content_constants.h" | 82 #include "content/public/common/content_constants.h" |
| 82 #include "content/public/common/content_features.h" | |
| 83 #include "content/public/common/content_paths.h" | 83 #include "content/public/common/content_paths.h" |
| 84 #include "content/public/common/content_switches.h" | 84 #include "content/public/common/content_switches.h" |
| 85 #include "content/public/common/renderer_preferences.h" | 85 #include "content/public/common/renderer_preferences.h" |
| 86 #include "content/public/common/service_names.mojom.h" | 86 #include "content/public/common/service_names.mojom.h" |
| 87 #include "content/public/common/url_constants.h" | 87 #include "content/public/common/url_constants.h" |
| 88 #include "content/public/renderer/content_renderer_client.h" | 88 #include "content/public/renderer/content_renderer_client.h" |
| 89 #include "content/public/renderer/render_thread_observer.h" | 89 #include "content/public/renderer/render_thread_observer.h" |
| 90 #include "content/public/renderer/render_view_visitor.h" | 90 #include "content/public/renderer/render_view_visitor.h" |
| 91 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 91 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
| 92 #include "content/renderer/cache_storage/cache_storage_dispatcher.h" | 92 #include "content/renderer/cache_storage/cache_storage_dispatcher.h" |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 base::CommandLine::ForCurrentProcess()->HasSwitch( | 821 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 822 switches::kEnableNewVp9CodecString)) { | 822 switches::kEnableNewVp9CodecString)) { |
| 823 media::EnableNewVp9CodecStringSupport(); | 823 media::EnableNewVp9CodecStringSupport(); |
| 824 } | 824 } |
| 825 | 825 |
| 826 memory_pressure_listener_.reset(new base::MemoryPressureListener( | 826 memory_pressure_listener_.reset(new base::MemoryPressureListener( |
| 827 base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this)), | 827 base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this)), |
| 828 base::Bind(&RenderThreadImpl::OnSyncMemoryPressure, | 828 base::Bind(&RenderThreadImpl::OnSyncMemoryPressure, |
| 829 base::Unretained(this)))); | 829 base::Unretained(this)))); |
| 830 | 830 |
| 831 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) { | 831 if (base::FeatureList::IsEnabled(base::features::kMemoryCoordinator)) { |
| 832 // Disable MemoryPressureListener when memory coordinator is enabled. | 832 // Disable MemoryPressureListener when memory coordinator is enabled. |
| 833 base::MemoryPressureListener::SetNotificationsSuppressed(true); | 833 base::MemoryPressureListener::SetNotificationsSuppressed(true); |
| 834 | 834 |
| 835 // TODO(bashi): Revisit how to manage the lifetime of | 835 // TODO(bashi): Revisit how to manage the lifetime of |
| 836 // ChildMemoryCoordinatorImpl. | 836 // ChildMemoryCoordinatorImpl. |
| 837 // https://codereview.chromium.org/2094583002/#msg52 | 837 // https://codereview.chromium.org/2094583002/#msg52 |
| 838 mojom::MemoryCoordinatorHandlePtr parent_coordinator; | 838 mojom::MemoryCoordinatorHandlePtr parent_coordinator; |
| 839 GetConnector()->BindInterface(mojom::kBrowserServiceName, | 839 GetConnector()->BindInterface(mojom::kBrowserServiceName, |
| 840 mojo::MakeRequest(&parent_coordinator)); | 840 mojo::MakeRequest(&parent_coordinator)); |
| 841 memory_coordinator_ = CreateChildMemoryCoordinator( | 841 memory_coordinator_ = CreateChildMemoryCoordinator( |
| (...skipping 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2468 } | 2468 } |
| 2469 } | 2469 } |
| 2470 | 2470 |
| 2471 void RenderThreadImpl::OnRendererInterfaceRequest( | 2471 void RenderThreadImpl::OnRendererInterfaceRequest( |
| 2472 mojom::RendererAssociatedRequest request) { | 2472 mojom::RendererAssociatedRequest request) { |
| 2473 DCHECK(!renderer_binding_.is_bound()); | 2473 DCHECK(!renderer_binding_.is_bound()); |
| 2474 renderer_binding_.Bind(std::move(request)); | 2474 renderer_binding_.Bind(std::move(request)); |
| 2475 } | 2475 } |
| 2476 | 2476 |
| 2477 } // namespace content | 2477 } // namespace content |
| OLD | NEW |