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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 #include "ipc/ipc_platform_file.h" | 135 #include "ipc/ipc_platform_file.h" |
136 #include "media/base/audio_hardware_config.h" | 136 #include "media/base/audio_hardware_config.h" |
137 #include "media/base/media.h" | 137 #include "media/base/media.h" |
138 #include "media/renderers/gpu_video_accelerator_factories.h" | 138 #include "media/renderers/gpu_video_accelerator_factories.h" |
139 #include "mojo/common/common_type_converters.h" | 139 #include "mojo/common/common_type_converters.h" |
140 #include "mojo/public/cpp/bindings/strong_binding.h" | 140 #include "mojo/public/cpp/bindings/strong_binding.h" |
141 #include "net/base/net_errors.h" | 141 #include "net/base/net_errors.h" |
142 #include "net/base/port_util.h" | 142 #include "net/base/port_util.h" |
143 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 143 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
144 #include "net/base/url_util.h" | 144 #include "net/base/url_util.h" |
145 #include "services/shell/public/cpp/interface_provider.h" | |
146 #include "services/shell/public/cpp/interface_registry.h" | |
147 #include "skia/ext/event_tracer_impl.h" | 145 #include "skia/ext/event_tracer_impl.h" |
148 #include "skia/ext/skia_memory_dump_provider.h" | 146 #include "skia/ext/skia_memory_dump_provider.h" |
149 #include "third_party/WebKit/public/platform/WebImageGenerator.h" | 147 #include "third_party/WebKit/public/platform/WebImageGenerator.h" |
150 #include "third_party/WebKit/public/platform/WebString.h" | 148 #include "third_party/WebKit/public/platform/WebString.h" |
151 #include "third_party/WebKit/public/platform/WebThread.h" | 149 #include "third_party/WebKit/public/platform/WebThread.h" |
152 #include "third_party/WebKit/public/web/WebCache.h" | 150 #include "third_party/WebKit/public/web/WebCache.h" |
153 #include "third_party/WebKit/public/web/WebDatabase.h" | 151 #include "third_party/WebKit/public/web/WebDatabase.h" |
154 #include "third_party/WebKit/public/web/WebDocument.h" | 152 #include "third_party/WebKit/public/web/WebDocument.h" |
155 #include "third_party/WebKit/public/web/WebFrame.h" | 153 #include "third_party/WebKit/public/web/WebFrame.h" |
156 #include "third_party/WebKit/public/web/WebKit.h" | 154 #include "third_party/WebKit/public/web/WebKit.h" |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 // See crbug.com/503724. | 842 // See crbug.com/503724. |
845 base::DiscardableMemoryAllocator::SetInstance( | 843 base::DiscardableMemoryAllocator::SetInstance( |
846 ChildThreadImpl::discardable_shared_memory_manager()); | 844 ChildThreadImpl::discardable_shared_memory_manager()); |
847 | 845 |
848 GetContentClient()->renderer()->ExposeInterfacesToBrowser( | 846 GetContentClient()->renderer()->ExposeInterfacesToBrowser( |
849 GetInterfaceRegistry()); | 847 GetInterfaceRegistry()); |
850 | 848 |
851 GetInterfaceRegistry()->AddInterface(base::Bind(CreateFrameFactory)); | 849 GetInterfaceRegistry()->AddInterface(base::Bind(CreateFrameFactory)); |
852 GetInterfaceRegistry()->AddInterface(base::Bind(CreateEmbeddedWorkerSetup)); | 850 GetInterfaceRegistry()->AddInterface(base::Bind(CreateEmbeddedWorkerSetup)); |
853 | 851 |
| 852 #if defined(MOJO_SHELL_CLIENT) && defined(USE_AURA) |
| 853 // We may not have a MojoShellConnection object in tests that directly |
| 854 // instantiate a RenderThreadImpl. |
| 855 if (MojoShellConnection::GetForProcess() && |
| 856 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 857 switches::kUseMusInRenderer)) |
| 858 CreateRenderWidgetWindowTreeClientFactory(); |
| 859 #endif |
| 860 |
854 GetRemoteInterfaces()->GetInterface( | 861 GetRemoteInterfaces()->GetInterface( |
855 mojo::GetProxy(&storage_partition_service_)); | 862 mojo::GetProxy(&storage_partition_service_)); |
856 | 863 |
857 is_renderer_suspended_ = false; | 864 is_renderer_suspended_ = false; |
858 } | 865 } |
859 | 866 |
860 RenderThreadImpl::~RenderThreadImpl() { | 867 RenderThreadImpl::~RenderThreadImpl() { |
861 } | 868 } |
862 | 869 |
863 void RenderThreadImpl::Shutdown() { | 870 void RenderThreadImpl::Shutdown() { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 ChildThreadImpl::ShutdownDiscardableSharedMemoryManager(); | 987 ChildThreadImpl::ShutdownDiscardableSharedMemoryManager(); |
981 | 988 |
982 // The message loop must be cleared after shutting down | 989 // The message loop must be cleared after shutting down |
983 // the DiscardableSharedMemoryManager, which needs to send messages | 990 // the DiscardableSharedMemoryManager, which needs to send messages |
984 // to the browser process. | 991 // to the browser process. |
985 main_message_loop_.reset(); | 992 main_message_loop_.reset(); |
986 | 993 |
987 lazy_tls.Pointer()->Set(nullptr); | 994 lazy_tls.Pointer()->Set(nullptr); |
988 } | 995 } |
989 | 996 |
990 void RenderThreadImpl::AddConnectionFilters(MojoShellConnection* connection) { | |
991 #if defined(MOJO_SHELL_CLIENT) && defined(USE_AURA) | |
992 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
993 switches::kUseMusInRenderer)) { | |
994 CreateRenderWidgetWindowTreeClientFactory(connection); | |
995 } | |
996 #endif | |
997 } | |
998 | |
999 bool RenderThreadImpl::Send(IPC::Message* msg) { | 997 bool RenderThreadImpl::Send(IPC::Message* msg) { |
1000 // There are cases where we want to pump asynchronous messages while waiting | 998 // There are cases where we want to pump asynchronous messages while waiting |
1001 // synchronously for the replies to the message to be sent here. However, this | 999 // synchronously for the replies to the message to be sent here. However, this |
1002 // may create an opportunity for re-entrancy into WebKit and other subsystems, | 1000 // may create an opportunity for re-entrancy into WebKit and other subsystems, |
1003 // so we need to take care to disable callbacks, timers, and pending network | 1001 // so we need to take care to disable callbacks, timers, and pending network |
1004 // loads that could trigger such callbacks. | 1002 // loads that could trigger such callbacks. |
1005 bool pumping_events = false; | 1003 bool pumping_events = false; |
1006 if (msg->is_sync()) { | 1004 if (msg->is_sync()) { |
1007 if (msg->is_caller_pumping_messages()) { | 1005 if (msg->is_caller_pumping_messages()) { |
1008 pumping_events = true; | 1006 pumping_events = true; |
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2241 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) | 2239 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) |
2242 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; | 2240 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; |
2243 | 2241 |
2244 blink::mainThreadIsolate()->MemoryPressureNotification( | 2242 blink::mainThreadIsolate()->MemoryPressureNotification( |
2245 v8_memory_pressure_level); | 2243 v8_memory_pressure_level); |
2246 blink::MemoryPressureNotificationToWorkerThreadIsolates( | 2244 blink::MemoryPressureNotificationToWorkerThreadIsolates( |
2247 v8_memory_pressure_level); | 2245 v8_memory_pressure_level); |
2248 } | 2246 } |
2249 | 2247 |
2250 } // namespace content | 2248 } // namespace content |
OLD | NEW |