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