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

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

Issue 2449853004: 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/surfaces_instance.h" 5 #include "android_webview/browser/surfaces_instance.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "android_webview/browser/aw_gl_surface.h" 10 #include "android_webview/browser/aw_gl_surface.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 quad_state->visible_quad_layer_rect = gfx::Rect(frame_size); 121 quad_state->visible_quad_layer_rect = gfx::Rect(frame_size);
122 quad_state->clip_rect = clip; 122 quad_state->clip_rect = clip;
123 quad_state->is_clipped = true; 123 quad_state->is_clipped = true;
124 quad_state->opacity = 1.f; 124 quad_state->opacity = 1.f;
125 125
126 cc::SurfaceDrawQuad* surface_quad = 126 cc::SurfaceDrawQuad* surface_quad =
127 render_pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); 127 render_pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>();
128 surface_quad->SetNew(quad_state, gfx::Rect(quad_state->quad_layer_bounds), 128 surface_quad->SetNew(quad_state, gfx::Rect(quad_state->quad_layer_bounds),
129 gfx::Rect(quad_state->quad_layer_bounds), child_id); 129 gfx::Rect(quad_state->quad_layer_bounds), child_id);
130 130
131 std::unique_ptr<cc::DelegatedFrameData> delegated_frame(
132 new cc::DelegatedFrameData);
133 delegated_frame->render_pass_list.push_back(std::move(render_pass));
134 cc::CompositorFrame frame; 131 cc::CompositorFrame frame;
135 frame.delegated_frame_data = std::move(delegated_frame); 132 frame.render_pass_list.push_back(std::move(render_pass));
136 frame.metadata.referenced_surfaces = child_ids_; 133 frame.metadata.referenced_surfaces = child_ids_;
137 134
138 if (root_id_.is_null()) { 135 if (root_id_.is_null()) {
139 root_id_ = surface_id_allocator_->GenerateId(); 136 root_id_ = surface_id_allocator_->GenerateId();
140 surface_factory_->Create(root_id_); 137 surface_factory_->Create(root_id_);
141 display_->SetSurfaceId(cc::SurfaceId(frame_sink_id_, root_id_), 1.f); 138 display_->SetSurfaceId(cc::SurfaceId(frame_sink_id_, root_id_), 1.f);
142 } 139 }
143 surface_factory_->SubmitCompositorFrame(root_id_, std::move(frame), 140 surface_factory_->SubmitCompositorFrame(root_id_, std::move(frame),
144 cc::SurfaceFactory::DrawCallback()); 141 cc::SurfaceFactory::DrawCallback());
145 142
(...skipping 12 matching lines...) Expand all
158 void SurfacesInstance::RemoveChildId(const cc::SurfaceId& child_id) { 155 void SurfacesInstance::RemoveChildId(const cc::SurfaceId& child_id) {
159 auto itr = std::find(child_ids_.begin(), child_ids_.end(), child_id); 156 auto itr = std::find(child_ids_.begin(), child_ids_.end(), child_id);
160 DCHECK(itr != child_ids_.end()); 157 DCHECK(itr != child_ids_.end());
161 child_ids_.erase(itr); 158 child_ids_.erase(itr);
162 if (!root_id_.is_null()) 159 if (!root_id_.is_null())
163 SetEmptyRootFrame(); 160 SetEmptyRootFrame();
164 } 161 }
165 162
166 void SurfacesInstance::SetEmptyRootFrame() { 163 void SurfacesInstance::SetEmptyRootFrame() {
167 cc::CompositorFrame empty_frame; 164 cc::CompositorFrame empty_frame;
168 empty_frame.delegated_frame_data =
169 base::WrapUnique(new cc::DelegatedFrameData);
170 empty_frame.metadata.referenced_surfaces = child_ids_; 165 empty_frame.metadata.referenced_surfaces = child_ids_;
171 surface_factory_->SubmitCompositorFrame(root_id_, std::move(empty_frame), 166 surface_factory_->SubmitCompositorFrame(root_id_, std::move(empty_frame),
172 cc::SurfaceFactory::DrawCallback()); 167 cc::SurfaceFactory::DrawCallback());
173 } 168 }
174 169
175 void SurfacesInstance::ReturnResources( 170 void SurfacesInstance::ReturnResources(
176 const cc::ReturnedResourceArray& resources) { 171 const cc::ReturnedResourceArray& resources) {
177 // Root surface should have no resources to return. 172 // Root surface should have no resources to return.
178 CHECK(resources.empty()); 173 CHECK(resources.empty());
179 } 174 }
180 175
181 void SurfacesInstance::SetBeginFrameSource( 176 void SurfacesInstance::SetBeginFrameSource(
182 cc::BeginFrameSource* begin_frame_source) { 177 cc::BeginFrameSource* begin_frame_source) {
183 // Parent compsitor calls DrawAndSwap directly and doesn't use 178 // Parent compsitor calls DrawAndSwap directly and doesn't use
184 // BeginFrameSource. 179 // BeginFrameSource.
185 } 180 }
186 181
187 } // namespace android_webview 182 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698