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