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_widget.h" | 5 #include "content/renderer/render_widget.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
985 } | 985 } |
986 #endif | 986 #endif |
987 | 987 |
988 const base::CommandLine& command_line = | 988 const base::CommandLine& command_line = |
989 *base::CommandLine::ForCurrentProcess(); | 989 *base::CommandLine::ForCurrentProcess(); |
990 bool use_software = fallback; | 990 bool use_software = fallback; |
991 if (command_line.HasSwitch(switches::kDisableGpuCompositing)) | 991 if (command_line.HasSwitch(switches::kDisableGpuCompositing)) |
992 use_software = true; | 992 use_software = true; |
993 | 993 |
994 scoped_refptr<ContextProviderCommandBuffer> context_provider; | 994 scoped_refptr<ContextProviderCommandBuffer> context_provider; |
995 scoped_refptr<ContextProviderCommandBuffer> worker_context_provider; | |
995 if (!use_software) { | 996 if (!use_software) { |
996 context_provider = ContextProviderCommandBuffer::Create( | 997 context_provider = ContextProviderCommandBuffer::Create( |
997 CreateGraphicsContext3D(), "RenderCompositor"); | 998 CreateGraphicsContext3D(), "RenderCompositor"); |
998 if (!context_provider.get()) { | 999 if (!context_provider.get()) { |
999 // Cause the compositor to wait and try again. | 1000 // Cause the compositor to wait and try again. |
1000 return scoped_ptr<cc::OutputSurface>(); | 1001 return scoped_ptr<cc::OutputSurface>(); |
1001 } | 1002 } |
1003 | |
1004 worker_context_provider = ContextProviderCommandBuffer::Create( | |
1005 CreateGraphicsContext3D(), "RenderWorker"); | |
1006 if (!worker_context_provider.get()) { | |
1007 // Cause the compositor to wait and try again. | |
1008 LOG(ERROR) << "Failed to create worker context provider!!!!!!!!!"; | |
vmpstr
2015/02/11 19:00:52
:) !!!!!!!
vmiura
2015/02/11 20:13:18
Removed :)
| |
1009 return scoped_ptr<cc::OutputSurface>(); | |
1010 } | |
1002 } | 1011 } |
1003 | 1012 |
1004 uint32 output_surface_id = next_output_surface_id_++; | 1013 uint32 output_surface_id = next_output_surface_id_++; |
1005 if (command_line.HasSwitch(switches::kEnableDelegatedRenderer)) { | 1014 if (command_line.HasSwitch(switches::kEnableDelegatedRenderer)) { |
1006 DCHECK(compositor_deps_->GetCompositorImplThreadTaskRunner()); | 1015 DCHECK(compositor_deps_->GetCompositorImplThreadTaskRunner()); |
1007 return scoped_ptr<cc::OutputSurface>(new DelegatedCompositorOutputSurface( | 1016 return scoped_ptr<cc::OutputSurface>(new DelegatedCompositorOutputSurface( |
1008 routing_id(), output_surface_id, context_provider, nullptr, | 1017 routing_id(), output_surface_id, context_provider, |
1009 frame_swap_message_queue_)); | 1018 worker_context_provider, frame_swap_message_queue_)); |
1010 } | 1019 } |
1011 if (!context_provider.get()) { | 1020 if (!context_provider.get()) { |
1012 scoped_ptr<cc::SoftwareOutputDevice> software_device( | 1021 scoped_ptr<cc::SoftwareOutputDevice> software_device( |
1013 new CompositorSoftwareOutputDevice()); | 1022 new CompositorSoftwareOutputDevice()); |
1014 | 1023 |
1015 return scoped_ptr<cc::OutputSurface>(new CompositorOutputSurface( | 1024 return scoped_ptr<cc::OutputSurface>(new CompositorOutputSurface( |
1016 routing_id(), output_surface_id, nullptr, nullptr, | 1025 routing_id(), output_surface_id, NULL, NULL, software_device.Pass(), |
1017 software_device.Pass(), frame_swap_message_queue_, true)); | 1026 frame_swap_message_queue_, true)); |
1018 } | 1027 } |
1019 | 1028 |
1020 if (command_line.HasSwitch(cc::switches::kCompositeToMailbox)) { | 1029 if (command_line.HasSwitch(cc::switches::kCompositeToMailbox)) { |
1021 // Composite-to-mailbox is currently used for layout tests in order to cause | 1030 // Composite-to-mailbox is currently used for layout tests in order to cause |
1022 // them to draw inside in the renderer to do the readback there. This should | 1031 // them to draw inside in the renderer to do the readback there. This should |
1023 // no longer be the case when crbug.com/311404 is fixed. | 1032 // no longer be the case when crbug.com/311404 is fixed. |
1024 DCHECK(RenderThreadImpl::current()->layout_test_mode()); | 1033 DCHECK(RenderThreadImpl::current()->layout_test_mode()); |
1025 cc::ResourceFormat format = cc::RGBA_8888; | 1034 cc::ResourceFormat format = cc::RGBA_8888; |
1026 if (base::SysInfo::IsLowEndDevice()) | 1035 if (base::SysInfo::IsLowEndDevice()) |
1027 format = cc::RGB_565; | 1036 format = cc::RGB_565; |
1028 return scoped_ptr<cc::OutputSurface>(new MailboxOutputSurface( | 1037 return scoped_ptr<cc::OutputSurface>(new MailboxOutputSurface( |
1029 routing_id(), output_surface_id, context_provider, nullptr, | 1038 routing_id(), output_surface_id, context_provider, |
1030 scoped_ptr<cc::SoftwareOutputDevice>(), frame_swap_message_queue_, | 1039 worker_context_provider, scoped_ptr<cc::SoftwareOutputDevice>(), |
1031 format)); | 1040 frame_swap_message_queue_, format)); |
1032 } | 1041 } |
1033 bool use_swap_compositor_frame_message = false; | 1042 bool use_swap_compositor_frame_message = false; |
1034 return scoped_ptr<cc::OutputSurface>(new CompositorOutputSurface( | 1043 return scoped_ptr<cc::OutputSurface>(new CompositorOutputSurface( |
1035 routing_id(), output_surface_id, context_provider, nullptr, | 1044 routing_id(), output_surface_id, context_provider, |
1036 scoped_ptr<cc::SoftwareOutputDevice>(), frame_swap_message_queue_, | 1045 worker_context_provider, scoped_ptr<cc::SoftwareOutputDevice>(), |
1037 use_swap_compositor_frame_message)); | 1046 frame_swap_message_queue_, use_swap_compositor_frame_message)); |
1038 } | 1047 } |
1039 | 1048 |
1040 void RenderWidget::OnSwapBuffersAborted() { | 1049 void RenderWidget::OnSwapBuffersAborted() { |
1041 TRACE_EVENT0("renderer", "RenderWidget::OnSwapBuffersAborted"); | 1050 TRACE_EVENT0("renderer", "RenderWidget::OnSwapBuffersAborted"); |
1042 // Schedule another frame so the compositor learns about it. | 1051 // Schedule another frame so the compositor learns about it. |
1043 scheduleComposite(); | 1052 scheduleComposite(); |
1044 } | 1053 } |
1045 | 1054 |
1046 void RenderWidget::OnSwapBuffersPosted() { | 1055 void RenderWidget::OnSwapBuffersPosted() { |
1047 TRACE_EVENT0("renderer", "RenderWidget::OnSwapBuffersPosted"); | 1056 TRACE_EVENT0("renderer", "RenderWidget::OnSwapBuffersPosted"); |
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2415 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2424 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
2416 video_hole_frames_.AddObserver(frame); | 2425 video_hole_frames_.AddObserver(frame); |
2417 } | 2426 } |
2418 | 2427 |
2419 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2428 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
2420 video_hole_frames_.RemoveObserver(frame); | 2429 video_hole_frames_.RemoveObserver(frame); |
2421 } | 2430 } |
2422 #endif // defined(VIDEO_HOLE) | 2431 #endif // defined(VIDEO_HOLE) |
2423 | 2432 |
2424 } // namespace content | 2433 } // namespace content |
OLD | NEW |