Chromium Code Reviews| Index: cc/surfaces/surface_factory.cc |
| diff --git a/cc/surfaces/surface_factory.cc b/cc/surfaces/surface_factory.cc |
| index 3e83c8cfd7341c57485af26fbcc9873e8b2beb51..6cc9d4938cecd2e4e14ca15325d73455cee418fa 100644 |
| --- a/cc/surfaces/surface_factory.cc |
| +++ b/cc/surfaces/surface_factory.cc |
| @@ -8,6 +8,7 @@ |
| #include "cc/output/compositor_frame.h" |
| #include "cc/output/copy_output_request.h" |
| #include "cc/surfaces/surface.h" |
| +#include "cc/surfaces/surface_factory_client.h" |
| #include "cc/surfaces/surface_manager.h" |
| #include "ui/gfx/geometry/size.h" |
| @@ -26,6 +27,7 @@ SurfaceFactory::~SurfaceFactory() { |
| << " entries in map on destruction."; |
| } |
| DestroyAll(); |
| + client_->SetBeginFrameSource(nullptr); |
| } |
| void SurfaceFactory::DestroyAll() { |
| @@ -39,6 +41,7 @@ void SurfaceFactory::Create(SurfaceId surface_id) { |
| manager_->RegisterSurface(surface.get()); |
| DCHECK(!surface_map_.count(surface_id)); |
| surface_map_.add(surface_id, surface.Pass()); |
| + most_recently_created_surface_id_ = surface_id; |
| } |
| void SurfaceFactory::Destroy(SurfaceId surface_id) { |
| @@ -48,6 +51,14 @@ void SurfaceFactory::Destroy(SurfaceId surface_id) { |
| manager_->Destroy(surface_map_.take_and_erase(it)); |
| } |
| +void SurfaceFactory::SetBeginFrameSource(SurfaceId surface_id, |
| + BeginFrameSource* begin_frame_source) { |
| + if (most_recently_created_surface_id_ != surface_id) |
|
mithro-old
2015/10/01 03:00:24
nit: Can you add a comment about why this check is
brianderson
2015/10/07 20:54:48
Done.
|
| + return; |
| + |
| + client_->SetBeginFrameSource(begin_frame_source); |
| +} |
| + |
| void SurfaceFactory::SubmitCompositorFrame(SurfaceId surface_id, |
| scoped_ptr<CompositorFrame> frame, |
| const DrawCallback& callback) { |