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

Unified Diff: components/exo/surface.cc

Issue 2458833003: Revert of [M55] Generalize layer mirroring for phantom windows (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/exo/surface.h ('k') | components/exo/surface_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/surface.cc
diff --git a/components/exo/surface.cc b/components/exo/surface.cc
index 26ebf01528ab467084ea4bb0a5e8cd6fea8acb59..5f22ec6fd64ad5a361039368515743886f0a1530 100644
--- a/components/exo/surface.cc
+++ b/components/exo/surface.cc
@@ -210,6 +210,7 @@
window_->SetName("ExoSurface");
window_->SetProperty(kSurfaceKey, this);
window_->Init(ui::LAYER_SOLID_COLOR);
+ window_->set_layer_owner_delegate(this);
window_->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter));
window_->set_owned_by_parent(false);
factory_owner_->surface_ = this;
@@ -486,16 +487,13 @@
if (old_local_frame_id != local_frame_id_) {
float contents_surface_to_layer_scale = 1.0;
- // The bounds must be updated before switching to the new surface, because
- // the layer may be mirrored, in which case a surface change causes the
- // mirror layer to update its surface using the latest bounds.
- window_->layer()->SetBounds(
- gfx::Rect(window_->layer()->bounds().origin(), content_size_));
window_->layer()->SetShowSurface(
cc::SurfaceId(factory_owner_->frame_sink_id_, local_frame_id_),
base::Bind(&SatisfyCallback, base::Unretained(surface_manager_)),
base::Bind(&RequireCallback, base::Unretained(surface_manager_)),
content_size_, contents_surface_to_layer_scale, content_size_);
+ window_->layer()->SetBounds(
+ gfx::Rect(window_->layer()->bounds().origin(), content_size_));
window_->layer()->SetFillsBoundsOpaquely(
state_.blend_mode == SkXfermode::kSrc_Mode ||
state_.opaque_region.contains(
@@ -609,6 +607,17 @@
new base::trace_event::TracedValue());
value->SetString("name", window_->layer()->name());
return value;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// ui::LayerOwnerDelegate overrides:
+
+void Surface::OnLayerRecreated(ui::Layer* old_layer, ui::Layer* new_layer) {
+ if (!current_buffer_.buffer())
+ return;
+
+ // TODO(reveman): Give the client a chance to provide new contents.
+ SetSurfaceLayerContents(new_layer);
}
void Surface::WillDraw(const cc::LocalFrameId& id) {
@@ -683,6 +692,20 @@
for (auto& sub_surface_entry : pending_sub_surfaces_) {
sub_surface_entry.first->SetSurfaceHierarchyNeedsCommitToNewSurfaces();
}
+}
+
+void Surface::SetSurfaceLayerContents(ui::Layer* layer) {
+ if (local_frame_id_.is_null())
+ return;
+
+ gfx::Size layer_size = layer->bounds().size();
+ float contents_surface_to_layer_scale = 1.0f;
+
+ layer->SetShowSurface(
+ cc::SurfaceId(factory_owner_->frame_sink_id_, local_frame_id_),
+ base::Bind(&SatisfyCallback, base::Unretained(surface_manager_)),
+ base::Bind(&RequireCallback, base::Unretained(surface_manager_)),
+ layer_size, contents_surface_to_layer_scale, layer_size);
}
void Surface::UpdateResource(bool client_usage) {
« no previous file with comments | « components/exo/surface.h ('k') | components/exo/surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698