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

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

Issue 2905523003: Revert of Enforce constant size and device scale factor for surfaces (Closed)
Patch Set: Created 3 years, 7 months 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 render_pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); 132 render_pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>();
133 surface_quad->SetNew(quad_state, gfx::Rect(quad_state->quad_layer_rect), 133 surface_quad->SetNew(quad_state, gfx::Rect(quad_state->quad_layer_rect),
134 gfx::Rect(quad_state->quad_layer_rect), child_id, 134 gfx::Rect(quad_state->quad_layer_rect), child_id,
135 cc::SurfaceDrawQuadType::PRIMARY, nullptr); 135 cc::SurfaceDrawQuadType::PRIMARY, nullptr);
136 136
137 cc::CompositorFrame frame; 137 cc::CompositorFrame frame;
138 // We draw synchronously, so acknowledge a manual BeginFrame. 138 // We draw synchronously, so acknowledge a manual BeginFrame.
139 frame.metadata.begin_frame_ack = 139 frame.metadata.begin_frame_ack =
140 cc::BeginFrameAck::CreateManualAckWithDamage(); 140 cc::BeginFrameAck::CreateManualAckWithDamage();
141 frame.render_pass_list.push_back(std::move(render_pass)); 141 frame.render_pass_list.push_back(std::move(render_pass));
142 frame.metadata.device_scale_factor = 1.f;
143 frame.metadata.referenced_surfaces = child_ids_; 142 frame.metadata.referenced_surfaces = child_ids_;
144 143
145 if (!root_id_.is_valid() || frame_size != surface_size_) { 144 if (!root_id_.is_valid() || frame_size != surface_size_) {
146 root_id_ = local_surface_id_allocator_->GenerateId(); 145 root_id_ = local_surface_id_allocator_->GenerateId();
147 surface_size_ = frame_size; 146 surface_size_ = frame_size;
148 display_->SetLocalSurfaceId(root_id_, 1.f); 147 display_->SetLocalSurfaceId(root_id_, 1.f);
149 } 148 }
150 bool result = support_->SubmitCompositorFrame(root_id_, std::move(frame)); 149 support_->SubmitCompositorFrame(root_id_, std::move(frame));
151 DCHECK(result);
152 150
153 display_->Resize(viewport); 151 display_->Resize(viewport);
154 display_->DrawAndSwap(); 152 display_->DrawAndSwap();
155 } 153 }
156 154
157 void SurfacesInstance::AddChildId(const cc::SurfaceId& child_id) { 155 void SurfacesInstance::AddChildId(const cc::SurfaceId& child_id) {
158 DCHECK(std::find(child_ids_.begin(), child_ids_.end(), child_id) == 156 DCHECK(std::find(child_ids_.begin(), child_ids_.end(), child_id) ==
159 child_ids_.end()); 157 child_ids_.end());
160 child_ids_.push_back(child_id); 158 child_ids_.push_back(child_id);
161 if (root_id_.is_valid()) 159 if (root_id_.is_valid())
(...skipping 19 matching lines...) Expand all
181 SkBlendMode::kSrcOver, 0); 179 SkBlendMode::kSrcOver, 0);
182 cc::SolidColorDrawQuad* solid_quad = 180 cc::SolidColorDrawQuad* solid_quad =
183 render_pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>(); 181 render_pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>();
184 solid_quad->SetNew(quad_state, rect, rect, SK_ColorBLACK, false); 182 solid_quad->SetNew(quad_state, rect, rect, SK_ColorBLACK, false);
185 cc::CompositorFrame frame; 183 cc::CompositorFrame frame;
186 frame.render_pass_list.push_back(std::move(render_pass)); 184 frame.render_pass_list.push_back(std::move(render_pass));
187 // We draw synchronously, so acknowledge a manual BeginFrame. 185 // We draw synchronously, so acknowledge a manual BeginFrame.
188 frame.metadata.begin_frame_ack = 186 frame.metadata.begin_frame_ack =
189 cc::BeginFrameAck::CreateManualAckWithDamage(); 187 cc::BeginFrameAck::CreateManualAckWithDamage();
190 frame.metadata.referenced_surfaces = child_ids_; 188 frame.metadata.referenced_surfaces = child_ids_;
191 frame.metadata.device_scale_factor = 1; 189 support_->SubmitCompositorFrame(root_id_, std::move(frame));
192 bool result = support_->SubmitCompositorFrame(root_id_, std::move(frame));
193 DCHECK(result);
194 } 190 }
195 191
196 void SurfacesInstance::DidReceiveCompositorFrameAck( 192 void SurfacesInstance::DidReceiveCompositorFrameAck(
197 const cc::ReturnedResourceArray& resources) { 193 const cc::ReturnedResourceArray& resources) {
198 ReclaimResources(resources); 194 ReclaimResources(resources);
199 } 195 }
200 196
201 void SurfacesInstance::OnBeginFrame(const cc::BeginFrameArgs& args) {} 197 void SurfacesInstance::OnBeginFrame(const cc::BeginFrameArgs& args) {}
202 198
203 void SurfacesInstance::WillDrawSurface( 199 void SurfacesInstance::WillDrawSurface(
204 const cc::LocalSurfaceId& local_surface_id, 200 const cc::LocalSurfaceId& local_surface_id,
205 const gfx::Rect& damage_rect) {} 201 const gfx::Rect& damage_rect) {}
206 202
207 void SurfacesInstance::ReclaimResources( 203 void SurfacesInstance::ReclaimResources(
208 const cc::ReturnedResourceArray& resources) { 204 const cc::ReturnedResourceArray& resources) {
209 // Root surface should have no resources to return. 205 // Root surface should have no resources to return.
210 CHECK(resources.empty()); 206 CHECK(resources.empty());
211 } 207 }
212 208
213 } // namespace android_webview 209 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/hardware_renderer.cc ('k') | android_webview/browser/test/rendering_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698