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

Unified Diff: services/ui/ws/server_window_surface.cc

Issue 2400723003: Mus+Ash: Use standard cc mechanism for surface lifetime. (Closed)
Patch Set: Only AddObserver once 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 | « services/ui/ws/server_window_surface.h ('k') | services/ui/ws/test_server_window_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/server_window_surface.cc
diff --git a/services/ui/ws/server_window_surface.cc b/services/ui/ws/server_window_surface.cc
index eeb88372c3f89b5fd970f9a97daf16bed76453c8..48f4fd588b6a5129d2f6d694c6398341e7f11411 100644
--- a/services/ui/ws/server_window_surface.cc
+++ b/services/ui/ws/server_window_surface.cc
@@ -50,17 +50,8 @@ void ServerWindowSurface::SubmitCompositorFrame(
// If the size of the CompostiorFrame has changed then destroy the existing
// Surface and create a new one of the appropriate size.
if (local_frame_id_.is_null() || frame_size != last_submitted_frame_size_) {
- // Rendering of the topmost frame happens in two phases. First the frame
- // is generated and submitted, and a later date it is actually drawn.
- // During the time the frame is generated and drawn we can't destroy the
- // surface, otherwise when drawn you get an empty surface. To deal with
- // this we schedule destruction via the delegate. The delegate will call
- // us back when we're not waiting on a frame to be drawn (which may be
- // synchronously).
- if (!local_frame_id_.is_null()) {
- surfaces_scheduled_for_destruction_.insert(local_frame_id_);
- window()->delegate()->ScheduleSurfaceDestruction(window());
- }
+ if (!local_frame_id_.is_null())
+ surface_factory_.Destroy(local_frame_id_);
local_frame_id_ = surface_id_allocator_.GenerateId();
surface_factory_.Create(local_frame_id_);
}
@@ -72,16 +63,11 @@ void ServerWindowSurface::SubmitCompositorFrame(
}
cc::SurfaceId ServerWindowSurface::GetSurfaceId() const {
+ if (local_frame_id_.is_null())
+ return cc::SurfaceId();
return cc::SurfaceId(frame_sink_id_, local_frame_id_);
}
-void ServerWindowSurface::DestroySurfacesScheduledForDestruction() {
- std::set<cc::LocalFrameId> surfaces;
- surfaces.swap(surfaces_scheduled_for_destruction_);
- for (auto& id : surfaces)
- surface_factory_.Destroy(id);
-}
-
ServerWindow* ServerWindowSurface::window() {
return manager_->window();
}
« no previous file with comments | « services/ui/ws/server_window_surface.h ('k') | services/ui/ws/test_server_window_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698