Chromium Code Reviews| 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 <vector> | 10 #include <vector> |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 #include "content/common/content_constants_internal.h" | 60 #include "content/common/content_constants_internal.h" |
| 61 #include "content/common/database_messages.h" | 61 #include "content/common/database_messages.h" |
| 62 #include "content/common/dom_storage/dom_storage_messages.h" | 62 #include "content/common/dom_storage/dom_storage_messages.h" |
| 63 #include "content/common/frame_messages.h" | 63 #include "content/common/frame_messages.h" |
| 64 #include "content/common/gpu/client/context_provider_command_buffer.h" | 64 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 65 #include "content/common/gpu/client/gpu_channel_host.h" | 65 #include "content/common/gpu/client/gpu_channel_host.h" |
| 66 #include "content/common/gpu/gpu_messages.h" | 66 #include "content/common/gpu/gpu_messages.h" |
| 67 #include "content/common/gpu/gpu_process_launch_causes.h" | 67 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 68 #include "content/common/render_frame_setup.mojom.h" | 68 #include "content/common/render_frame_setup.mojom.h" |
| 69 #include "content/common/resource_messages.h" | 69 #include "content/common/resource_messages.h" |
| 70 #include "content/common/service_worker/embedded_worker_setup.mojom.h" | |
| 70 #include "content/common/view_messages.h" | 71 #include "content/common/view_messages.h" |
| 71 #include "content/common/worker_messages.h" | 72 #include "content/common/worker_messages.h" |
| 72 #include "content/public/common/content_constants.h" | 73 #include "content/public/common/content_constants.h" |
| 73 #include "content/public/common/content_paths.h" | 74 #include "content/public/common/content_paths.h" |
| 74 #include "content/public/common/content_switches.h" | 75 #include "content/public/common/content_switches.h" |
| 75 #include "content/public/common/mojo_channel_switches.h" | 76 #include "content/public/common/mojo_channel_switches.h" |
| 76 #include "content/public/common/renderer_preferences.h" | 77 #include "content/public/common/renderer_preferences.h" |
| 77 #include "content/public/common/url_constants.h" | 78 #include "content/public/common/url_constants.h" |
| 78 #include "content/public/renderer/content_renderer_client.h" | 79 #include "content/public/renderer/content_renderer_client.h" |
| 79 #include "content/public/renderer/render_process_observer.h" | 80 #include "content/public/renderer/render_process_observer.h" |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 103 #include "content/renderer/media/video_capture_impl_manager.h" | 104 #include "content/renderer/media/video_capture_impl_manager.h" |
| 104 #include "content/renderer/media/video_capture_message_filter.h" | 105 #include "content/renderer/media/video_capture_message_filter.h" |
| 105 #include "content/renderer/net_info_helper.h" | 106 #include "content/renderer/net_info_helper.h" |
| 106 #include "content/renderer/p2p/socket_dispatcher.h" | 107 #include "content/renderer/p2p/socket_dispatcher.h" |
| 107 #include "content/renderer/render_frame_proxy.h" | 108 #include "content/renderer/render_frame_proxy.h" |
| 108 #include "content/renderer/render_process_impl.h" | 109 #include "content/renderer/render_process_impl.h" |
| 109 #include "content/renderer/render_view_impl.h" | 110 #include "content/renderer/render_view_impl.h" |
| 110 #include "content/renderer/renderer_blink_platform_impl.h" | 111 #include "content/renderer/renderer_blink_platform_impl.h" |
| 111 #include "content/renderer/scheduler/resource_dispatch_throttler.h" | 112 #include "content/renderer/scheduler/resource_dispatch_throttler.h" |
| 112 #include "content/renderer/service_worker/embedded_worker_dispatcher.h" | 113 #include "content/renderer/service_worker/embedded_worker_dispatcher.h" |
| 114 #include "content/renderer/service_worker/service_worker_context_client.h" | |
| 113 #include "content/renderer/service_worker/service_worker_context_message_filter. h" | 115 #include "content/renderer/service_worker/service_worker_context_message_filter. h" |
| 114 #include "content/renderer/shared_worker/embedded_shared_worker_stub.h" | 116 #include "content/renderer/shared_worker/embedded_shared_worker_stub.h" |
| 115 #include "gin/public/debug.h" | 117 #include "gin/public/debug.h" |
| 116 #include "gpu/GLES2/gl2extchromium.h" | 118 #include "gpu/GLES2/gl2extchromium.h" |
| 117 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 119 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 118 #include "ipc/ipc_channel_handle.h" | 120 #include "ipc/ipc_channel_handle.h" |
| 119 #include "ipc/ipc_platform_file.h" | 121 #include "ipc/ipc_platform_file.h" |
| 120 #include "ipc/mojo/ipc_channel_mojo.h" | 122 #include "ipc/mojo/ipc_channel_mojo.h" |
| 121 #include "media/base/audio_hardware_config.h" | 123 #include "media/base/audio_hardware_config.h" |
| 122 #include "media/base/media.h" | 124 #include "media/base/media.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 blink::WebGraphicsContext3D::Attributes GetOffscreenAttribs() { | 372 blink::WebGraphicsContext3D::Attributes GetOffscreenAttribs() { |
| 371 blink::WebGraphicsContext3D::Attributes attributes; | 373 blink::WebGraphicsContext3D::Attributes attributes; |
| 372 attributes.shareResources = true; | 374 attributes.shareResources = true; |
| 373 attributes.depth = false; | 375 attributes.depth = false; |
| 374 attributes.stencil = false; | 376 attributes.stencil = false; |
| 375 attributes.antialias = false; | 377 attributes.antialias = false; |
| 376 attributes.noAutomaticFlushes = true; | 378 attributes.noAutomaticFlushes = true; |
| 377 return attributes; | 379 return attributes; |
| 378 } | 380 } |
| 379 | 381 |
| 382 void SetupEmbeddedWorkerOnWorkerThread( | |
| 383 mojo::InterfaceRequest<mojo::ServiceProvider> services, | |
| 384 mojo::ServiceProviderPtr exposed_services) { | |
| 385 ServiceWorkerContextClient* client = | |
| 386 ServiceWorkerContextClient::ThreadSpecificInstance(); | |
| 387 DCHECK(client); | |
|
kinuko
2015/07/08 08:32:41
It feels it's possible to end up with null client
| |
| 388 client->BindServiceRegistry(services.Pass(), exposed_services.Pass()); | |
| 389 } | |
| 390 | |
| 391 class EmbeddedWorkerSetupImpl : public EmbeddedWorkerSetup { | |
| 392 public: | |
| 393 explicit EmbeddedWorkerSetupImpl( | |
| 394 mojo::InterfaceRequest<EmbeddedWorkerSetup> request) | |
| 395 : binding_(this, request.Pass()) {} | |
| 396 | |
| 397 void ExchangeServiceProviders( | |
| 398 int32_t thread_id, | |
| 399 mojo::InterfaceRequest<mojo::ServiceProvider> services, | |
| 400 mojo::ServiceProviderPtr exposed_services) override { | |
| 401 WorkerTaskRunner::Instance()->GetTaskRunnerFor(thread_id)->PostTask( | |
| 402 FROM_HERE, | |
| 403 base::Bind(&SetupEmbeddedWorkerOnWorkerThread, base::Passed(&services), | |
| 404 base::Passed(&exposed_services))); | |
| 405 } | |
| 406 | |
| 407 private: | |
| 408 mojo::StrongBinding<EmbeddedWorkerSetup> binding_; | |
| 409 }; | |
| 410 | |
| 411 void CreateEmbeddedWorkerSetup( | |
| 412 mojo::InterfaceRequest<EmbeddedWorkerSetup> request) { | |
| 413 new EmbeddedWorkerSetupImpl(request.Pass()); | |
| 414 } | |
| 415 | |
| 380 } // namespace | 416 } // namespace |
| 381 | 417 |
| 382 class RasterWorkerPool : public base::SequencedTaskRunner, | 418 class RasterWorkerPool : public base::SequencedTaskRunner, |
| 383 public base::DelegateSimpleThread::Delegate { | 419 public base::DelegateSimpleThread::Delegate { |
| 384 public: | 420 public: |
| 385 RasterWorkerPool() | 421 RasterWorkerPool() |
| 386 : namespace_token_(task_graph_runner_.GetNamespaceToken()) {} | 422 : namespace_token_(task_graph_runner_.GetNamespaceToken()) {} |
| 387 | 423 |
| 388 void Start(int num_threads, | 424 void Start(int num_threads, |
| 389 const base::SimpleThread::Options& thread_options) { | 425 const base::SimpleThread::Options& thread_options) { |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 778 raster_worker_pool_->Start(num_raster_threads, thread_options); | 814 raster_worker_pool_->Start(num_raster_threads, thread_options); |
| 779 | 815 |
| 780 // TODO(boliu): In single process, browser main loop should set up the | 816 // TODO(boliu): In single process, browser main loop should set up the |
| 781 // discardable memory manager, and should skip this if kSingleProcess. | 817 // discardable memory manager, and should skip this if kSingleProcess. |
| 782 // See crbug.com/503724. | 818 // See crbug.com/503724. |
| 783 base::DiscardableMemoryAllocator::SetInstance( | 819 base::DiscardableMemoryAllocator::SetInstance( |
| 784 ChildThreadImpl::discardable_shared_memory_manager()); | 820 ChildThreadImpl::discardable_shared_memory_manager()); |
| 785 | 821 |
| 786 service_registry()->AddService<RenderFrameSetup>( | 822 service_registry()->AddService<RenderFrameSetup>( |
| 787 base::Bind(CreateRenderFrameSetup)); | 823 base::Bind(CreateRenderFrameSetup)); |
| 824 service_registry()->AddService<EmbeddedWorkerSetup>( | |
| 825 base::Bind(CreateEmbeddedWorkerSetup)); | |
| 788 | 826 |
| 789 TRACE_EVENT_END_ETW("RenderThreadImpl::Init", 0, ""); | 827 TRACE_EVENT_END_ETW("RenderThreadImpl::Init", 0, ""); |
| 790 } | 828 } |
| 791 | 829 |
| 792 RenderThreadImpl::~RenderThreadImpl() { | 830 RenderThreadImpl::~RenderThreadImpl() { |
| 793 } | 831 } |
| 794 | 832 |
| 795 void RenderThreadImpl::Shutdown() { | 833 void RenderThreadImpl::Shutdown() { |
| 796 FOR_EACH_OBSERVER( | 834 FOR_EACH_OBSERVER( |
| 797 RenderProcessObserver, observers_, OnRenderProcessShutdown()); | 835 RenderProcessObserver, observers_, OnRenderProcessShutdown()); |
| (...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1971 } | 2009 } |
| 1972 | 2010 |
| 1973 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { | 2011 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { |
| 1974 size_t erased = | 2012 size_t erased = |
| 1975 RenderThreadImpl::current()->pending_render_frame_connects_.erase( | 2013 RenderThreadImpl::current()->pending_render_frame_connects_.erase( |
| 1976 routing_id_); | 2014 routing_id_); |
| 1977 DCHECK_EQ(1u, erased); | 2015 DCHECK_EQ(1u, erased); |
| 1978 } | 2016 } |
| 1979 | 2017 |
| 1980 } // namespace content | 2018 } // namespace content |
| OLD | NEW |