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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 #include "content/child/thread_safe_sender.h" | 67 #include "content/child/thread_safe_sender.h" |
68 #include "content/child/web_database_observer_impl.h" | 68 #include "content/child/web_database_observer_impl.h" |
69 #include "content/child/worker_thread_registry.h" | 69 #include "content/child/worker_thread_registry.h" |
70 #include "content/common/child_process_messages.h" | 70 #include "content/common/child_process_messages.h" |
71 #include "content/common/content_constants_internal.h" | 71 #include "content/common/content_constants_internal.h" |
72 #include "content/common/database_messages.h" | 72 #include "content/common/database_messages.h" |
73 #include "content/common/dom_storage/dom_storage_messages.h" | 73 #include "content/common/dom_storage/dom_storage_messages.h" |
74 #include "content/common/frame_messages.h" | 74 #include "content/common/frame_messages.h" |
75 #include "content/common/gpu/client/context_provider_command_buffer.h" | 75 #include "content/common/gpu/client/context_provider_command_buffer.h" |
76 #include "content/common/gpu/client/gpu_channel_host.h" | 76 #include "content/common/gpu/client/gpu_channel_host.h" |
77 #include "content/common/gpu/gpu_process_launch_causes.h" | |
78 #include "content/common/render_frame_setup.mojom.h" | 77 #include "content/common/render_frame_setup.mojom.h" |
79 #include "content/common/render_process_messages.h" | 78 #include "content/common/render_process_messages.h" |
80 #include "content/common/resource_messages.h" | 79 #include "content/common/resource_messages.h" |
81 #include "content/common/service_worker/embedded_worker_setup.mojom.h" | 80 #include "content/common/service_worker/embedded_worker_setup.mojom.h" |
82 #include "content/common/view_messages.h" | 81 #include "content/common/view_messages.h" |
83 #include "content/common/worker_messages.h" | 82 #include "content/common/worker_messages.h" |
84 #include "content/public/common/content_constants.h" | 83 #include "content/public/common/content_constants.h" |
85 #include "content/public/common/content_paths.h" | 84 #include "content/public/common/content_paths.h" |
86 #include "content/public/common/content_switches.h" | 85 #include "content/public/common/content_switches.h" |
87 #include "content/public/common/mojo_channel_switches.h" | 86 #include "content/public/common/mojo_channel_switches.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 #include "content/renderer/render_process_impl.h" | 121 #include "content/renderer/render_process_impl.h" |
123 #include "content/renderer/render_view_impl.h" | 122 #include "content/renderer/render_view_impl.h" |
124 #include "content/renderer/renderer_blink_platform_impl.h" | 123 #include "content/renderer/renderer_blink_platform_impl.h" |
125 #include "content/renderer/scheduler/resource_dispatch_throttler.h" | 124 #include "content/renderer/scheduler/resource_dispatch_throttler.h" |
126 #include "content/renderer/service_worker/embedded_worker_dispatcher.h" | 125 #include "content/renderer/service_worker/embedded_worker_dispatcher.h" |
127 #include "content/renderer/service_worker/service_worker_context_client.h" | 126 #include "content/renderer/service_worker/service_worker_context_client.h" |
128 #include "content/renderer/service_worker/service_worker_context_message_filter.
h" | 127 #include "content/renderer/service_worker/service_worker_context_message_filter.
h" |
129 #include "content/renderer/shared_worker/embedded_shared_worker_stub.h" | 128 #include "content/renderer/shared_worker/embedded_shared_worker_stub.h" |
130 #include "gin/public/debug.h" | 129 #include "gin/public/debug.h" |
131 #include "gpu/GLES2/gl2extchromium.h" | 130 #include "gpu/GLES2/gl2extchromium.h" |
| 131 #include "gpu/ipc/common/gpu_process_launch_causes.h" |
132 #include "ipc/ipc_channel_handle.h" | 132 #include "ipc/ipc_channel_handle.h" |
133 #include "ipc/ipc_platform_file.h" | 133 #include "ipc/ipc_platform_file.h" |
134 #include "ipc/mojo/ipc_channel_mojo.h" | 134 #include "ipc/mojo/ipc_channel_mojo.h" |
135 #include "media/base/audio_hardware_config.h" | 135 #include "media/base/audio_hardware_config.h" |
136 #include "media/base/media.h" | 136 #include "media/base/media.h" |
137 #include "media/renderers/gpu_video_accelerator_factories.h" | 137 #include "media/renderers/gpu_video_accelerator_factories.h" |
138 #include "mojo/common/common_type_converters.h" | 138 #include "mojo/common/common_type_converters.h" |
139 #include "mojo/public/cpp/bindings/strong_binding.h" | 139 #include "mojo/public/cpp/bindings/strong_binding.h" |
140 #include "net/base/net_errors.h" | 140 #include "net/base/net_errors.h" |
141 #include "net/base/port_util.h" | 141 #include "net/base/port_util.h" |
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1518 } | 1518 } |
1519 return nullptr; | 1519 return nullptr; |
1520 } | 1520 } |
1521 | 1521 |
1522 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> | 1522 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
1523 RenderThreadImpl::CreateOffscreenContext3d() { | 1523 RenderThreadImpl::CreateOffscreenContext3d() { |
1524 blink::WebGraphicsContext3D::Attributes attributes(GetOffscreenAttribs()); | 1524 blink::WebGraphicsContext3D::Attributes attributes(GetOffscreenAttribs()); |
1525 bool lose_context_when_out_of_memory = true; | 1525 bool lose_context_when_out_of_memory = true; |
1526 | 1526 |
1527 scoped_refptr<GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( | 1527 scoped_refptr<GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( |
1528 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); | 1528 gpu:: |
| 1529 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
); |
1529 return make_scoped_ptr( | 1530 return make_scoped_ptr( |
1530 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 1531 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
1531 gpu_channel_host.get(), | 1532 gpu_channel_host.get(), |
1532 attributes, | 1533 attributes, |
1533 lose_context_when_out_of_memory, | 1534 lose_context_when_out_of_memory, |
1534 GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d"), | 1535 GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d"), |
1535 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), | 1536 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), |
1536 NULL)); | 1537 NULL)); |
1537 } | 1538 } |
1538 | 1539 |
(...skipping 30 matching lines...) Expand all Loading... |
1569 if (g_stream_texture_factory_override.Get()) { | 1570 if (g_stream_texture_factory_override.Get()) { |
1570 stream_texture_factory_ = g_stream_texture_factory_override.Get(); | 1571 stream_texture_factory_ = g_stream_texture_factory_override.Get(); |
1571 } else if (!stream_texture_factory_.get() || | 1572 } else if (!stream_texture_factory_.get() || |
1572 stream_texture_factory_->ContextGL() | 1573 stream_texture_factory_->ContextGL() |
1573 ->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { | 1574 ->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { |
1574 if (!SharedMainThreadContextProvider().get()) { | 1575 if (!SharedMainThreadContextProvider().get()) { |
1575 stream_texture_factory_ = NULL; | 1576 stream_texture_factory_ = NULL; |
1576 return NULL; | 1577 return NULL; |
1577 } | 1578 } |
1578 scoped_refptr<GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( | 1579 scoped_refptr<GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( |
1579 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE)); | 1580 gpu::CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE)); |
1580 if (!gpu_channel_host.get()) { | 1581 if (!gpu_channel_host.get()) { |
1581 LOG(ERROR) << "Failed to establish GPU channel for media player"; | 1582 LOG(ERROR) << "Failed to establish GPU channel for media player"; |
1582 stream_texture_factory_ = NULL; | 1583 stream_texture_factory_ = NULL; |
1583 } else { | 1584 } else { |
1584 stream_texture_factory_ = StreamTextureFactoryImpl::Create( | 1585 stream_texture_factory_ = StreamTextureFactoryImpl::Create( |
1585 shared_main_thread_contexts_, gpu_channel_host.get()); | 1586 shared_main_thread_contexts_, gpu_channel_host.get()); |
1586 } | 1587 } |
1587 } | 1588 } |
1588 return stream_texture_factory_; | 1589 return stream_texture_factory_; |
1589 } | 1590 } |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1837 } | 1838 } |
1838 | 1839 |
1839 void RenderThreadImpl::OnCreateNewView(const ViewMsg_New_Params& params) { | 1840 void RenderThreadImpl::OnCreateNewView(const ViewMsg_New_Params& params) { |
1840 EnsureWebKitInitialized(); | 1841 EnsureWebKitInitialized(); |
1841 CompositorDependencies* compositor_deps = this; | 1842 CompositorDependencies* compositor_deps = this; |
1842 // When bringing in render_view, also bring in webkit's glue and jsbindings. | 1843 // When bringing in render_view, also bring in webkit's glue and jsbindings. |
1843 RenderViewImpl::Create(compositor_deps, params, false); | 1844 RenderViewImpl::Create(compositor_deps, params, false); |
1844 } | 1845 } |
1845 | 1846 |
1846 GpuChannelHost* RenderThreadImpl::EstablishGpuChannelSync( | 1847 GpuChannelHost* RenderThreadImpl::EstablishGpuChannelSync( |
1847 CauseForGpuLaunch cause_for_gpu_launch) { | 1848 gpu::CauseForGpuLaunch cause_for_gpu_launch) { |
1848 TRACE_EVENT0("gpu", "RenderThreadImpl::EstablishGpuChannelSync"); | 1849 TRACE_EVENT0("gpu", "RenderThreadImpl::EstablishGpuChannelSync"); |
1849 | 1850 |
1850 if (gpu_channel_.get()) { | 1851 if (gpu_channel_.get()) { |
1851 // Do nothing if we already have a GPU channel or are already | 1852 // Do nothing if we already have a GPU channel or are already |
1852 // establishing one. | 1853 // establishing one. |
1853 if (!gpu_channel_->IsLost()) | 1854 if (!gpu_channel_->IsLost()) |
1854 return gpu_channel_.get(); | 1855 return gpu_channel_.get(); |
1855 | 1856 |
1856 // Recreate the channel if it has been lost. | 1857 // Recreate the channel if it has been lost. |
1857 gpu_channel_->DestroyChannel(); | 1858 gpu_channel_->DestroyChannel(); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2174 } | 2175 } |
2175 | 2176 |
2176 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { | 2177 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { |
2177 size_t erased = | 2178 size_t erased = |
2178 RenderThreadImpl::current()->pending_render_frame_connects_.erase( | 2179 RenderThreadImpl::current()->pending_render_frame_connects_.erase( |
2179 routing_id_); | 2180 routing_id_); |
2180 DCHECK_EQ(1u, erased); | 2181 DCHECK_EQ(1u, erased); |
2181 } | 2182 } |
2182 | 2183 |
2183 } // namespace content | 2184 } // namespace content |
OLD | NEW |