| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "android_webview/browser/hardware_renderer.h" | 5 #include "android_webview/browser/hardware_renderer.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "android_webview/browser/aw_gl_surface.h" | 9 #include "android_webview/browser/aw_gl_surface.h" |
| 10 #include "android_webview/browser/aw_render_thread_context_provider.h" | 10 #include "android_webview/browser/aw_render_thread_context_provider.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 DCHECK(child_id_.is_null()); | 149 DCHECK(child_id_.is_null()); |
| 150 DCHECK(surface_factory_); | 150 DCHECK(surface_factory_); |
| 151 child_id_ = surface_id_allocator_->GenerateId(); | 151 child_id_ = surface_id_allocator_->GenerateId(); |
| 152 surface_factory_->Create(child_id_); | 152 surface_factory_->Create(child_id_); |
| 153 surfaces_->AddChildId(cc::SurfaceId(frame_sink_id_, child_id_)); | 153 surfaces_->AddChildId(cc::SurfaceId(frame_sink_id_, child_id_)); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void HardwareRenderer::DestroySurface() { | 156 void HardwareRenderer::DestroySurface() { |
| 157 DCHECK(!child_id_.is_null()); | 157 DCHECK(!child_id_.is_null()); |
| 158 DCHECK(surface_factory_); | 158 DCHECK(surface_factory_); |
| 159 |
| 160 // Submit an empty frame to force any existing resources to be returned. |
| 161 cc::CompositorFrame empty_frame; |
| 162 empty_frame.delegated_frame_data = |
| 163 base::WrapUnique(new cc::DelegatedFrameData); |
| 164 surface_factory_->SubmitCompositorFrame(child_id_, std::move(empty_frame), |
| 165 cc::SurfaceFactory::DrawCallback()); |
| 166 |
| 159 surfaces_->RemoveChildId(cc::SurfaceId(frame_sink_id_, child_id_)); | 167 surfaces_->RemoveChildId(cc::SurfaceId(frame_sink_id_, child_id_)); |
| 160 surface_factory_->Destroy(child_id_); | 168 surface_factory_->Destroy(child_id_); |
| 161 child_id_ = cc::LocalFrameId(); | 169 child_id_ = cc::LocalFrameId(); |
| 162 } | 170 } |
| 163 | 171 |
| 164 void HardwareRenderer::ReturnResources( | 172 void HardwareRenderer::ReturnResources( |
| 165 const cc::ReturnedResourceArray& resources) { | 173 const cc::ReturnedResourceArray& resources) { |
| 166 ReturnResourcesToCompositor(resources, compositor_id_, | 174 ReturnResourcesToCompositor(resources, compositor_id_, |
| 167 last_submitted_compositor_frame_sink_id_); | 175 last_submitted_compositor_frame_sink_id_); |
| 168 } | 176 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 192 const cc::ReturnedResourceArray& resources, | 200 const cc::ReturnedResourceArray& resources, |
| 193 const CompositorID& compositor_id, | 201 const CompositorID& compositor_id, |
| 194 uint32_t compositor_frame_sink_id) { | 202 uint32_t compositor_frame_sink_id) { |
| 195 if (compositor_frame_sink_id != last_committed_compositor_frame_sink_id_) | 203 if (compositor_frame_sink_id != last_committed_compositor_frame_sink_id_) |
| 196 return; | 204 return; |
| 197 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id, | 205 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id, |
| 198 compositor_frame_sink_id); | 206 compositor_frame_sink_id); |
| 199 } | 207 } |
| 200 | 208 |
| 201 } // namespace android_webview | 209 } // namespace android_webview |
| OLD | NEW |