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 <utility> | 10 #include <utility> |
| (...skipping 1922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1933 if (command_line.HasSwitch(switches::kDisableGpuCompositing)) | 1933 if (command_line.HasSwitch(switches::kDisableGpuCompositing)) |
| 1934 use_software = true; | 1934 use_software = true; |
| 1935 | 1935 |
| 1936 #if defined(USE_AURA) | 1936 #if defined(USE_AURA) |
| 1937 if (GetServiceManagerConnection() && !use_software && | 1937 if (GetServiceManagerConnection() && !use_software && |
| 1938 command_line.HasSwitch(switches::kUseMusInRenderer)) { | 1938 command_line.HasSwitch(switches::kUseMusInRenderer)) { |
| 1939 RenderWidgetMusConnection* connection = | 1939 RenderWidgetMusConnection* connection = |
| 1940 RenderWidgetMusConnection::GetOrCreate(routing_id); | 1940 RenderWidgetMusConnection::GetOrCreate(routing_id); |
| 1941 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host = | 1941 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host = |
| 1942 EstablishGpuChannelSync(); | 1942 EstablishGpuChannelSync(); |
| 1943 return connection->CreateCompositorFrameSink(std::move(gpu_channel_host)); | 1943 return connection->CreateCompositorFrameSink(std::move(gpu_channel_host), |
| 1944 GetGpuMemoryBufferManager()); | |
| 1944 } | 1945 } |
| 1945 #endif | 1946 #endif |
| 1946 | 1947 |
| 1947 uint32_t compositor_frame_sink_id = g_next_compositor_frame_sink_id++; | 1948 uint32_t compositor_frame_sink_id = g_next_compositor_frame_sink_id++; |
| 1948 | 1949 |
| 1949 if (command_line.HasSwitch(switches::kEnableVulkan)) { | 1950 if (command_line.HasSwitch(switches::kEnableVulkan)) { |
| 1950 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider = | 1951 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider = |
| 1951 cc::VulkanInProcessContextProvider::Create(); | 1952 cc::VulkanInProcessContextProvider::Create(); |
| 1952 if (vulkan_context_provider) { | 1953 if (vulkan_context_provider) { |
| 1953 DCHECK(!layout_test_mode()); | 1954 DCHECK(!layout_test_mode()); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 1971 // We may get a valid channel, but with a software renderer. In that case, | 1972 // We may get a valid channel, but with a software renderer. In that case, |
| 1972 // disable GPU compositing. | 1973 // disable GPU compositing. |
| 1973 if (gpu_channel_host->gpu_info().software_rendering) | 1974 if (gpu_channel_host->gpu_info().software_rendering) |
| 1974 use_software = true; | 1975 use_software = true; |
| 1975 } | 1976 } |
| 1976 | 1977 |
| 1977 if (use_software) { | 1978 if (use_software) { |
| 1978 DCHECK(!layout_test_mode()); | 1979 DCHECK(!layout_test_mode()); |
| 1979 return base::MakeUnique<RendererCompositorFrameSink>( | 1980 return base::MakeUnique<RendererCompositorFrameSink>( |
| 1980 routing_id, compositor_frame_sink_id, | 1981 routing_id, compositor_frame_sink_id, |
| 1981 CreateExternalBeginFrameSource(routing_id), nullptr, nullptr, | 1982 CreateExternalBeginFrameSource(routing_id), nullptr, nullptr, nullptr, |
| 1982 std::move(frame_swap_message_queue)); | 1983 shared_bitmap_manager(), std::move(frame_swap_message_queue)); |
| 1983 } | 1984 } |
| 1984 | 1985 |
| 1985 scoped_refptr<ContextProviderCommandBuffer> worker_context_provider = | 1986 scoped_refptr<ContextProviderCommandBuffer> worker_context_provider = |
| 1986 SharedCompositorWorkerContextProvider(); | 1987 SharedCompositorWorkerContextProvider(); |
| 1987 if (!worker_context_provider) { | 1988 if (!worker_context_provider) { |
| 1988 // Cause the compositor to wait and try again. | 1989 // Cause the compositor to wait and try again. |
| 1989 return nullptr; | 1990 return nullptr; |
| 1990 } | 1991 } |
| 1991 | 1992 |
| 1992 // The renderer compositor context doesn't do a lot of stuff, so we don't | 1993 // The renderer compositor context doesn't do a lot of stuff, so we don't |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 2017 scoped_refptr<ContextProviderCommandBuffer> context_provider( | 2018 scoped_refptr<ContextProviderCommandBuffer> context_provider( |
| 2018 new ContextProviderCommandBuffer( | 2019 new ContextProviderCommandBuffer( |
| 2019 gpu_channel_host, gpu::GPU_STREAM_DEFAULT, | 2020 gpu_channel_host, gpu::GPU_STREAM_DEFAULT, |
| 2020 gpu::GpuStreamPriority::NORMAL, gpu::kNullSurfaceHandle, url, | 2021 gpu::GpuStreamPriority::NORMAL, gpu::kNullSurfaceHandle, url, |
| 2021 automatic_flushes, support_locking, limits, attributes, share_context, | 2022 automatic_flushes, support_locking, limits, attributes, share_context, |
| 2022 command_buffer_metrics::RENDER_COMPOSITOR_CONTEXT)); | 2023 command_buffer_metrics::RENDER_COMPOSITOR_CONTEXT)); |
| 2023 | 2024 |
| 2024 if (layout_test_deps_) { | 2025 if (layout_test_deps_) { |
| 2025 return layout_test_deps_->CreateCompositorFrameSink( | 2026 return layout_test_deps_->CreateCompositorFrameSink( |
| 2026 routing_id, std::move(gpu_channel_host), std::move(context_provider), | 2027 routing_id, std::move(gpu_channel_host), std::move(context_provider), |
| 2027 std::move(worker_context_provider), this); | 2028 std::move(worker_context_provider), GetGpuMemoryBufferManager(), |
| 2029 shared_bitmap_manager(), this); | |
|
danakj
2016/10/27 21:00:34
why not null shared bitmap manager for this and be
piman
2016/10/28 00:58:36
Fair enough, changed (or removed parameter altoget
| |
| 2028 } | 2030 } |
| 2029 | 2031 |
| 2030 #if defined(OS_ANDROID) | 2032 #if defined(OS_ANDROID) |
| 2031 if (sync_compositor_message_filter_) { | 2033 if (sync_compositor_message_filter_) { |
| 2032 return base::MakeUnique<SynchronousCompositorFrameSink>( | 2034 return base::MakeUnique<SynchronousCompositorFrameSink>( |
| 2033 std::move(context_provider), std::move(worker_context_provider), | 2035 std::move(context_provider), std::move(worker_context_provider), |
| 2034 routing_id, compositor_frame_sink_id, | 2036 GetGpuMemoryBufferManager(), shared_bitmap_manager(), routing_id, |
| 2035 CreateExternalBeginFrameSource(routing_id), | 2037 compositor_frame_sink_id, CreateExternalBeginFrameSource(routing_id), |
| 2036 sync_compositor_message_filter_.get(), | 2038 sync_compositor_message_filter_.get(), |
| 2037 std::move(frame_swap_message_queue)); | 2039 std::move(frame_swap_message_queue)); |
| 2038 } | 2040 } |
| 2039 #endif | 2041 #endif |
| 2040 return base::WrapUnique(new RendererCompositorFrameSink( | 2042 return base::WrapUnique(new RendererCompositorFrameSink( |
| 2041 routing_id, compositor_frame_sink_id, | 2043 routing_id, compositor_frame_sink_id, |
| 2042 CreateExternalBeginFrameSource(routing_id), std::move(context_provider), | 2044 CreateExternalBeginFrameSource(routing_id), std::move(context_provider), |
| 2043 std::move(worker_context_provider), std::move(frame_swap_message_queue))); | 2045 std::move(worker_context_provider), GetGpuMemoryBufferManager(), |
| 2046 shared_bitmap_manager(), std::move(frame_swap_message_queue))); | |
| 2044 } | 2047 } |
| 2045 | 2048 |
| 2046 AssociatedInterfaceRegistry* | 2049 AssociatedInterfaceRegistry* |
| 2047 RenderThreadImpl::GetAssociatedInterfaceRegistry() { | 2050 RenderThreadImpl::GetAssociatedInterfaceRegistry() { |
| 2048 return &associated_interfaces_; | 2051 return &associated_interfaces_; |
| 2049 } | 2052 } |
| 2050 | 2053 |
| 2051 std::unique_ptr<cc::SwapPromise> | 2054 std::unique_ptr<cc::SwapPromise> |
| 2052 RenderThreadImpl::RequestCopyOfOutputForLayoutTest( | 2055 RenderThreadImpl::RequestCopyOfOutputForLayoutTest( |
| 2053 int32_t routing_id, | 2056 int32_t routing_id, |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2471 } | 2474 } |
| 2472 } | 2475 } |
| 2473 | 2476 |
| 2474 void RenderThreadImpl::OnRendererInterfaceRequest( | 2477 void RenderThreadImpl::OnRendererInterfaceRequest( |
| 2475 mojom::RendererAssociatedRequest request) { | 2478 mojom::RendererAssociatedRequest request) { |
| 2476 DCHECK(!renderer_binding_.is_bound()); | 2479 DCHECK(!renderer_binding_.is_bound()); |
| 2477 renderer_binding_.Bind(std::move(request)); | 2480 renderer_binding_.Bind(std::move(request)); |
| 2478 } | 2481 } |
| 2479 | 2482 |
| 2480 } // namespace content | 2483 } // namespace content |
| OLD | NEW |