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

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

Issue 2144733005: [WIP] cc: Plumb SurfaceId from clients Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ensure only SurfaceFactoy and tests can update hierarchy Created 4 years, 5 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/server_window_surface_manager.cc » ('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 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() {
« no previous file with comments | « services/ui/ws/server_window_surface.h ('k') | services/ui/ws/server_window_surface_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698