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