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

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

Issue 2848223003: Enforce constant size and device scale factor for surfaces (Closed)
Patch Set: Notify CFSSClient when a frame is rejected 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;
142 frame.metadata.referenced_surfaces = child_ids_; 143 frame.metadata.referenced_surfaces = child_ids_;
143 144
144 if (!root_id_.is_valid() || frame_size != surface_size_) { 145 if (!root_id_.is_valid() || frame_size != surface_size_) {
145 root_id_ = local_surface_id_allocator_->GenerateId(); 146 root_id_ = local_surface_id_allocator_->GenerateId();
146 surface_size_ = frame_size; 147 surface_size_ = frame_size;
147 display_->SetLocalSurfaceId(root_id_, 1.f); 148 display_->SetLocalSurfaceId(root_id_, 1.f);
148 } 149 }
149 support_->SubmitCompositorFrame(root_id_, std::move(frame)); 150 support_->SubmitCompositorFrame(root_id_, std::move(frame));
150 151
151 display_->Resize(viewport); 152 display_->Resize(viewport);
(...skipping 27 matching lines...) Expand all
179 SkBlendMode::kSrcOver, 0); 180 SkBlendMode::kSrcOver, 0);
180 cc::SolidColorDrawQuad* solid_quad = 181 cc::SolidColorDrawQuad* solid_quad =
181 render_pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>(); 182 render_pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>();
182 solid_quad->SetNew(quad_state, rect, rect, SK_ColorBLACK, false); 183 solid_quad->SetNew(quad_state, rect, rect, SK_ColorBLACK, false);
183 cc::CompositorFrame frame; 184 cc::CompositorFrame frame;
184 frame.render_pass_list.push_back(std::move(render_pass)); 185 frame.render_pass_list.push_back(std::move(render_pass));
185 // We draw synchronously, so acknowledge a manual BeginFrame. 186 // We draw synchronously, so acknowledge a manual BeginFrame.
186 frame.metadata.begin_frame_ack = 187 frame.metadata.begin_frame_ack =
187 cc::BeginFrameAck::CreateManualAckWithDamage(); 188 cc::BeginFrameAck::CreateManualAckWithDamage();
188 frame.metadata.referenced_surfaces = child_ids_; 189 frame.metadata.referenced_surfaces = child_ids_;
190 frame.metadata.device_scale_factor = 1;
189 support_->SubmitCompositorFrame(root_id_, std::move(frame)); 191 support_->SubmitCompositorFrame(root_id_, std::move(frame));
190 } 192 }
191 193
192 void SurfacesInstance::DidReceiveCompositorFrameAck( 194 void SurfacesInstance::DidReceiveCompositorFrameAck(
193 const cc::ReturnedResourceArray& resources) { 195 const cc::ReturnedResourceArray& resources) {
194 ReclaimResources(resources); 196 ReclaimResources(resources);
195 } 197 }
196 198
197 void SurfacesInstance::OnBeginFrame(const cc::BeginFrameArgs& args) {} 199 void SurfacesInstance::OnBeginFrame(const cc::BeginFrameArgs& args) {}
198 200
199 void SurfacesInstance::WillDrawSurface( 201 void SurfacesInstance::WillDrawSurface(
200 const cc::LocalSurfaceId& local_surface_id, 202 const cc::LocalSurfaceId& local_surface_id,
201 const gfx::Rect& damage_rect) {} 203 const gfx::Rect& damage_rect) {}
202 204
203 void SurfacesInstance::ReclaimResources( 205 void SurfacesInstance::ReclaimResources(
204 const cc::ReturnedResourceArray& resources) { 206 const cc::ReturnedResourceArray& resources) {
205 // Root surface should have no resources to return. 207 // Root surface should have no resources to return.
206 CHECK(resources.empty()); 208 CHECK(resources.empty());
207 } 209 }
208 210
211 void SurfacesInstance::DidRejectCompositorFrame() {
212 NOTREACHED();
213 }
214
209 } // namespace android_webview 215 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698