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 <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 #include "ui/base/ui_base_switches.h" | 84 #include "ui/base/ui_base_switches.h" |
85 #include "ui/gfx/geometry/point_conversions.h" | 85 #include "ui/gfx/geometry/point_conversions.h" |
86 #include "ui/gfx/geometry/rect_conversions.h" | 86 #include "ui/gfx/geometry/rect_conversions.h" |
87 #include "ui/gfx/geometry/size_conversions.h" | 87 #include "ui/gfx/geometry/size_conversions.h" |
88 #include "ui/gfx/skia_util.h" | 88 #include "ui/gfx/skia_util.h" |
89 #include "ui/gl/gl_switches.h" | 89 #include "ui/gl/gl_switches.h" |
90 #include "ui/surface/transport_dib.h" | 90 #include "ui/surface/transport_dib.h" |
91 | 91 |
92 #if defined(OS_ANDROID) | 92 #if defined(OS_ANDROID) |
93 #include <android/keycodes.h> | 93 #include <android/keycodes.h> |
94 #include "content/renderer/android/synchronous_compositor_factory.h" | |
95 #include "content/renderer/android/synchronous_compositor_filter.h" | 94 #include "content/renderer/android/synchronous_compositor_filter.h" |
96 #include "content/renderer/android/synchronous_compositor_output_surface.h" | 95 #include "content/renderer/android/synchronous_compositor_output_surface.h" |
97 #endif | 96 #endif |
98 | 97 |
99 #if defined(OS_POSIX) | 98 #if defined(OS_POSIX) |
100 #include "ipc/ipc_channel_posix.h" | 99 #include "ipc/ipc_channel_posix.h" |
101 #include "third_party/skia/include/core/SkMallocPixelRef.h" | 100 #include "third_party/skia/include/core/SkMallocPixelRef.h" |
102 #include "third_party/skia/include/core/SkPixelRef.h" | 101 #include "third_party/skia/include/core/SkPixelRef.h" |
103 #endif // defined(OS_POSIX) | 102 #endif // defined(OS_POSIX) |
104 | 103 |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 GetURLForGraphicsContext3D()), | 794 GetURLForGraphicsContext3D()), |
796 RENDER_COMPOSITOR_CONTEXT); | 795 RENDER_COMPOSITOR_CONTEXT); |
797 worker_context_provider = | 796 worker_context_provider = |
798 RenderThreadImpl::current()->SharedWorkerContextProvider(); | 797 RenderThreadImpl::current()->SharedWorkerContextProvider(); |
799 if (!worker_context_provider) { | 798 if (!worker_context_provider) { |
800 // Cause the compositor to wait and try again. | 799 // Cause the compositor to wait and try again. |
801 return nullptr; | 800 return nullptr; |
802 } | 801 } |
803 | 802 |
804 #if defined(OS_ANDROID) | 803 #if defined(OS_ANDROID) |
805 if (SynchronousCompositorFactory* factory = | 804 if (RenderThreadImpl::current() && |
806 SynchronousCompositorFactory::GetInstance()) { | 805 RenderThreadImpl::current()->sync_compositor_message_filter()) { |
807 uint32_t output_surface_id = next_output_surface_id_++; | |
808 return factory->CreateOutputSurface( | |
809 routing_id(), output_surface_id, frame_swap_message_queue_, | |
810 context_provider, worker_context_provider); | |
811 } else if (RenderThreadImpl::current()->sync_compositor_message_filter()) { | |
812 uint32_t output_surface_id = next_output_surface_id_++; | 806 uint32_t output_surface_id = next_output_surface_id_++; |
813 return base::WrapUnique(new SynchronousCompositorOutputSurface( | 807 return base::WrapUnique(new SynchronousCompositorOutputSurface( |
814 context_provider, worker_context_provider, routing_id(), | 808 context_provider, worker_context_provider, routing_id(), |
815 output_surface_id, content::RenderThreadImpl::current() | 809 output_surface_id, |
816 ->sync_compositor_message_filter(), | 810 RenderThreadImpl::current()->sync_compositor_message_filter(), |
817 frame_swap_message_queue_)); | 811 frame_swap_message_queue_)); |
818 } | 812 } |
819 #endif | 813 #endif |
820 } | 814 } |
821 | 815 |
822 uint32_t output_surface_id = next_output_surface_id_++; | 816 uint32_t output_surface_id = next_output_surface_id_++; |
823 // Composite-to-mailbox is currently used for layout tests in order to cause | 817 // Composite-to-mailbox is currently used for layout tests in order to cause |
824 // them to draw inside in the renderer to do the readback there. This should | 818 // them to draw inside in the renderer to do the readback there. This should |
825 // no longer be the case when crbug.com/311404 is fixed. | 819 // no longer be the case when crbug.com/311404 is fixed. |
826 if (!RenderThreadImpl::current() || | 820 if (!RenderThreadImpl::current() || |
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2126 } | 2120 } |
2127 | 2121 |
2128 float RenderWidget::GetOriginalDeviceScaleFactor() const { | 2122 float RenderWidget::GetOriginalDeviceScaleFactor() const { |
2129 return | 2123 return |
2130 screen_metrics_emulator_ ? | 2124 screen_metrics_emulator_ ? |
2131 screen_metrics_emulator_->original_screen_info().deviceScaleFactor : | 2125 screen_metrics_emulator_->original_screen_info().deviceScaleFactor : |
2132 device_scale_factor_; | 2126 device_scale_factor_; |
2133 } | 2127 } |
2134 | 2128 |
2135 } // namespace content | 2129 } // namespace content |
OLD | NEW |