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 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 // See crbug.com/503724. | 835 // See crbug.com/503724. |
834 base::DiscardableMemoryAllocator::SetInstance( | 836 base::DiscardableMemoryAllocator::SetInstance( |
835 ChildThreadImpl::discardable_shared_memory_manager()); | 837 ChildThreadImpl::discardable_shared_memory_manager()); |
836 | 838 |
837 GetContentClient()->renderer()->ExposeInterfacesToBrowser( | 839 GetContentClient()->renderer()->ExposeInterfacesToBrowser( |
838 GetInterfaceRegistry()); | 840 GetInterfaceRegistry()); |
839 | 841 |
840 GetInterfaceRegistry()->AddInterface(base::Bind(CreateFrameFactory)); | 842 GetInterfaceRegistry()->AddInterface(base::Bind(CreateFrameFactory)); |
841 GetInterfaceRegistry()->AddInterface(base::Bind(CreateEmbeddedWorkerSetup)); | 843 GetInterfaceRegistry()->AddInterface(base::Bind(CreateEmbeddedWorkerSetup)); |
842 | 844 |
843 #if defined(MOJO_SHELL_CLIENT) && defined(USE_AURA) | |
844 // We may not have a MojoShellConnection object in tests that directly | |
845 // instantiate a RenderThreadImpl. | |
846 if (MojoShellConnection::GetForProcess() && | |
847 base::CommandLine::ForCurrentProcess()->HasSwitch( | |
848 switches::kUseMusInRenderer)) | |
849 CreateRenderWidgetWindowTreeClientFactory(); | |
850 #endif | |
851 | |
852 GetRemoteInterfaces()->GetInterface( | 845 GetRemoteInterfaces()->GetInterface( |
853 mojo::GetProxy(&storage_partition_service_)); | 846 mojo::GetProxy(&storage_partition_service_)); |
854 | 847 |
855 is_renderer_suspended_ = false; | 848 is_renderer_suspended_ = false; |
856 } | 849 } |
857 | 850 |
858 RenderThreadImpl::~RenderThreadImpl() { | 851 RenderThreadImpl::~RenderThreadImpl() { |
859 } | 852 } |
860 | 853 |
861 void RenderThreadImpl::Shutdown() { | 854 void RenderThreadImpl::Shutdown() { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 ChildThreadImpl::ShutdownDiscardableSharedMemoryManager(); | 971 ChildThreadImpl::ShutdownDiscardableSharedMemoryManager(); |
979 | 972 |
980 // The message loop must be cleared after shutting down | 973 // The message loop must be cleared after shutting down |
981 // the DiscardableSharedMemoryManager, which needs to send messages | 974 // the DiscardableSharedMemoryManager, which needs to send messages |
982 // to the browser process. | 975 // to the browser process. |
983 main_message_loop_.reset(); | 976 main_message_loop_.reset(); |
984 | 977 |
985 lazy_tls.Pointer()->Set(NULL); | 978 lazy_tls.Pointer()->Set(NULL); |
986 } | 979 } |
987 | 980 |
| 981 void RenderThreadImpl::AddConnectionFilters(MojoShellConnection* connection) { |
| 982 #if defined(MOJO_SHELL_CLIENT) && defined(USE_AURA) |
| 983 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 984 switches::kUseMusInRenderer)) { |
| 985 CreateRenderWidgetWindowTreeClientFactory(connection); |
| 986 } |
| 987 #endif |
| 988 } |
| 989 |
988 bool RenderThreadImpl::Send(IPC::Message* msg) { | 990 bool RenderThreadImpl::Send(IPC::Message* msg) { |
989 // There are cases where we want to pump asynchronous messages while waiting | 991 // There are cases where we want to pump asynchronous messages while waiting |
990 // synchronously for the replies to the message to be sent here. However, this | 992 // synchronously for the replies to the message to be sent here. However, this |
991 // may create an opportunity for re-entrancy into WebKit and other subsystems, | 993 // may create an opportunity for re-entrancy into WebKit and other subsystems, |
992 // so we need to take care to disable callbacks, timers, and pending network | 994 // so we need to take care to disable callbacks, timers, and pending network |
993 // loads that could trigger such callbacks. | 995 // loads that could trigger such callbacks. |
994 bool pumping_events = false; | 996 bool pumping_events = false; |
995 if (msg->is_sync()) { | 997 if (msg->is_sync()) { |
996 if (msg->is_caller_pumping_messages()) { | 998 if (msg->is_caller_pumping_messages()) { |
997 pumping_events = true; | 999 pumping_events = true; |
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2223 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) | 2225 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) |
2224 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; | 2226 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; |
2225 | 2227 |
2226 blink::mainThreadIsolate()->MemoryPressureNotification( | 2228 blink::mainThreadIsolate()->MemoryPressureNotification( |
2227 v8_memory_pressure_level); | 2229 v8_memory_pressure_level); |
2228 blink::MemoryPressureNotificationToWorkerThreadIsolates( | 2230 blink::MemoryPressureNotificationToWorkerThreadIsolates( |
2229 v8_memory_pressure_level); | 2231 v8_memory_pressure_level); |
2230 } | 2232 } |
2231 | 2233 |
2232 } // namespace content | 2234 } // namespace content |
OLD | NEW |