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..a48d6f25df4215995a8518beddf11e11b720c814 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,17 @@ void SurfaceFactory::Destroy(SurfaceId surface_id) { |
| manager_->Destroy(surface_map_.take_and_erase(it)); |
| } |
| +void SurfaceFactory::SetBeginFrameSource(SurfaceId surface_id, |
| + BeginFrameSource* begin_frame_source) { |
| + // There may be multiple live surfaces associated with this SurfaceFactory, |
| + // so we need to have a single source of truth to make a stable decision |
| + // regarding which BeginFrameSource to use here. |
| + if (most_recently_created_surface_id_ != surface_id) |
| + return; |
| + |
| + client_->SetBeginFrameSource(begin_frame_source); |
|
jbauman
2015/10/02 19:21:40
I'd prefer to pass the SurfaceId to the client and
brianderson
2015/10/07 20:54:49
Done.
|
| +} |
| + |
| void SurfaceFactory::SubmitCompositorFrame(SurfaceId surface_id, |
| scoped_ptr<CompositorFrame> frame, |
| const DrawCallback& callback) { |