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 154667fe85212f10a0b7d5f22d8f1150566f388d..31e1062641e1376c819401fa559e932006a3a015 100644 |
--- a/services/ui/ws/server_window_surface.cc |
+++ b/services/ui/ws/server_window_surface.cc |
@@ -29,23 +29,19 @@ ServerWindowSurface::ServerWindowSurface( |
mojom::SurfaceClientPtr client) |
: manager_(manager), |
surface_id_(manager->GenerateId()), |
- surface_factory_(manager_->GetSurfaceManager(), this), |
client_(std::move(client)), |
- binding_(this, std::move(request)), |
- registered_surface_factory_client_(false) { |
- surface_factory_.Create(surface_id_); |
+ binding_(this, std::move(request)) { |
+ surface_factory_.reset(new cc::SurfaceFactory( |
+ manager_->client_id(), manager_->GetSurfaceManager(), this)); |
+ // TODO(fsamuel): We shouldn't do this. |
+ surface_factory_->Create(surface_id_); |
} |
ServerWindowSurface::~ServerWindowSurface() { |
// SurfaceFactory's destructor will attempt to return resources which will |
// call back into here and access |client_| so we should destroy |
// |surface_factory_|'s resources early on. |
- surface_factory_.DestroyAll(); |
- |
- if (registered_surface_factory_client_) { |
- cc::SurfaceManager* surface_manager = manager_->GetSurfaceManager(); |
- surface_manager->UnregisterSurfaceFactoryClient(manager_->client_id()); |
- } |
+ surface_factory_.reset(); |
} |
void ServerWindowSurface::SubmitCompositorFrame( |
@@ -67,11 +63,11 @@ void ServerWindowSurface::SubmitCompositorFrame( |
surfaces_scheduled_for_destruction_.insert(surface_id_); |
window()->delegate()->ScheduleSurfaceDestruction(window()); |
surface_id_ = manager_->GenerateId(); |
- surface_factory_.Create(surface_id_); |
+ surface_factory_->Create(surface_id_); |
} |
} |
- surface_factory_.SubmitCompositorFrame(surface_id_, std::move(frame), |
- base::Bind(&CallCallback, callback)); |
+ surface_factory_->SubmitCompositorFrame(surface_id_, std::move(frame), |
+ base::Bind(&CallCallback, callback)); |
last_submitted_frame_size_ = frame_size; |
window()->delegate()->OnScheduleWindowPaint(window()); |
} |
@@ -80,14 +76,7 @@ void ServerWindowSurface::DestroySurfacesScheduledForDestruction() { |
std::set<cc::SurfaceId> surfaces; |
surfaces.swap(surfaces_scheduled_for_destruction_); |
for (auto& id : surfaces) |
- surface_factory_.Destroy(id); |
-} |
- |
-void ServerWindowSurface::RegisterForBeginFrames() { |
- DCHECK(!registered_surface_factory_client_); |
- registered_surface_factory_client_ = true; |
- cc::SurfaceManager* surface_manager = manager_->GetSurfaceManager(); |
- surface_manager->RegisterSurfaceFactoryClient(manager_->client_id(), this); |
+ surface_factory_->Destroy(id); |
} |
ServerWindow* ServerWindowSurface::window() { |