| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "cc/output/vulkan_in_process_context_provider.h" | 49 #include "cc/output/vulkan_in_process_context_provider.h" |
| 50 #include "cc/raster/task_graph_runner.h" | 50 #include "cc/raster/task_graph_runner.h" |
| 51 #include "cc/trees/layer_tree_host_common.h" | 51 #include "cc/trees/layer_tree_host_common.h" |
| 52 #include "cc/trees/layer_tree_settings.h" | 52 #include "cc/trees/layer_tree_settings.h" |
| 53 #include "components/discardable_memory/client/client_discardable_shared_memory_
manager.h" | 53 #include "components/discardable_memory/client/client_discardable_shared_memory_
manager.h" |
| 54 #include "content/child/appcache/appcache_dispatcher.h" | 54 #include "content/child/appcache/appcache_dispatcher.h" |
| 55 #include "content/child/appcache/appcache_frontend_impl.h" | 55 #include "content/child/appcache/appcache_frontend_impl.h" |
| 56 #include "content/child/blob_storage/blob_message_filter.h" | 56 #include "content/child/blob_storage/blob_message_filter.h" |
| 57 #include "content/child/child_histogram_message_filter.h" | 57 #include "content/child/child_histogram_message_filter.h" |
| 58 #include "content/child/child_resource_message_filter.h" | 58 #include "content/child/child_resource_message_filter.h" |
| 59 #include "content/child/child_shared_bitmap_manager.h" | |
| 60 #include "content/child/content_child_helpers.h" | 59 #include "content/child/content_child_helpers.h" |
| 61 #include "content/child/db_message_filter.h" | 60 #include "content/child/db_message_filter.h" |
| 62 #include "content/child/indexed_db/indexed_db_dispatcher.h" | 61 #include "content/child/indexed_db/indexed_db_dispatcher.h" |
| 63 #include "content/child/memory/child_memory_coordinator_impl.h" | 62 #include "content/child/memory/child_memory_coordinator_impl.h" |
| 64 #include "content/child/resource_dispatcher.h" | 63 #include "content/child/resource_dispatcher.h" |
| 65 #include "content/child/resource_scheduling_filter.h" | 64 #include "content/child/resource_scheduling_filter.h" |
| 66 #include "content/child/runtime_features.h" | 65 #include "content/child/runtime_features.h" |
| 67 #include "content/child/thread_safe_sender.h" | 66 #include "content/child/thread_safe_sender.h" |
| 68 #include "content/child/web_database_observer_impl.h" | 67 #include "content/child/web_database_observer_impl.h" |
| 69 #include "content/child/worker_thread_registry.h" | 68 #include "content/child/worker_thread_registry.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 #include "media/renderers/gpu_video_accelerator_factories.h" | 137 #include "media/renderers/gpu_video_accelerator_factories.h" |
| 139 #include "mojo/public/cpp/bindings/strong_binding.h" | 138 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 140 #include "net/base/net_errors.h" | 139 #include "net/base/net_errors.h" |
| 141 #include "net/base/port_util.h" | 140 #include "net/base/port_util.h" |
| 142 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 141 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 143 #include "net/base/url_util.h" | 142 #include "net/base/url_util.h" |
| 144 #include "ppapi/features/features.h" | 143 #include "ppapi/features/features.h" |
| 145 #include "services/service_manager/public/cpp/connector.h" | 144 #include "services/service_manager/public/cpp/connector.h" |
| 146 #include "services/service_manager/public/cpp/interface_provider.h" | 145 #include "services/service_manager/public/cpp/interface_provider.h" |
| 147 #include "services/service_manager/public/cpp/interface_registry.h" | 146 #include "services/service_manager/public/cpp/interface_registry.h" |
| 147 #include "services/ui/public/cpp/bitmap/child_shared_bitmap_manager.h" |
| 148 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" | 148 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" |
| 149 #include "services/ui/public/interfaces/constants.mojom.h" | 149 #include "services/ui/public/interfaces/constants.mojom.h" |
| 150 #include "skia/ext/event_tracer_impl.h" | 150 #include "skia/ext/event_tracer_impl.h" |
| 151 #include "skia/ext/skia_memory_dump_provider.h" | 151 #include "skia/ext/skia_memory_dump_provider.h" |
| 152 #include "third_party/WebKit/public/platform/WebCache.h" | 152 #include "third_party/WebKit/public/platform/WebCache.h" |
| 153 #include "third_party/WebKit/public/platform/WebImageGenerator.h" | 153 #include "third_party/WebKit/public/platform/WebImageGenerator.h" |
| 154 #include "third_party/WebKit/public/platform/WebMemoryCoordinator.h" | 154 #include "third_party/WebKit/public/platform/WebMemoryCoordinator.h" |
| 155 #include "third_party/WebKit/public/platform/WebNetworkStateNotifier.h" | 155 #include "third_party/WebKit/public/platform/WebNetworkStateNotifier.h" |
| 156 #include "third_party/WebKit/public/platform/WebString.h" | 156 #include "third_party/WebKit/public/platform/WebString.h" |
| 157 #include "third_party/WebKit/public/platform/WebThread.h" | 157 #include "third_party/WebKit/public/platform/WebThread.h" |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 | 548 |
| 549 // static | 549 // static |
| 550 mojom::RenderMessageFilter* RenderThreadImpl::current_render_message_filter() { | 550 mojom::RenderMessageFilter* RenderThreadImpl::current_render_message_filter() { |
| 551 if (g_render_message_filter_for_testing) | 551 if (g_render_message_filter_for_testing) |
| 552 return g_render_message_filter_for_testing; | 552 return g_render_message_filter_for_testing; |
| 553 DCHECK(current()); | 553 DCHECK(current()); |
| 554 return current()->render_message_filter(); | 554 return current()->render_message_filter(); |
| 555 } | 555 } |
| 556 | 556 |
| 557 // static | 557 // static |
| 558 const scoped_refptr<mojom::ThreadSafeRenderMessageFilterAssociatedPtr>& | |
| 559 RenderThreadImpl::current_thread_safe_render_message_filter() { | |
| 560 DCHECK(current()); | |
| 561 return current()->thread_safe_render_message_filter(); | |
| 562 } | |
| 563 | |
| 564 // static | |
| 565 void RenderThreadImpl::SetRenderMessageFilterForTesting( | 558 void RenderThreadImpl::SetRenderMessageFilterForTesting( |
| 566 mojom::RenderMessageFilter* render_message_filter) { | 559 mojom::RenderMessageFilter* render_message_filter) { |
| 567 g_render_message_filter_for_testing = render_message_filter; | 560 g_render_message_filter_for_testing = render_message_filter; |
| 568 } | 561 } |
| 569 | 562 |
| 570 // In single-process mode used for debugging, we don't pass a renderer client | 563 // In single-process mode used for debugging, we don't pass a renderer client |
| 571 // ID via command line because RenderThreadImpl lives in the same process as | 564 // ID via command line because RenderThreadImpl lives in the same process as |
| 572 // the browser | 565 // the browser |
| 573 RenderThreadImpl::RenderThreadImpl( | 566 RenderThreadImpl::RenderThreadImpl( |
| 574 const InProcessChildThreadParams& params, | 567 const InProcessChildThreadParams& params, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 lazy_tls.Pointer()->Set(this); | 621 lazy_tls.Pointer()->Set(this); |
| 629 | 622 |
| 630 // Register this object as the main thread. | 623 // Register this object as the main thread. |
| 631 ChildProcess::current()->set_main_thread(this); | 624 ChildProcess::current()->set_main_thread(this); |
| 632 | 625 |
| 633 gpu_ = ui::Gpu::Create( | 626 gpu_ = ui::Gpu::Create( |
| 634 GetConnector(), | 627 GetConnector(), |
| 635 IsRunningInMash() ? ui::mojom::kServiceName : mojom::kBrowserServiceName, | 628 IsRunningInMash() ? ui::mojom::kServiceName : mojom::kBrowserServiceName, |
| 636 GetIOTaskRunner()); | 629 GetIOTaskRunner()); |
| 637 | 630 |
| 638 channel()->GetThreadSafeRemoteAssociatedInterface( | 631 cc::mojom::SharedBitmapManagerAssociatedPtr shared_bitmap_manager_ptr; |
| 639 &thread_safe_render_message_filter_); | 632 render_message_filter()->GetSharedBitmapManager( |
| 640 shared_bitmap_manager_.reset( | 633 mojo::MakeRequest(&shared_bitmap_manager_ptr)); |
| 641 new ChildSharedBitmapManager(thread_safe_render_message_filter_)); | 634 shared_bitmap_manager_.reset(new ui::ChildSharedBitmapManager( |
| 635 cc::mojom::ThreadSafeSharedBitmapManagerAssociatedPtr::Create( |
| 636 shared_bitmap_manager_ptr.PassInterface(), |
| 637 GetChannel()->ipc_task_runner_refptr()))); |
| 642 | 638 |
| 643 InitializeWebKit(resource_task_queue); | 639 InitializeWebKit(resource_task_queue); |
| 644 | 640 |
| 645 // In single process the single process is all there is. | 641 // In single process the single process is all there is. |
| 646 webkit_shared_timer_suspended_ = false; | 642 webkit_shared_timer_suspended_ = false; |
| 647 widget_count_ = 0; | 643 widget_count_ = 0; |
| 648 hidden_widget_count_ = 0; | 644 hidden_widget_count_ = 0; |
| 649 idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs; | 645 idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs; |
| 650 idle_notifications_to_skip_ = 0; | 646 idle_notifications_to_skip_ = 0; |
| 651 | 647 |
| (...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2068 GetChannel()->GetRemoteAssociatedInterface(&render_frame_message_filter_); | 2064 GetChannel()->GetRemoteAssociatedInterface(&render_frame_message_filter_); |
| 2069 return render_frame_message_filter_.get(); | 2065 return render_frame_message_filter_.get(); |
| 2070 } | 2066 } |
| 2071 | 2067 |
| 2072 mojom::RenderMessageFilter* RenderThreadImpl::render_message_filter() { | 2068 mojom::RenderMessageFilter* RenderThreadImpl::render_message_filter() { |
| 2073 if (!render_message_filter_) | 2069 if (!render_message_filter_) |
| 2074 GetChannel()->GetRemoteAssociatedInterface(&render_message_filter_); | 2070 GetChannel()->GetRemoteAssociatedInterface(&render_message_filter_); |
| 2075 return render_message_filter_.get(); | 2071 return render_message_filter_.get(); |
| 2076 } | 2072 } |
| 2077 | 2073 |
| 2078 const scoped_refptr<mojom::ThreadSafeRenderMessageFilterAssociatedPtr>& | |
| 2079 RenderThreadImpl::thread_safe_render_message_filter() { | |
| 2080 return thread_safe_render_message_filter_; | |
| 2081 } | |
| 2082 | |
| 2083 gpu::GpuChannelHost* RenderThreadImpl::GetGpuChannel() { | 2074 gpu::GpuChannelHost* RenderThreadImpl::GetGpuChannel() { |
| 2084 if (!gpu_channel_) | 2075 if (!gpu_channel_) |
| 2085 return nullptr; | 2076 return nullptr; |
| 2086 if (gpu_channel_->IsLost()) | 2077 if (gpu_channel_->IsLost()) |
| 2087 return nullptr; | 2078 return nullptr; |
| 2088 return gpu_channel_.get(); | 2079 return gpu_channel_.get(); |
| 2089 } | 2080 } |
| 2090 | 2081 |
| 2091 void RenderThreadImpl::OnFieldTrialGroupFinalized( | 2082 void RenderThreadImpl::OnFieldTrialGroupFinalized( |
| 2092 const std::string& trial_name, | 2083 const std::string& trial_name, |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2474 } | 2465 } |
| 2475 } | 2466 } |
| 2476 | 2467 |
| 2477 void RenderThreadImpl::OnRendererInterfaceRequest( | 2468 void RenderThreadImpl::OnRendererInterfaceRequest( |
| 2478 mojom::RendererAssociatedRequest request) { | 2469 mojom::RendererAssociatedRequest request) { |
| 2479 DCHECK(!renderer_binding_.is_bound()); | 2470 DCHECK(!renderer_binding_.is_bound()); |
| 2480 renderer_binding_.Bind(std::move(request)); | 2471 renderer_binding_.Bind(std::move(request)); |
| 2481 } | 2472 } |
| 2482 | 2473 |
| 2483 } // namespace content | 2474 } // namespace content |
| OLD | NEW |