Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/surfaces/surface_factory.h" | 5 #include "cc/surfaces/surface_factory.h" |
| 6 | 6 |
| 7 #include "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
| 8 #include "cc/surfaces/surface.h" | 8 #include "cc/surfaces/surface.h" |
| 9 #include "cc/surfaces/surface_manager.h" | 9 #include "cc/surfaces/surface_manager.h" |
| 10 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 | 28 |
| 29 void SurfaceFactory::Destroy(SurfaceId surface_id) { | 29 void SurfaceFactory::Destroy(SurfaceId surface_id) { |
| 30 OwningSurfaceMap::iterator it = surface_map_.find(surface_id); | 30 OwningSurfaceMap::iterator it = surface_map_.find(surface_id); |
| 31 DCHECK(it != surface_map_.end()); | 31 DCHECK(it != surface_map_.end()); |
| 32 DCHECK(it->second->factory() == this); | 32 DCHECK(it->second->factory() == this); |
| 33 manager_->DeregisterSurface(surface_id); | 33 manager_->DeregisterSurface(surface_id); |
| 34 surface_map_.erase(it); | 34 surface_map_.erase(it); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void SurfaceFactory::SubmitFrame(SurfaceId surface_id, | 37 void SurfaceFactory::SubmitFrame(SurfaceId surface_id, |
| 38 scoped_ptr<CompositorFrame> frame) { | 38 scoped_ptr<CompositorFrame> frame, |
| 39 const base::Closure& callback) { | |
| 39 OwningSurfaceMap::iterator it = surface_map_.find(surface_id); | 40 OwningSurfaceMap::iterator it = surface_map_.find(surface_id); |
| 40 DCHECK(it != surface_map_.end()); | 41 DCHECK(it != surface_map_.end()); |
| 41 DCHECK(it->second->factory() == this); | 42 DCHECK(it->second->factory() == this); |
| 42 it->second->QueueFrame(frame.Pass()); | 43 it->second->QueueFrame(frame.Pass()); |
| 44 if (!callback.is_null()) | |
|
jamesr
2014/08/22 06:00:12
can we instead just pass this as a parameter to Qu
| |
| 45 it->second->AddDrawCallback(callback); | |
| 43 manager_->SurfaceModified(surface_id); | 46 manager_->SurfaceModified(surface_id); |
| 44 } | 47 } |
| 45 | 48 |
| 46 void SurfaceFactory::ReceiveFromChild( | 49 void SurfaceFactory::ReceiveFromChild( |
| 47 const TransferableResourceArray& resources) { | 50 const TransferableResourceArray& resources) { |
| 48 holder_.ReceiveFromChild(resources); | 51 holder_.ReceiveFromChild(resources); |
| 49 } | 52 } |
| 50 | 53 |
| 51 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) { | 54 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) { |
| 52 holder_.RefResources(resources); | 55 holder_.RefResources(resources); |
| 53 } | 56 } |
| 54 | 57 |
| 55 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) { | 58 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) { |
| 56 holder_.UnrefResources(resources); | 59 holder_.UnrefResources(resources); |
| 57 } | 60 } |
| 58 | 61 |
| 59 } // namespace cc | 62 } // namespace cc |
| OLD | NEW |