| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 #include "gpu/command_buffer/client/shared_memory_limits.h" | 127 #include "gpu/command_buffer/client/shared_memory_limits.h" |
| 128 #include "gpu/ipc/client/command_buffer_proxy_impl.h" | 128 #include "gpu/ipc/client/command_buffer_proxy_impl.h" |
| 129 #include "gpu/ipc/client/gpu_channel_host.h" | 129 #include "gpu/ipc/client/gpu_channel_host.h" |
| 130 #include "ipc/ipc_channel_handle.h" | 130 #include "ipc/ipc_channel_handle.h" |
| 131 #include "ipc/ipc_channel_mojo.h" | 131 #include "ipc/ipc_channel_mojo.h" |
| 132 #include "ipc/ipc_platform_file.h" | 132 #include "ipc/ipc_platform_file.h" |
| 133 #include "media/base/media.h" | 133 #include "media/base/media.h" |
| 134 #include "media/media_features.h" | 134 #include "media/media_features.h" |
| 135 #include "media/renderers/gpu_video_accelerator_factories.h" | 135 #include "media/renderers/gpu_video_accelerator_factories.h" |
| 136 #include "mojo/common/common_type_converters.h" | 136 #include "mojo/common/common_type_converters.h" |
| 137 #include "mojo/public/cpp/bindings/strong_associated_binding.h" |
| 137 #include "mojo/public/cpp/bindings/strong_binding.h" | 138 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 138 #include "net/base/net_errors.h" | 139 #include "net/base/net_errors.h" |
| 139 #include "net/base/port_util.h" | 140 #include "net/base/port_util.h" |
| 140 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 141 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 141 #include "net/base/url_util.h" | 142 #include "net/base/url_util.h" |
| 142 #include "ppapi/features/features.h" | 143 #include "ppapi/features/features.h" |
| 143 #include "services/service_manager/public/cpp/connector.h" | 144 #include "services/service_manager/public/cpp/connector.h" |
| 144 #include "services/service_manager/public/cpp/interface_provider.h" | 145 #include "services/service_manager/public/cpp/interface_provider.h" |
| 145 #include "services/service_manager/public/cpp/interface_registry.h" | 146 #include "services/service_manager/public/cpp/interface_registry.h" |
| 146 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" | 147 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 | 383 |
| 383 void AttachServiceWorkerEventDispatcher( | 384 void AttachServiceWorkerEventDispatcher( |
| 384 int32_t thread_id, | 385 int32_t thread_id, |
| 385 mojom::ServiceWorkerEventDispatcherRequest request) override { | 386 mojom::ServiceWorkerEventDispatcherRequest request) override { |
| 386 WorkerThreadRegistry::Instance()->GetTaskRunnerFor(thread_id)->PostTask( | 387 WorkerThreadRegistry::Instance()->GetTaskRunnerFor(thread_id)->PostTask( |
| 387 FROM_HERE, | 388 FROM_HERE, |
| 388 base::Bind(&SetupEmbeddedWorkerOnWorkerThread, base::Passed(&request))); | 389 base::Bind(&SetupEmbeddedWorkerOnWorkerThread, base::Passed(&request))); |
| 389 } | 390 } |
| 390 }; | 391 }; |
| 391 | 392 |
| 392 void CreateEmbeddedWorkerSetup(mojom::EmbeddedWorkerSetupRequest request) { | 393 void CreateEmbeddedWorkerSetup( |
| 393 mojo::MakeStrongBinding(base::MakeUnique<EmbeddedWorkerSetupImpl>(), | 394 mojom::EmbeddedWorkerSetupAssociatedRequest request) { |
| 394 std::move(request)); | 395 mojo::MakeStrongAssociatedBinding(base::MakeUnique<EmbeddedWorkerSetupImpl>(), |
| 396 std::move(request)); |
| 395 } | 397 } |
| 396 | 398 |
| 397 scoped_refptr<ui::ContextProviderCommandBuffer> CreateOffscreenContext( | 399 scoped_refptr<ui::ContextProviderCommandBuffer> CreateOffscreenContext( |
| 398 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, | 400 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, |
| 399 const gpu::SharedMemoryLimits& limits, | 401 const gpu::SharedMemoryLimits& limits, |
| 400 bool support_locking, | 402 bool support_locking, |
| 401 ui::command_buffer_metrics::ContextType type, | 403 ui::command_buffer_metrics::ContextType type, |
| 402 int32_t stream_id, | 404 int32_t stream_id, |
| 403 gpu::GpuStreamPriority stream_priority) { | 405 gpu::GpuStreamPriority stream_priority) { |
| 404 DCHECK(gpu_channel_host); | 406 DCHECK(gpu_channel_host); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 | 745 |
| 744 // Must be called before RenderThreadStarted() below. | 746 // Must be called before RenderThreadStarted() below. |
| 745 StartServiceManagerConnection(); | 747 StartServiceManagerConnection(); |
| 746 | 748 |
| 747 GetContentClient()->renderer()->RenderThreadStarted(); | 749 GetContentClient()->renderer()->RenderThreadStarted(); |
| 748 | 750 |
| 749 GetAssociatedInterfaceRegistry()->AddInterface( | 751 GetAssociatedInterfaceRegistry()->AddInterface( |
| 750 base::Bind(&RenderThreadImpl::OnRendererInterfaceRequest, | 752 base::Bind(&RenderThreadImpl::OnRendererInterfaceRequest, |
| 751 base::Unretained(this))); | 753 base::Unretained(this))); |
| 752 | 754 |
| 755 GetAssociatedInterfaceRegistry()->AddInterface( |
| 756 base::Bind(&CreateEmbeddedWorkerSetup)); |
| 757 GetAssociatedInterfaceRegistry()->AddInterface( |
| 758 base::Bind(&EmbeddedWorkerInstanceClientImpl::Create, |
| 759 base::Unretained(embedded_worker_dispatcher_.get()))); |
| 760 |
| 753 InitSkiaEventTracer(); | 761 InitSkiaEventTracer(); |
| 754 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 762 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
| 755 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr); | 763 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr); |
| 756 | 764 |
| 757 const base::CommandLine& command_line = | 765 const base::CommandLine& command_line = |
| 758 *base::CommandLine::ForCurrentProcess(); | 766 *base::CommandLine::ForCurrentProcess(); |
| 759 | 767 |
| 760 #if defined(ENABLE_IPC_FUZZER) | 768 #if defined(ENABLE_IPC_FUZZER) |
| 761 if (command_line.HasSwitch(switches::kIpcDumpDirectory)) { | 769 if (command_line.HasSwitch(switches::kIpcDumpDirectory)) { |
| 762 base::FilePath dump_directory = | 770 base::FilePath dump_directory = |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 // TODO(boliu): In single process, browser main loop should set up the | 907 // TODO(boliu): In single process, browser main loop should set up the |
| 900 // discardable memory manager, and should skip this if kSingleProcess. | 908 // discardable memory manager, and should skip this if kSingleProcess. |
| 901 // See crbug.com/503724. | 909 // See crbug.com/503724. |
| 902 base::DiscardableMemoryAllocator::SetInstance( | 910 base::DiscardableMemoryAllocator::SetInstance( |
| 903 discardable_shared_memory_manager_.get()); | 911 discardable_shared_memory_manager_.get()); |
| 904 | 912 |
| 905 GetContentClient()->renderer()->ExposeInterfacesToBrowser( | 913 GetContentClient()->renderer()->ExposeInterfacesToBrowser( |
| 906 GetInterfaceRegistry()); | 914 GetInterfaceRegistry()); |
| 907 | 915 |
| 908 GetInterfaceRegistry()->AddInterface(base::Bind(&CreateFrameFactory)); | 916 GetInterfaceRegistry()->AddInterface(base::Bind(&CreateFrameFactory)); |
| 909 GetInterfaceRegistry()->AddInterface(base::Bind(&CreateEmbeddedWorkerSetup)); | |
| 910 GetInterfaceRegistry()->AddInterface( | |
| 911 base::Bind(&EmbeddedWorkerInstanceClientImpl::Create, | |
| 912 base::Unretained(embedded_worker_dispatcher_.get()))); | |
| 913 | 917 |
| 914 GetRemoteInterfaces()->GetInterface( | 918 GetRemoteInterfaces()->GetInterface( |
| 915 mojo::MakeRequest(&storage_partition_service_)); | 919 mojo::MakeRequest(&storage_partition_service_)); |
| 916 | 920 |
| 917 #if defined(OS_LINUX) | 921 #if defined(OS_LINUX) |
| 918 ChildProcess::current()->SetIOThreadPriority(base::ThreadPriority::DISPLAY); | 922 ChildProcess::current()->SetIOThreadPriority(base::ThreadPriority::DISPLAY); |
| 919 ChildThreadImpl::current()->SetThreadPriority( | 923 ChildThreadImpl::current()->SetThreadPriority( |
| 920 categorized_worker_pool_->background_worker_thread_id(), | 924 categorized_worker_pool_->background_worker_thread_id(), |
| 921 base::ThreadPriority::BACKGROUND); | 925 base::ThreadPriority::BACKGROUND); |
| 922 #endif | 926 #endif |
| (...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2502 } | 2506 } |
| 2503 } | 2507 } |
| 2504 | 2508 |
| 2505 void RenderThreadImpl::OnRendererInterfaceRequest( | 2509 void RenderThreadImpl::OnRendererInterfaceRequest( |
| 2506 mojom::RendererAssociatedRequest request) { | 2510 mojom::RendererAssociatedRequest request) { |
| 2507 DCHECK(!renderer_binding_.is_bound()); | 2511 DCHECK(!renderer_binding_.is_bound()); |
| 2508 renderer_binding_.Bind(std::move(request)); | 2512 renderer_binding_.Bind(std::move(request)); |
| 2509 } | 2513 } |
| 2510 | 2514 |
| 2511 } // namespace content | 2515 } // namespace content |
| OLD | NEW |