| 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 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 are_image_decode_tasks_enabled_ = true; | 816 are_image_decode_tasks_enabled_ = true; |
| 817 | 817 |
| 818 categorized_worker_pool_->Start(num_raster_threads); | 818 categorized_worker_pool_->Start(num_raster_threads); |
| 819 | 819 |
| 820 // TODO(boliu): In single process, browser main loop should set up the | 820 // TODO(boliu): In single process, browser main loop should set up the |
| 821 // discardable memory manager, and should skip this if kSingleProcess. | 821 // discardable memory manager, and should skip this if kSingleProcess. |
| 822 // See crbug.com/503724. | 822 // See crbug.com/503724. |
| 823 base::DiscardableMemoryAllocator::SetInstance( | 823 base::DiscardableMemoryAllocator::SetInstance( |
| 824 ChildThreadImpl::discardable_shared_memory_manager()); | 824 ChildThreadImpl::discardable_shared_memory_manager()); |
| 825 | 825 |
| 826 GetContentClient()->renderer()->RegisterProcessMojoServices( | 826 GetContentClient()->renderer()->RegisterProcessMojoInterfaces( |
| 827 service_registry()); | 827 interface_registry()); |
| 828 | 828 |
| 829 service_registry()->AddService(base::Bind(CreateFrameFactory)); | 829 interface_registry()->AddInterface(base::Bind(CreateFrameFactory)); |
| 830 service_registry()->AddService(base::Bind(CreateEmbeddedWorkerSetup)); | 830 interface_registry()->AddInterface(base::Bind(CreateEmbeddedWorkerSetup)); |
| 831 | 831 |
| 832 #if defined(MOJO_SHELL_CLIENT) | 832 #if defined(MOJO_SHELL_CLIENT) |
| 833 // We may not have a MojoShellConnection object in tests that directly | 833 // We may not have a MojoShellConnection object in tests that directly |
| 834 // instantiate a RenderThreadImpl. | 834 // instantiate a RenderThreadImpl. |
| 835 if (MojoShellConnection::GetForProcess() && | 835 if (MojoShellConnection::GetForProcess() && |
| 836 base::CommandLine::ForCurrentProcess()->HasSwitch( | 836 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 837 switches::kUseMusInRenderer)) | 837 switches::kUseMusInRenderer)) |
| 838 CreateRenderWidgetWindowTreeClientFactory(); | 838 CreateRenderWidgetWindowTreeClientFactory(); |
| 839 #endif | 839 #endif |
| 840 | 840 |
| 841 service_registry()->ConnectToRemoteService( | 841 remote_interfaces()->GetInterface( |
| 842 mojo::GetProxy(&storage_partition_service_)); | 842 mojo::GetProxy(&storage_partition_service_)); |
| 843 | 843 |
| 844 is_renderer_suspended_ = false; | 844 is_renderer_suspended_ = false; |
| 845 } | 845 } |
| 846 | 846 |
| 847 RenderThreadImpl::~RenderThreadImpl() { | 847 RenderThreadImpl::~RenderThreadImpl() { |
| 848 } | 848 } |
| 849 | 849 |
| 850 void RenderThreadImpl::Shutdown() { | 850 void RenderThreadImpl::Shutdown() { |
| 851 FOR_EACH_OBSERVER( | 851 FOR_EACH_OBSERVER( |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1148 | 1148 |
| 1149 #ifdef ENABLE_VTUNE_JIT_INTERFACE | 1149 #ifdef ENABLE_VTUNE_JIT_INTERFACE |
| 1150 if (command_line.HasSwitch(switches::kEnableVtune)) | 1150 if (command_line.HasSwitch(switches::kEnableVtune)) |
| 1151 gin::Debug::SetJitCodeEventHandler(vTune::GetVtuneCodeEventHandler()); | 1151 gin::Debug::SetJitCodeEventHandler(vTune::GetVtuneCodeEventHandler()); |
| 1152 #endif | 1152 #endif |
| 1153 | 1153 |
| 1154 SetRuntimeFeaturesDefaultsAndUpdateFromArgs(command_line); | 1154 SetRuntimeFeaturesDefaultsAndUpdateFromArgs(command_line); |
| 1155 | 1155 |
| 1156 blink_platform_impl_.reset(new RendererBlinkPlatformImpl( | 1156 blink_platform_impl_.reset(new RendererBlinkPlatformImpl( |
| 1157 renderer_scheduler_.get(), | 1157 renderer_scheduler_.get(), |
| 1158 static_cast<ServiceRegistryImpl*>(service_registry())->GetWeakPtr())); | 1158 remote_interfaces()->GetWeakPtr())); |
| 1159 blink::initialize(blink_platform_impl_.get()); | 1159 blink::initialize(blink_platform_impl_.get()); |
| 1160 | 1160 |
| 1161 v8::Isolate* isolate = blink::mainThreadIsolate(); | 1161 v8::Isolate* isolate = blink::mainThreadIsolate(); |
| 1162 isolate->SetCreateHistogramFunction(CreateHistogram); | 1162 isolate->SetCreateHistogramFunction(CreateHistogram); |
| 1163 isolate->SetAddHistogramSampleFunction(AddHistogramSample); | 1163 isolate->SetAddHistogramSampleFunction(AddHistogramSample); |
| 1164 | 1164 |
| 1165 main_thread_compositor_task_runner_ = | 1165 main_thread_compositor_task_runner_ = |
| 1166 renderer_scheduler_->CompositorTaskRunner(); | 1166 renderer_scheduler_->CompositorTaskRunner(); |
| 1167 | 1167 |
| 1168 main_input_callback_.Reset( | 1168 main_input_callback_.Reset( |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1536 } | 1536 } |
| 1537 | 1537 |
| 1538 #if defined(OS_WIN) | 1538 #if defined(OS_WIN) |
| 1539 void RenderThreadImpl::PreCacheFontCharacters(const LOGFONT& log_font, | 1539 void RenderThreadImpl::PreCacheFontCharacters(const LOGFONT& log_font, |
| 1540 const base::string16& str) { | 1540 const base::string16& str) { |
| 1541 Send(new RenderProcessHostMsg_PreCacheFontCharacters(log_font, str)); | 1541 Send(new RenderProcessHostMsg_PreCacheFontCharacters(log_font, str)); |
| 1542 } | 1542 } |
| 1543 | 1543 |
| 1544 #endif // OS_WIN | 1544 #endif // OS_WIN |
| 1545 | 1545 |
| 1546 ServiceRegistry* RenderThreadImpl::GetServiceRegistry() { | 1546 shell::InterfaceRegistry* RenderThreadImpl::GetInterfaceRegistry() { |
| 1547 DCHECK(service_registry()); | 1547 DCHECK(interface_registry()); |
| 1548 return service_registry(); | 1548 return interface_registry(); |
| 1549 } |
| 1550 |
| 1551 shell::InterfaceProvider* RenderThreadImpl::GetRemoteInterfaces() { |
| 1552 DCHECK(remote_interfaces()); |
| 1553 return remote_interfaces(); |
| 1549 } | 1554 } |
| 1550 | 1555 |
| 1551 bool RenderThreadImpl::IsGpuRasterizationForced() { | 1556 bool RenderThreadImpl::IsGpuRasterizationForced() { |
| 1552 return is_gpu_rasterization_forced_; | 1557 return is_gpu_rasterization_forced_; |
| 1553 } | 1558 } |
| 1554 | 1559 |
| 1555 bool RenderThreadImpl::IsGpuRasterizationEnabled() { | 1560 bool RenderThreadImpl::IsGpuRasterizationEnabled() { |
| 1556 return is_gpu_rasterization_enabled_; | 1561 return is_gpu_rasterization_enabled_; |
| 1557 } | 1562 } |
| 1558 | 1563 |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2212 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) | 2217 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) |
| 2213 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; | 2218 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; |
| 2214 | 2219 |
| 2215 blink::mainThreadIsolate()->MemoryPressureNotification( | 2220 blink::mainThreadIsolate()->MemoryPressureNotification( |
| 2216 v8_memory_pressure_level); | 2221 v8_memory_pressure_level); |
| 2217 blink::MemoryPressureNotificationToWorkerThreadIsolates( | 2222 blink::MemoryPressureNotificationToWorkerThreadIsolates( |
| 2218 v8_memory_pressure_level); | 2223 v8_memory_pressure_level); |
| 2219 } | 2224 } |
| 2220 | 2225 |
| 2221 } // namespace content | 2226 } // namespace content |
| OLD | NEW |