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

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

Issue 2503203002: Revert "Getting rid of DelegatedFrameData" (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
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->render_pass_list.back()->output_rect.size(); 128 child_compositor_frame->delegated_frame_data->render_pass_list.back()
129 ->output_rect.size();
129 bool size_changed = frame_size != frame_size_; 130 bool size_changed = frame_size != frame_size_;
130 frame_size_ = frame_size; 131 frame_size_ = frame_size;
131 if (!child_id_.is_valid() || size_changed) { 132 if (!child_id_.is_valid() || size_changed) {
132 if (child_id_.is_valid()) 133 if (child_id_.is_valid())
133 DestroySurface(); 134 DestroySurface();
134 AllocateSurface(); 135 AllocateSurface();
135 } 136 }
136 137
137 surface_factory_->SubmitCompositorFrame(child_id_, 138 surface_factory_->SubmitCompositorFrame(child_id_,
138 std::move(*child_compositor_frame), 139 std::move(*child_compositor_frame),
(...skipping 29 matching lines...) Expand all
168 DCHECK(!child_id_.is_valid()); 169 DCHECK(!child_id_.is_valid());
169 child_id_ = surface_id_allocator_->GenerateId(); 170 child_id_ = surface_id_allocator_->GenerateId();
170 surface_factory_->Create(child_id_); 171 surface_factory_->Create(child_id_);
171 surfaces_->AddChildId(cc::SurfaceId(frame_sink_id_, child_id_)); 172 surfaces_->AddChildId(cc::SurfaceId(frame_sink_id_, child_id_));
172 } 173 }
173 174
174 void HardwareRenderer::DestroySurface() { 175 void HardwareRenderer::DestroySurface() {
175 DCHECK(child_id_.is_valid()); 176 DCHECK(child_id_.is_valid());
176 177
177 // Submit an empty frame to force any existing resources to be returned. 178 // Submit an empty frame to force any existing resources to be returned.
178 surface_factory_->SubmitCompositorFrame(child_id_, cc::CompositorFrame(), 179 cc::CompositorFrame empty_frame;
180 empty_frame.delegated_frame_data =
181 base::WrapUnique(new cc::DelegatedFrameData);
182 surface_factory_->SubmitCompositorFrame(child_id_, std::move(empty_frame),
179 cc::SurfaceFactory::DrawCallback()); 183 cc::SurfaceFactory::DrawCallback());
180 184
181 surfaces_->RemoveChildId(cc::SurfaceId(frame_sink_id_, child_id_)); 185 surfaces_->RemoveChildId(cc::SurfaceId(frame_sink_id_, child_id_));
182 surface_factory_->Destroy(child_id_); 186 surface_factory_->Destroy(child_id_);
183 child_id_ = cc::LocalFrameId(); 187 child_id_ = cc::LocalFrameId();
184 } 188 }
185 189
186 void HardwareRenderer::ReturnResources( 190 void HardwareRenderer::ReturnResources(
187 const cc::ReturnedResourceArray& resources) { 191 const cc::ReturnedResourceArray& resources) {
188 ReturnResourcesToCompositor(resources, compositor_id_, 192 ReturnResourcesToCompositor(resources, compositor_id_,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 } 234 }
231 return pruned_frames; 235 return pruned_frames;
232 } 236 }
233 237
234 void HardwareRenderer::ReturnChildFrame( 238 void HardwareRenderer::ReturnChildFrame(
235 std::unique_ptr<ChildFrame> child_frame) { 239 std::unique_ptr<ChildFrame> child_frame) {
236 if (!child_frame || !child_frame->frame) 240 if (!child_frame || !child_frame->frame)
237 return; 241 return;
238 242
239 cc::ReturnedResourceArray resources_to_return; 243 cc::ReturnedResourceArray resources_to_return;
240 cc::TransferableResource::ReturnResources(child_frame->frame->resource_list, 244 cc::TransferableResource::ReturnResources(
241 &resources_to_return); 245 child_frame->frame->delegated_frame_data->resource_list,
246 &resources_to_return);
242 247
243 // The child frame's compositor id is not necessarily same as 248 // The child frame's compositor id is not necessarily same as
244 // compositor_id_. 249 // compositor_id_.
245 ReturnResourcesToCompositor(resources_to_return, child_frame->compositor_id, 250 ReturnResourcesToCompositor(resources_to_return, child_frame->compositor_id,
246 child_frame->compositor_frame_sink_id); 251 child_frame->compositor_frame_sink_id);
247 } 252 }
248 253
249 void HardwareRenderer::ReturnResourcesToCompositor( 254 void HardwareRenderer::ReturnResourcesToCompositor(
250 const cc::ReturnedResourceArray& resources, 255 const cc::ReturnedResourceArray& resources,
251 const CompositorID& compositor_id, 256 const CompositorID& compositor_id,
252 uint32_t compositor_frame_sink_id) { 257 uint32_t compositor_frame_sink_id) {
253 if (compositor_frame_sink_id != last_committed_compositor_frame_sink_id_) 258 if (compositor_frame_sink_id != last_committed_compositor_frame_sink_id_)
254 return; 259 return;
255 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id, 260 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id,
256 compositor_frame_sink_id); 261 compositor_frame_sink_id);
257 } 262 }
258 263
259 } // namespace android_webview 264 } // 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