| 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 namespace { | 1542 namespace { |
| 1543 base::LazyInstance<scoped_refptr<StreamTextureFactory>> | 1543 base::LazyInstance<scoped_refptr<StreamTextureFactory>> |
| 1544 g_stream_texture_factory_override; | 1544 g_stream_texture_factory_override; |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2057 | 2057 |
| 2058 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( | 2058 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( |
| 2059 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); | 2059 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); |
| 2060 if (!gpu_channel_host) { | 2060 if (!gpu_channel_host) { |
| 2061 shared_worker_context_provider_ = nullptr; | 2061 shared_worker_context_provider_ = nullptr; |
| 2062 return shared_worker_context_provider_; | 2062 return shared_worker_context_provider_; |
| 2063 } | 2063 } |
| 2064 | 2064 |
| 2065 shared_worker_context_provider_ = new ContextProviderCommandBuffer( | 2065 shared_worker_context_provider_ = new ContextProviderCommandBuffer( |
| 2066 CreateOffscreenContext(std::move(gpu_channel_host)), | 2066 CreateOffscreenContext(std::move(gpu_channel_host)), |
| 2067 RENDER_WORKER_CONTEXT); | 2067 gpu::SharedMemoryLimits(), RENDER_WORKER_CONTEXT); |
| 2068 if (!shared_worker_context_provider_->BindToCurrentThread()) | 2068 if (!shared_worker_context_provider_->BindToCurrentThread()) |
| 2069 shared_worker_context_provider_ = nullptr; | 2069 shared_worker_context_provider_ = nullptr; |
| 2070 if (shared_worker_context_provider_) | 2070 if (shared_worker_context_provider_) |
| 2071 shared_worker_context_provider_->SetupLock(); | 2071 shared_worker_context_provider_->SetupLock(); |
| 2072 return shared_worker_context_provider_; | 2072 return shared_worker_context_provider_; |
| 2073 } | 2073 } |
| 2074 | 2074 |
| 2075 void RenderThreadImpl::SampleGamepads(blink::WebGamepads* data) { | 2075 void RenderThreadImpl::SampleGamepads(blink::WebGamepads* data) { |
| 2076 blink_platform_impl_->sampleGamepads(*data); | 2076 blink_platform_impl_->sampleGamepads(*data); |
| 2077 } | 2077 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2156 } | 2156 } |
| 2157 | 2157 |
| 2158 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { | 2158 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { |
| 2159 size_t erased = | 2159 size_t erased = |
| 2160 RenderThreadImpl::current()->pending_render_frame_connects_.erase( | 2160 RenderThreadImpl::current()->pending_render_frame_connects_.erase( |
| 2161 routing_id_); | 2161 routing_id_); |
| 2162 DCHECK_EQ(1u, erased); | 2162 DCHECK_EQ(1u, erased); |
| 2163 } | 2163 } |
| 2164 | 2164 |
| 2165 } // namespace content | 2165 } // namespace content |
| OLD | NEW |