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

Unified Diff: cc/surfaces/surface_factory.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 | « cc/surfaces/surface_factory.h ('k') | cc/surfaces/surface_factory_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_factory.cc
diff --git a/cc/surfaces/surface_factory.cc b/cc/surfaces/surface_factory.cc
index 345171a0f31f76873a83c1c1d01071a38f23ef4e..27c6f6cd50307fee33e8bf4e8e60ce888e2b1b80 100644
--- a/cc/surfaces/surface_factory.cc
+++ b/cc/surfaces/surface_factory.cc
@@ -15,12 +15,17 @@
#include "ui/gfx/geometry/size.h"
namespace cc {
-SurfaceFactory::SurfaceFactory(SurfaceManager* manager,
+
+SurfaceFactory::SurfaceFactory(uint32_t client_id,
+ SurfaceManager* manager,
SurfaceFactoryClient* client)
- : manager_(manager),
+ : client_id_(client_id),
+ parent_client_id_(0),
+ manager_(manager),
client_(client),
holder_(client),
needs_sync_points_(true) {
+ manager_->RegisterClient(client_id_, client);
}
SurfaceFactory::~SurfaceFactory() {
@@ -29,6 +34,23 @@ SurfaceFactory::~SurfaceFactory() {
<< " entries in map on destruction.";
}
DestroyAll();
+ if (manager_) {
+ if (parent_client_id_) {
+ manager_->UnregisterSurfaceNamespaceHierarchy(parent_client_id_,
+ client_id_);
+ }
+ manager_->UnregisterClient(client_id_);
+ }
+}
+
+void SurfaceFactory::SetParent(uint32_t parent_client_id) {
+ if (parent_client_id_) {
+ manager_->UnregisterSurfaceNamespaceHierarchy(parent_client_id_,
+ client_id_);
+ }
+ parent_client_id_ = parent_client_id;
+ if (parent_client_id_)
+ manager_->RegisterSurfaceNamespaceHierarchy(parent_client_id_, client_id_);
}
void SurfaceFactory::DestroyAll() {
« no previous file with comments | « cc/surfaces/surface_factory.h ('k') | cc/surfaces/surface_factory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698