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/browser/renderer_host/compositor_impl_android.h" | 5 #include "content/browser/renderer_host/compositor_impl_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <unordered_set> | 10 #include <unordered_set> |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "base/threading/thread_checker.h" | 29 #include "base/threading/thread_checker.h" |
30 #include "base/threading/thread_task_runner_handle.h" | 30 #include "base/threading/thread_task_runner_handle.h" |
31 #include "cc/animation/animation_host.h" | 31 #include "cc/animation/animation_host.h" |
32 #include "cc/base/switches.h" | 32 #include "cc/base/switches.h" |
33 #include "cc/input/input_handler.h" | 33 #include "cc/input/input_handler.h" |
34 #include "cc/layers/layer.h" | 34 #include "cc/layers/layer.h" |
35 #include "cc/output/compositor_frame.h" | 35 #include "cc/output/compositor_frame.h" |
36 #include "cc/output/context_provider.h" | 36 #include "cc/output/context_provider.h" |
37 #include "cc/output/output_surface.h" | 37 #include "cc/output/output_surface.h" |
38 #include "cc/output/output_surface_client.h" | 38 #include "cc/output/output_surface_client.h" |
| 39 #include "cc/output/output_surface_frame.h" |
39 #include "cc/output/texture_mailbox_deleter.h" | 40 #include "cc/output/texture_mailbox_deleter.h" |
40 #include "cc/output/vulkan_in_process_context_provider.h" | 41 #include "cc/output/vulkan_in_process_context_provider.h" |
41 #include "cc/raster/single_thread_task_graph_runner.h" | 42 #include "cc/raster/single_thread_task_graph_runner.h" |
42 #include "cc/resources/ui_resource_manager.h" | 43 #include "cc/resources/ui_resource_manager.h" |
43 #include "cc/scheduler/begin_frame_source.h" | 44 #include "cc/scheduler/begin_frame_source.h" |
44 #include "cc/surfaces/direct_compositor_frame_sink.h" | 45 #include "cc/surfaces/direct_compositor_frame_sink.h" |
45 #include "cc/surfaces/display.h" | 46 #include "cc/surfaces/display.h" |
46 #include "cc/surfaces/display_scheduler.h" | 47 #include "cc/surfaces/display_scheduler.h" |
47 #include "cc/trees/layer_tree_host_in_process.h" | 48 #include "cc/trees/layer_tree_host_in_process.h" |
48 #include "cc/trees/layer_tree_settings.h" | 49 #include "cc/trees/layer_tree_settings.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 base::Bind(&AndroidOutputSurface::OnSwapBuffersCompleted, | 224 base::Bind(&AndroidOutputSurface::OnSwapBuffersCompleted, |
224 base::Unretained(this))), | 225 base::Unretained(this))), |
225 overlay_candidate_validator_( | 226 overlay_candidate_validator_( |
226 new display_compositor:: | 227 new display_compositor:: |
227 CompositorOverlayCandidateValidatorAndroid()) { | 228 CompositorOverlayCandidateValidatorAndroid()) { |
228 capabilities_.max_frames_pending = kMaxDisplaySwapBuffers; | 229 capabilities_.max_frames_pending = kMaxDisplaySwapBuffers; |
229 } | 230 } |
230 | 231 |
231 ~AndroidOutputSurface() override = default; | 232 ~AndroidOutputSurface() override = default; |
232 | 233 |
233 void SwapBuffers(cc::CompositorFrame frame) override { | 234 void SwapBuffers(cc::OutputSurfaceFrame frame) override { |
234 GetCommandBufferProxy()->SetLatencyInfo(frame.metadata.latency_info); | 235 GetCommandBufferProxy()->SetLatencyInfo(frame.latency_info); |
235 if (frame.gl_frame_data->sub_buffer_rect.IsEmpty()) { | 236 if (frame.sub_buffer_rect.IsEmpty()) { |
236 context_provider_->ContextSupport()->CommitOverlayPlanes(); | 237 context_provider_->ContextSupport()->CommitOverlayPlanes(); |
237 } else { | 238 } else { |
238 DCHECK(frame.gl_frame_data->sub_buffer_rect == | 239 DCHECK(frame.sub_buffer_rect == gfx::Rect(frame.size)); |
239 gfx::Rect(frame.gl_frame_data->size)); | |
240 context_provider_->ContextSupport()->Swap(); | 240 context_provider_->ContextSupport()->Swap(); |
241 } | 241 } |
242 } | 242 } |
243 | 243 |
244 bool BindToClient(cc::OutputSurfaceClient* client) override { | 244 bool BindToClient(cc::OutputSurfaceClient* client) override { |
245 if (!OutputSurface::BindToClient(client)) | 245 if (!OutputSurface::BindToClient(client)) |
246 return false; | 246 return false; |
247 | 247 |
248 GetCommandBufferProxy()->SetSwapBuffersCompletionCallback( | 248 GetCommandBufferProxy()->SetSwapBuffersCompletionCallback( |
249 swap_buffers_completion_callback_.callback()); | 249 swap_buffers_completion_callback_.callback()); |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 | 826 |
827 cc::FrameSinkId CompositorImpl::GetFrameSinkId() { | 827 cc::FrameSinkId CompositorImpl::GetFrameSinkId() { |
828 return frame_sink_id_; | 828 return frame_sink_id_; |
829 } | 829 } |
830 | 830 |
831 bool CompositorImpl::HavePendingReadbacks() { | 831 bool CompositorImpl::HavePendingReadbacks() { |
832 return !readback_layer_tree_->children().empty(); | 832 return !readback_layer_tree_->children().empty(); |
833 } | 833 } |
834 | 834 |
835 } // namespace content | 835 } // namespace content |
OLD | NEW |