| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ui/android/delegated_frame_host_android.h" | 5 #include "ui/android/delegated_frame_host_android.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "cc/layers/solid_color_layer.h" | 10 #include "cc/layers/solid_color_layer.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 support_->SubmitCompositorFrame(local_surface_id, std::move(frame)); | 88 support_->SubmitCompositorFrame(local_surface_id, std::move(frame)); |
| 89 content_layer_ = CreateSurfaceLayer(surface_manager_, surface_info_, | 89 content_layer_ = CreateSurfaceLayer(surface_manager_, surface_info_, |
| 90 !has_transparent_background_); | 90 !has_transparent_background_); |
| 91 view_->GetLayer()->AddChild(content_layer_); | 91 view_->GetLayer()->AddChild(content_layer_); |
| 92 } else { | 92 } else { |
| 93 support_->SubmitCompositorFrame(local_surface_id, std::move(frame)); | 93 support_->SubmitCompositorFrame(local_surface_id, std::move(frame)); |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 void DelegatedFrameHostAndroid::BeginFrameDidNotProduceFrame( |
| 98 const cc::BeginFrameAck& ack) { |
| 99 support_->BeginFrameDidNotProduceFrame(ack); |
| 100 } |
| 101 |
| 97 cc::FrameSinkId DelegatedFrameHostAndroid::GetFrameSinkId() const { | 102 cc::FrameSinkId DelegatedFrameHostAndroid::GetFrameSinkId() const { |
| 98 return frame_sink_id_; | 103 return frame_sink_id_; |
| 99 } | 104 } |
| 100 | 105 |
| 101 void DelegatedFrameHostAndroid::RequestCopyOfSurface( | 106 void DelegatedFrameHostAndroid::RequestCopyOfSurface( |
| 102 WindowAndroidCompositor* compositor, | 107 WindowAndroidCompositor* compositor, |
| 103 const gfx::Rect& src_subrect_in_pixel, | 108 const gfx::Rect& src_subrect_in_pixel, |
| 104 cc::CopyOutputRequest::CopyOutputRequestCallback result_callback) { | 109 cc::CopyOutputRequest::CopyOutputRequestCallback result_callback) { |
| 105 DCHECK(surface_info_.is_valid()); | 110 DCHECK(surface_info_.is_valid()); |
| 106 DCHECK(!result_callback.is_null()); | 111 DCHECK(!result_callback.is_null()); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 182 |
| 178 void DelegatedFrameHostAndroid::WillDrawSurface( | 183 void DelegatedFrameHostAndroid::WillDrawSurface( |
| 179 const cc::LocalSurfaceId& local_surface_id, | 184 const cc::LocalSurfaceId& local_surface_id, |
| 180 const gfx::Rect& damage_rect) {} | 185 const gfx::Rect& damage_rect) {} |
| 181 | 186 |
| 182 void DelegatedFrameHostAndroid::OnNeedsBeginFrames(bool needs_begin_frames) { | 187 void DelegatedFrameHostAndroid::OnNeedsBeginFrames(bool needs_begin_frames) { |
| 183 support_->SetNeedsBeginFrame(needs_begin_frames); | 188 support_->SetNeedsBeginFrame(needs_begin_frames); |
| 184 } | 189 } |
| 185 | 190 |
| 186 void DelegatedFrameHostAndroid::OnDidFinishFrame(const cc::BeginFrameAck& ack) { | 191 void DelegatedFrameHostAndroid::OnDidFinishFrame(const cc::BeginFrameAck& ack) { |
| 187 // If there was damage, SubmitCompositorFrame includes the ack. | |
| 188 if (!ack.has_damage) | |
| 189 support_->BeginFrameDidNotSwap(ack); | |
| 190 } | 192 } |
| 191 | 193 |
| 192 void DelegatedFrameHostAndroid::CreateNewCompositorFrameSinkSupport() { | 194 void DelegatedFrameHostAndroid::CreateNewCompositorFrameSinkSupport() { |
| 193 constexpr bool is_root = false; | 195 constexpr bool is_root = false; |
| 194 constexpr bool handles_frame_sink_id_invalidation = false; | 196 constexpr bool handles_frame_sink_id_invalidation = false; |
| 195 constexpr bool needs_sync_points = true; | 197 constexpr bool needs_sync_points = true; |
| 196 support_.reset(); | 198 support_.reset(); |
| 197 support_ = cc::CompositorFrameSinkSupport::Create( | 199 support_ = cc::CompositorFrameSinkSupport::Create( |
| 198 this, surface_manager_, frame_sink_id_, is_root, | 200 this, surface_manager_, frame_sink_id_, is_root, |
| 199 handles_frame_sink_id_invalidation, needs_sync_points); | 201 handles_frame_sink_id_invalidation, needs_sync_points); |
| 200 } | 202 } |
| 201 | 203 |
| 202 cc::SurfaceId DelegatedFrameHostAndroid::SurfaceId() const { | 204 cc::SurfaceId DelegatedFrameHostAndroid::SurfaceId() const { |
| 203 return surface_info_.id(); | 205 return surface_info_.id(); |
| 204 } | 206 } |
| 205 | 207 |
| 206 } // namespace ui | 208 } // namespace ui |
| OLD | NEW |