Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: android_webview/browser/hardware_renderer.cc

Issue 2506883002: Revert of Remove SurfaceFactory::Create and SurfaceFactory::Destroy (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | android_webview/browser/surfaces_instance.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_);
170 surfaces_->AddChildId(cc::SurfaceId(frame_sink_id_, child_id_)); 171 surfaces_->AddChildId(cc::SurfaceId(frame_sink_id_, child_id_));
171 } 172 }
172 173
173 void HardwareRenderer::DestroySurface() { 174 void HardwareRenderer::DestroySurface() {
174 DCHECK(child_id_.is_valid()); 175 DCHECK(child_id_.is_valid());
175 176
176 // 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.
177 surface_factory_->SubmitCompositorFrame(child_id_, cc::CompositorFrame(), 178 surface_factory_->SubmitCompositorFrame(child_id_, cc::CompositorFrame(),
178 cc::SurfaceFactory::DrawCallback()); 179 cc::SurfaceFactory::DrawCallback());
180
179 surfaces_->RemoveChildId(cc::SurfaceId(frame_sink_id_, child_id_)); 181 surfaces_->RemoveChildId(cc::SurfaceId(frame_sink_id_, child_id_));
180 surface_factory_->EvictSurface(); 182 surface_factory_->Destroy(child_id_);
181 child_id_ = cc::LocalFrameId(); 183 child_id_ = cc::LocalFrameId();
182 } 184 }
183 185
184 void HardwareRenderer::ReturnResources( 186 void HardwareRenderer::ReturnResources(
185 const cc::ReturnedResourceArray& resources) { 187 const cc::ReturnedResourceArray& resources) {
186 ReturnResourcesToCompositor(resources, compositor_id_, 188 ReturnResourcesToCompositor(resources, compositor_id_,
187 last_submitted_compositor_frame_sink_id_); 189 last_submitted_compositor_frame_sink_id_);
188 } 190 }
189 191
190 void HardwareRenderer::SetBeginFrameSource( 192 void HardwareRenderer::SetBeginFrameSource(
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 const cc::ReturnedResourceArray& resources, 250 const cc::ReturnedResourceArray& resources,
249 const CompositorID& compositor_id, 251 const CompositorID& compositor_id,
250 uint32_t compositor_frame_sink_id) { 252 uint32_t compositor_frame_sink_id) {
251 if (compositor_frame_sink_id != last_committed_compositor_frame_sink_id_) 253 if (compositor_frame_sink_id != last_committed_compositor_frame_sink_id_)
252 return; 254 return;
253 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id, 255 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id,
254 compositor_frame_sink_id); 256 compositor_frame_sink_id);
255 } 257 }
256 258
257 } // namespace android_webview 259 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | android_webview/browser/surfaces_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698