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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 gfx::Rect clip(draw_info->clip_left, draw_info->clip_top, | 143 gfx::Rect clip(draw_info->clip_left, draw_info->clip_top, |
144 draw_info->clip_right - draw_info->clip_left, | 144 draw_info->clip_right - draw_info->clip_left, |
145 draw_info->clip_bottom - draw_info->clip_top); | 145 draw_info->clip_bottom - draw_info->clip_top); |
146 surfaces_->DrawAndSwap(viewport, clip, transform, frame_size_, | 146 surfaces_->DrawAndSwap(viewport, clip, transform, frame_size_, |
147 cc::SurfaceId(frame_sink_id_, child_id_)); | 147 cc::SurfaceId(frame_sink_id_, child_id_)); |
148 } | 148 } |
149 | 149 |
150 void HardwareRenderer::AllocateSurface() { | 150 void HardwareRenderer::AllocateSurface() { |
151 DCHECK(child_id_.is_null()); | 151 DCHECK(child_id_.is_null()); |
152 child_id_ = surface_id_allocator_->GenerateId(); | 152 child_id_ = surface_id_allocator_->GenerateId(); |
153 surface_factory_->Create(child_id_); | |
154 surfaces_->AddChildId(cc::SurfaceId(frame_sink_id_, child_id_)); | 153 surfaces_->AddChildId(cc::SurfaceId(frame_sink_id_, child_id_)); |
155 } | 154 } |
156 | 155 |
157 void HardwareRenderer::DestroySurface() { | 156 void HardwareRenderer::DestroySurface() { |
158 DCHECK(!child_id_.is_null()); | 157 DCHECK(!child_id_.is_null()); |
159 | 158 |
160 // Submit an empty frame to force any existing resources to be returned. | 159 // Submit an empty frame to force any existing resources to be returned. |
161 surface_factory_->SubmitCompositorFrame(child_id_, cc::CompositorFrame(), | 160 surface_factory_->SubmitCompositorFrame(child_id_, cc::CompositorFrame(), |
162 cc::SurfaceFactory::DrawCallback()); | 161 cc::SurfaceFactory::DrawCallback()); |
163 | 162 |
164 surfaces_->RemoveChildId(cc::SurfaceId(frame_sink_id_, child_id_)); | 163 surfaces_->RemoveChildId(cc::SurfaceId(frame_sink_id_, child_id_)); |
165 surface_factory_->Destroy(child_id_); | |
166 child_id_ = cc::LocalFrameId(); | 164 child_id_ = cc::LocalFrameId(); |
167 } | 165 } |
168 | 166 |
169 void HardwareRenderer::ReturnResources( | 167 void HardwareRenderer::ReturnResources( |
170 const cc::ReturnedResourceArray& resources) { | 168 const cc::ReturnedResourceArray& resources) { |
171 ReturnResourcesToCompositor(resources, compositor_id_, | 169 ReturnResourcesToCompositor(resources, compositor_id_, |
172 last_submitted_compositor_frame_sink_id_); | 170 last_submitted_compositor_frame_sink_id_); |
173 } | 171 } |
174 | 172 |
175 void HardwareRenderer::SetBeginFrameSource( | 173 void HardwareRenderer::SetBeginFrameSource( |
(...skipping 20 matching lines...) Expand all Loading... |
196 const cc::ReturnedResourceArray& resources, | 194 const cc::ReturnedResourceArray& resources, |
197 const CompositorID& compositor_id, | 195 const CompositorID& compositor_id, |
198 uint32_t compositor_frame_sink_id) { | 196 uint32_t compositor_frame_sink_id) { |
199 if (compositor_frame_sink_id != last_committed_compositor_frame_sink_id_) | 197 if (compositor_frame_sink_id != last_committed_compositor_frame_sink_id_) |
200 return; | 198 return; |
201 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id, | 199 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id, |
202 compositor_frame_sink_id); | 200 compositor_frame_sink_id); |
203 } | 201 } |
204 | 202 |
205 } // namespace android_webview | 203 } // namespace android_webview |
OLD | NEW |