| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 #include "content/renderer/render_process_impl.h" | 120 #include "content/renderer/render_process_impl.h" |
| 121 #include "content/renderer/render_view_impl.h" | 121 #include "content/renderer/render_view_impl.h" |
| 122 #include "content/renderer/renderer_blink_platform_impl.h" | 122 #include "content/renderer/renderer_blink_platform_impl.h" |
| 123 #include "content/renderer/scheduler/resource_dispatch_throttler.h" | 123 #include "content/renderer/scheduler/resource_dispatch_throttler.h" |
| 124 #include "content/renderer/service_worker/embedded_worker_dispatcher.h" | 124 #include "content/renderer/service_worker/embedded_worker_dispatcher.h" |
| 125 #include "content/renderer/service_worker/service_worker_context_client.h" | 125 #include "content/renderer/service_worker/service_worker_context_client.h" |
| 126 #include "content/renderer/service_worker/service_worker_context_message_filter.
h" | 126 #include "content/renderer/service_worker/service_worker_context_message_filter.
h" |
| 127 #include "content/renderer/shared_worker/embedded_shared_worker_stub.h" | 127 #include "content/renderer/shared_worker/embedded_shared_worker_stub.h" |
| 128 #include "gin/public/debug.h" | 128 #include "gin/public/debug.h" |
| 129 #include "gpu/GLES2/gl2extchromium.h" | 129 #include "gpu/GLES2/gl2extchromium.h" |
| 130 #include "gpu/command_buffer/client/shared_memory_limits.h" |
| 130 #include "gpu/ipc/client/gpu_channel_host.h" | 131 #include "gpu/ipc/client/gpu_channel_host.h" |
| 131 #include "ipc/ipc_channel_handle.h" | 132 #include "ipc/ipc_channel_handle.h" |
| 132 #include "ipc/ipc_platform_file.h" | 133 #include "ipc/ipc_platform_file.h" |
| 133 #include "ipc/mojo/ipc_channel_mojo.h" | 134 #include "ipc/mojo/ipc_channel_mojo.h" |
| 134 #include "media/base/audio_hardware_config.h" | 135 #include "media/base/audio_hardware_config.h" |
| 135 #include "media/base/media.h" | 136 #include "media/base/media.h" |
| 136 #include "media/renderers/gpu_video_accelerator_factories.h" | 137 #include "media/renderers/gpu_video_accelerator_factories.h" |
| 137 #include "mojo/common/common_type_converters.h" | 138 #include "mojo/common/common_type_converters.h" |
| 138 #include "mojo/public/cpp/bindings/strong_binding.h" | 139 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 139 #include "net/base/net_errors.h" | 140 #include "net/base/net_errors.h" |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 attributes.samples = 0; | 462 attributes.samples = 0; |
| 462 attributes.sample_buffers = 0; | 463 attributes.sample_buffers = 0; |
| 463 attributes.bind_generates_resource = false; | 464 attributes.bind_generates_resource = false; |
| 464 attributes.lose_context_when_out_of_memory = true; | 465 attributes.lose_context_when_out_of_memory = true; |
| 465 bool share_resources = true; | 466 bool share_resources = true; |
| 466 bool automatic_flushes = false; | 467 bool automatic_flushes = false; |
| 467 return base::WrapUnique(new WebGraphicsContext3DCommandBufferImpl( | 468 return base::WrapUnique(new WebGraphicsContext3DCommandBufferImpl( |
| 468 gpu::kNullSurfaceHandle, | 469 gpu::kNullSurfaceHandle, |
| 469 GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d"), | 470 GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d"), |
| 470 gpu_channel_host.get(), attributes, gfx::PreferIntegratedGpu, | 471 gpu_channel_host.get(), attributes, gfx::PreferIntegratedGpu, |
| 471 share_resources, automatic_flushes, | 472 share_resources, automatic_flushes, nullptr)); |
| 472 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), nullptr)); | |
| 473 } | 473 } |
| 474 | 474 |
| 475 } // namespace | 475 } // namespace |
| 476 | 476 |
| 477 // For measuring memory usage after each task. Behind a command line flag. | 477 // For measuring memory usage after each task. Behind a command line flag. |
| 478 class MemoryObserver : public base::MessageLoop::TaskObserver { | 478 class MemoryObserver : public base::MessageLoop::TaskObserver { |
| 479 public: | 479 public: |
| 480 MemoryObserver() {} | 480 MemoryObserver() {} |
| 481 ~MemoryObserver() override {} | 481 ~MemoryObserver() override {} |
| 482 | 482 |
| (...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1524 | 1524 |
| 1525 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( | 1525 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( |
| 1526 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); | 1526 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); |
| 1527 if (!gpu_channel_host) { | 1527 if (!gpu_channel_host) { |
| 1528 shared_main_thread_contexts_ = nullptr; | 1528 shared_main_thread_contexts_ = nullptr; |
| 1529 return nullptr; | 1529 return nullptr; |
| 1530 } | 1530 } |
| 1531 | 1531 |
| 1532 shared_main_thread_contexts_ = new ContextProviderCommandBuffer( | 1532 shared_main_thread_contexts_ = new ContextProviderCommandBuffer( |
| 1533 CreateOffscreenContext(std::move(gpu_channel_host)), | 1533 CreateOffscreenContext(std::move(gpu_channel_host)), |
| 1534 RENDERER_MAINTHREAD_CONTEXT); | 1534 gpu::SharedMemoryLimits(), RENDERER_MAINTHREAD_CONTEXT); |
| 1535 if (!shared_main_thread_contexts_->BindToCurrentThread()) | 1535 if (!shared_main_thread_contexts_->BindToCurrentThread()) |
| 1536 shared_main_thread_contexts_ = nullptr; | 1536 shared_main_thread_contexts_ = nullptr; |
| 1537 return shared_main_thread_contexts_; | 1537 return shared_main_thread_contexts_; |
| 1538 } | 1538 } |
| 1539 | 1539 |
| 1540 #if defined(OS_ANDROID) | 1540 #if defined(OS_ANDROID) |
| 1541 | 1541 |
| 1542 scoped_refptr<StreamTextureFactory> RenderThreadImpl::GetStreamTexureFactory() { | 1542 scoped_refptr<StreamTextureFactory> RenderThreadImpl::GetStreamTexureFactory() { |
| 1543 DCHECK(IsMainThread()); | 1543 DCHECK(IsMainThread()); |
| 1544 if (!stream_texture_factory_.get() || | 1544 if (!stream_texture_factory_.get() || |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2043 | 2043 |
| 2044 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( | 2044 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( |
| 2045 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); | 2045 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); |
| 2046 if (!gpu_channel_host) { | 2046 if (!gpu_channel_host) { |
| 2047 shared_worker_context_provider_ = nullptr; | 2047 shared_worker_context_provider_ = nullptr; |
| 2048 return shared_worker_context_provider_; | 2048 return shared_worker_context_provider_; |
| 2049 } | 2049 } |
| 2050 | 2050 |
| 2051 shared_worker_context_provider_ = new ContextProviderCommandBuffer( | 2051 shared_worker_context_provider_ = new ContextProviderCommandBuffer( |
| 2052 CreateOffscreenContext(std::move(gpu_channel_host)), | 2052 CreateOffscreenContext(std::move(gpu_channel_host)), |
| 2053 RENDER_WORKER_CONTEXT); | 2053 gpu::SharedMemoryLimits(), RENDER_WORKER_CONTEXT); |
| 2054 if (!shared_worker_context_provider_->BindToCurrentThread()) | 2054 if (!shared_worker_context_provider_->BindToCurrentThread()) |
| 2055 shared_worker_context_provider_ = nullptr; | 2055 shared_worker_context_provider_ = nullptr; |
| 2056 if (shared_worker_context_provider_) | 2056 if (shared_worker_context_provider_) |
| 2057 shared_worker_context_provider_->SetupLock(); | 2057 shared_worker_context_provider_->SetupLock(); |
| 2058 return shared_worker_context_provider_; | 2058 return shared_worker_context_provider_; |
| 2059 } | 2059 } |
| 2060 | 2060 |
| 2061 void RenderThreadImpl::SampleGamepads(blink::WebGamepads* data) { | 2061 void RenderThreadImpl::SampleGamepads(blink::WebGamepads* data) { |
| 2062 blink_platform_impl_->sampleGamepads(*data); | 2062 blink_platform_impl_->sampleGamepads(*data); |
| 2063 } | 2063 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2142 } | 2142 } |
| 2143 | 2143 |
| 2144 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { | 2144 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { |
| 2145 size_t erased = | 2145 size_t erased = |
| 2146 RenderThreadImpl::current()->pending_render_frame_connects_.erase( | 2146 RenderThreadImpl::current()->pending_render_frame_connects_.erase( |
| 2147 routing_id_); | 2147 routing_id_); |
| 2148 DCHECK_EQ(1u, erased); | 2148 DCHECK_EQ(1u, erased); |
| 2149 } | 2149 } |
| 2150 | 2150 |
| 2151 } // namespace content | 2151 } // namespace content |
| OLD | NEW |