| Index: cc/surfaces/surface_factory.cc
|
| diff --git a/cc/surfaces/surface_factory.cc b/cc/surfaces/surface_factory.cc
|
| index d56b3174a8cc41d399468e8def7dc3991b3cdd17..f34fafc40fd0b39f2923fb6340119bf1aedee1ea 100644
|
| --- a/cc/surfaces/surface_factory.cc
|
| +++ b/cc/surfaces/surface_factory.cc
|
| @@ -32,14 +32,18 @@ SurfaceFactory::~SurfaceFactory() {
|
| }
|
|
|
| void SurfaceFactory::DestroyAll() {
|
| + if (manager_) {
|
| for (auto& pair : surface_map_)
|
| manager_->Destroy(std::move(pair.second));
|
| +
|
| surface_map_.clear();
|
| + }
|
| }
|
|
|
| void SurfaceFactory::Create(SurfaceId surface_id) {
|
| std::unique_ptr<Surface> surface(new Surface(surface_id, this));
|
| - manager_->RegisterSurface(surface.get());
|
| + if (manager_)
|
| + manager_->RegisterSurface(surface.get());
|
| DCHECK(!surface_map_.count(surface_id));
|
| surface_map_[surface_id] = std::move(surface);
|
| }
|
| @@ -50,7 +54,8 @@ void SurfaceFactory::Destroy(SurfaceId surface_id) {
|
| DCHECK(it->second->factory().get() == this);
|
| std::unique_ptr<Surface> surface(std::move(it->second));
|
| surface_map_.erase(it);
|
| - manager_->Destroy(std::move(surface));
|
| + if (manager_)
|
| + manager_->Destroy(std::move(surface));
|
| }
|
|
|
| void SurfaceFactory::SetPreviousFrameSurface(SurfaceId new_id,
|
|
|