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