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