Index: components/surfaces/surfaces_service_application.cc |
diff --git a/components/surfaces/surfaces_service_application.cc b/components/surfaces/surfaces_service_application.cc |
index 172a394dd727cdf7c73229239d3eab3b67685f67..a6ec975160dbc5951c1605a6a3a4bd69a35051ef 100644 |
--- a/components/surfaces/surfaces_service_application.cc |
+++ b/components/surfaces/surfaces_service_application.cc |
@@ -4,6 +4,7 @@ |
#include "components/surfaces/surfaces_service_application.h" |
+#include "base/stl_util.h" |
#include "components/surfaces/display_factory_impl.h" |
#include "components/surfaces/surfaces_impl.h" |
#include "components/surfaces/surfaces_scheduler.h" |
@@ -15,6 +16,8 @@ SurfacesServiceApplication::SurfacesServiceApplication() |
} |
SurfacesServiceApplication::~SurfacesServiceApplication() { |
+ STLDeleteElements(&display_factories_); |
+ STLDeleteElements(&surfaces_); |
} |
void SurfacesServiceApplication::Initialize(mojo::ApplicationImpl* app) { |
@@ -32,15 +35,26 @@ bool SurfacesServiceApplication::ConfigureIncomingConnection( |
void SurfacesServiceApplication::Create( |
mojo::ApplicationConnection* connection, |
mojo::InterfaceRequest<mojo::DisplayFactory> request) { |
- new DisplayFactoryImpl(&manager_, next_id_namespace_++, scheduler_.get(), |
- request.Pass()); |
+ display_factories_.insert( |
+ new DisplayFactoryImpl(this, &manager_, next_id_namespace_++, |
+ scheduler_.get(), request.Pass())); |
} |
void SurfacesServiceApplication::Create( |
mojo::ApplicationConnection* connection, |
mojo::InterfaceRequest<mojo::Surface> request) { |
- new SurfacesImpl(&manager_, next_id_namespace_++, scheduler_.get(), |
- request.Pass()); |
+ surfaces_.insert( |
+ new SurfacesImpl(this, &manager_, next_id_namespace_++, scheduler_.get(), |
+ request.Pass())); |
+} |
+ |
+void SurfacesServiceApplication::DisplayFactoryDestroyed( |
+ DisplayFactoryImpl* display_factory) { |
+ display_factories_.erase(display_factory); |
+} |
+ |
+void SurfacesServiceApplication::SurfaceDestroyed(SurfacesImpl* surface) { |
+ surfaces_.erase(surface); |
} |
} // namespace surfaces |