| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 return; | 124 return; |
| 125 | 125 |
| 126 DCHECK(content_layer_); | 126 DCHECK(content_layer_); |
| 127 | 127 |
| 128 content_layer_->RemoveFromParent(); | 128 content_layer_->RemoveFromParent(); |
| 129 content_layer_ = nullptr; | 129 content_layer_ = nullptr; |
| 130 support_->EvictFrame(); | 130 support_->EvictFrame(); |
| 131 surface_info_ = cc::SurfaceInfo(); | 131 surface_info_ = cc::SurfaceInfo(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 namespace { |
| 135 void IgnoreDrawCallback() {} |
| 136 void IgnoreWillDrawCallback(const cc::LocalSurfaceId&, const gfx::Rect&) {} |
| 137 } |
| 138 |
| 139 void DelegatedFrameHostAndroid::ForceFrame(cc::CompositorFrame frame) { |
| 140 cc::Surface* surface = surface_manager_->GetSurfaceForId(SurfaceId()); |
| 141 if (surface) |
| 142 surface->QueueFrame(std::move(frame), base::Bind(&IgnoreDrawCallback), |
| 143 base::BindRepeating(&IgnoreWillDrawCallback)); |
| 144 } |
| 145 |
| 134 bool DelegatedFrameHostAndroid::HasDelegatedContent() const { | 146 bool DelegatedFrameHostAndroid::HasDelegatedContent() const { |
| 135 return surface_info_.is_valid(); | 147 return surface_info_.is_valid(); |
| 136 } | 148 } |
| 137 | 149 |
| 138 void DelegatedFrameHostAndroid::CompositorFrameSinkChanged() { | 150 void DelegatedFrameHostAndroid::CompositorFrameSinkChanged() { |
| 139 DestroyDelegatedContent(); | 151 DestroyDelegatedContent(); |
| 140 CreateNewCompositorFrameSinkSupport(); | 152 CreateNewCompositorFrameSinkSupport(); |
| 141 if (registered_parent_compositor_) | 153 if (registered_parent_compositor_) |
| 142 AttachToCompositor(registered_parent_compositor_); | 154 AttachToCompositor(registered_parent_compositor_); |
| 143 } | 155 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 support_ = cc::CompositorFrameSinkSupport::Create( | 209 support_ = cc::CompositorFrameSinkSupport::Create( |
| 198 this, surface_manager_, frame_sink_id_, is_root, | 210 this, surface_manager_, frame_sink_id_, is_root, |
| 199 handles_frame_sink_id_invalidation, needs_sync_points); | 211 handles_frame_sink_id_invalidation, needs_sync_points); |
| 200 } | 212 } |
| 201 | 213 |
| 202 cc::SurfaceId DelegatedFrameHostAndroid::SurfaceId() const { | 214 cc::SurfaceId DelegatedFrameHostAndroid::SurfaceId() const { |
| 203 return surface_info_.id(); | 215 return surface_info_.id(); |
| 204 } | 216 } |
| 205 | 217 |
| 206 } // namespace ui | 218 } // namespace ui |
| OLD | NEW |