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

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

Issue 2449853004: Getting rid of DelegatedFrameData (Closed)
Patch Set: nit 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
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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 surface_factory_->Reset(); 118 surface_factory_->Reset();
119 compositor_id_ = child_frame_->compositor_id; 119 compositor_id_ = child_frame_->compositor_id;
120 last_submitted_compositor_frame_sink_id_ = 120 last_submitted_compositor_frame_sink_id_ =
121 child_frame_->compositor_frame_sink_id; 121 child_frame_->compositor_frame_sink_id;
122 } 122 }
123 123
124 std::unique_ptr<cc::CompositorFrame> child_compositor_frame = 124 std::unique_ptr<cc::CompositorFrame> child_compositor_frame =
125 std::move(child_frame_->frame); 125 std::move(child_frame_->frame);
126 126
127 gfx::Size frame_size = 127 gfx::Size frame_size =
128 child_compositor_frame->delegated_frame_data->render_pass_list.back() 128 child_compositor_frame->render_pass_list.back()->output_rect.size();
129 ->output_rect.size();
130 bool size_changed = frame_size != frame_size_; 129 bool size_changed = frame_size != frame_size_;
131 frame_size_ = frame_size; 130 frame_size_ = frame_size;
132 if (!child_id_.is_valid() || size_changed) { 131 if (!child_id_.is_valid() || size_changed) {
133 if (child_id_.is_valid()) 132 if (child_id_.is_valid())
134 DestroySurface(); 133 DestroySurface();
135 AllocateSurface(); 134 AllocateSurface();
136 } 135 }
137 136
138 surface_factory_->SubmitCompositorFrame(child_id_, 137 surface_factory_->SubmitCompositorFrame(child_id_,
139 std::move(*child_compositor_frame), 138 std::move(*child_compositor_frame),
(...skipping 29 matching lines...) Expand all
169 DCHECK(!child_id_.is_valid()); 168 DCHECK(!child_id_.is_valid());
170 child_id_ = surface_id_allocator_->GenerateId(); 169 child_id_ = surface_id_allocator_->GenerateId();
171 surface_factory_->Create(child_id_); 170 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 cc::CompositorFrame empty_frame; 178 surface_factory_->SubmitCompositorFrame(child_id_, cc::CompositorFrame(),
180 empty_frame.delegated_frame_data =
181 base::WrapUnique(new cc::DelegatedFrameData);
182 surface_factory_->SubmitCompositorFrame(child_id_, std::move(empty_frame),
183 cc::SurfaceFactory::DrawCallback()); 179 cc::SurfaceFactory::DrawCallback());
184 180
185 surfaces_->RemoveChildId(cc::SurfaceId(frame_sink_id_, child_id_)); 181 surfaces_->RemoveChildId(cc::SurfaceId(frame_sink_id_, child_id_));
186 surface_factory_->Destroy(child_id_); 182 surface_factory_->Destroy(child_id_);
187 child_id_ = cc::LocalFrameId(); 183 child_id_ = cc::LocalFrameId();
188 } 184 }
189 185
190 void HardwareRenderer::ReturnResources( 186 void HardwareRenderer::ReturnResources(
191 const cc::ReturnedResourceArray& resources) { 187 const cc::ReturnedResourceArray& resources) {
192 ReturnResourcesToCompositor(resources, compositor_id_, 188 ReturnResourcesToCompositor(resources, compositor_id_,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 } 230 }
235 return pruned_frames; 231 return pruned_frames;
236 } 232 }
237 233
238 void HardwareRenderer::ReturnChildFrame( 234 void HardwareRenderer::ReturnChildFrame(
239 std::unique_ptr<ChildFrame> child_frame) { 235 std::unique_ptr<ChildFrame> child_frame) {
240 if (!child_frame || !child_frame->frame) 236 if (!child_frame || !child_frame->frame)
241 return; 237 return;
242 238
243 cc::ReturnedResourceArray resources_to_return; 239 cc::ReturnedResourceArray resources_to_return;
244 cc::TransferableResource::ReturnResources( 240 cc::TransferableResource::ReturnResources(child_frame->frame->resource_list,
245 child_frame->frame->delegated_frame_data->resource_list, 241 &resources_to_return);
246 &resources_to_return);
247 242
248 // The child frame's compositor id is not necessarily same as 243 // The child frame's compositor id is not necessarily same as
249 // compositor_id_. 244 // compositor_id_.
250 ReturnResourcesToCompositor(resources_to_return, child_frame->compositor_id, 245 ReturnResourcesToCompositor(resources_to_return, child_frame->compositor_id,
251 child_frame->compositor_frame_sink_id); 246 child_frame->compositor_frame_sink_id);
252 } 247 }
253 248
254 void HardwareRenderer::ReturnResourcesToCompositor( 249 void HardwareRenderer::ReturnResourcesToCompositor(
255 const cc::ReturnedResourceArray& resources, 250 const cc::ReturnedResourceArray& resources,
256 const CompositorID& compositor_id, 251 const CompositorID& compositor_id,
257 uint32_t compositor_frame_sink_id) { 252 uint32_t compositor_frame_sink_id) {
258 if (compositor_frame_sink_id != last_committed_compositor_frame_sink_id_) 253 if (compositor_frame_sink_id != last_committed_compositor_frame_sink_id_)
259 return; 254 return;
260 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id, 255 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id,
261 compositor_frame_sink_id); 256 compositor_frame_sink_id);
262 } 257 }
263 258
264 } // namespace android_webview 259 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/browser_view_renderer.cc ('k') | android_webview/browser/surfaces_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698