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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 gfx::Rect clip(draw_info->clip_left, draw_info->clip_top, | 160 gfx::Rect clip(draw_info->clip_left, draw_info->clip_top, |
161 draw_info->clip_right - draw_info->clip_left, | 161 draw_info->clip_right - draw_info->clip_left, |
162 draw_info->clip_bottom - draw_info->clip_top); | 162 draw_info->clip_bottom - draw_info->clip_top); |
163 surfaces_->DrawAndSwap(viewport, clip, transform, frame_size_, | 163 surfaces_->DrawAndSwap(viewport, clip, transform, frame_size_, |
164 cc::SurfaceId(frame_sink_id_, child_id_)); | 164 cc::SurfaceId(frame_sink_id_, child_id_)); |
165 } | 165 } |
166 | 166 |
167 void HardwareRenderer::AllocateSurface() { | 167 void HardwareRenderer::AllocateSurface() { |
168 DCHECK(!child_id_.is_valid()); | 168 DCHECK(!child_id_.is_valid()); |
169 child_id_ = surface_id_allocator_->GenerateId(); | 169 child_id_ = surface_id_allocator_->GenerateId(); |
170 surface_factory_->Create(child_id_); | |
171 surfaces_->AddChildId(cc::SurfaceId(frame_sink_id_, child_id_)); | 170 surfaces_->AddChildId(cc::SurfaceId(frame_sink_id_, child_id_)); |
172 } | 171 } |
173 | 172 |
174 void HardwareRenderer::DestroySurface() { | 173 void HardwareRenderer::DestroySurface() { |
175 DCHECK(child_id_.is_valid()); | 174 DCHECK(child_id_.is_valid()); |
176 | 175 |
177 // Submit an empty frame to force any existing resources to be returned. | 176 // Submit an empty frame to force any existing resources to be returned. |
178 surface_factory_->SubmitCompositorFrame(child_id_, cc::CompositorFrame(), | 177 surface_factory_->SubmitCompositorFrame(child_id_, cc::CompositorFrame(), |
179 cc::SurfaceFactory::DrawCallback()); | 178 cc::SurfaceFactory::DrawCallback()); |
180 | |
181 surfaces_->RemoveChildId(cc::SurfaceId(frame_sink_id_, child_id_)); | 179 surfaces_->RemoveChildId(cc::SurfaceId(frame_sink_id_, child_id_)); |
182 surface_factory_->Destroy(child_id_); | 180 surface_factory_->EvictSurface(); |
183 child_id_ = cc::LocalFrameId(); | 181 child_id_ = cc::LocalFrameId(); |
184 } | 182 } |
185 | 183 |
186 void HardwareRenderer::ReturnResources( | 184 void HardwareRenderer::ReturnResources( |
187 const cc::ReturnedResourceArray& resources) { | 185 const cc::ReturnedResourceArray& resources) { |
188 ReturnResourcesToCompositor(resources, compositor_id_, | 186 ReturnResourcesToCompositor(resources, compositor_id_, |
189 last_submitted_compositor_frame_sink_id_); | 187 last_submitted_compositor_frame_sink_id_); |
190 } | 188 } |
191 | 189 |
192 void HardwareRenderer::SetBeginFrameSource( | 190 void HardwareRenderer::SetBeginFrameSource( |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 const cc::ReturnedResourceArray& resources, | 248 const cc::ReturnedResourceArray& resources, |
251 const CompositorID& compositor_id, | 249 const CompositorID& compositor_id, |
252 uint32_t compositor_frame_sink_id) { | 250 uint32_t compositor_frame_sink_id) { |
253 if (compositor_frame_sink_id != last_committed_compositor_frame_sink_id_) | 251 if (compositor_frame_sink_id != last_committed_compositor_frame_sink_id_) |
254 return; | 252 return; |
255 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id, | 253 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id, |
256 compositor_frame_sink_id); | 254 compositor_frame_sink_id); |
257 } | 255 } |
258 | 256 |
259 } // namespace android_webview | 257 } // namespace android_webview |
OLD | NEW |