| 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/output/copy_output_request.h" |
| 8 #include "cc/surfaces/surface.h" | 9 #include "cc/surfaces/surface.h" |
| 9 #include "cc/surfaces/surface_manager.h" | 10 #include "cc/surfaces/surface_manager.h" |
| 10 #include "ui/gfx/geometry/size.h" | 11 #include "ui/gfx/geometry/size.h" |
| 11 | 12 |
| 12 namespace cc { | 13 namespace cc { |
| 13 SurfaceFactory::SurfaceFactory(SurfaceManager* manager, | 14 SurfaceFactory::SurfaceFactory(SurfaceManager* manager, |
| 14 SurfaceFactoryClient* client) | 15 SurfaceFactoryClient* client) |
| 15 : manager_(manager), client_(client), holder_(client) { | 16 : manager_(manager), client_(client), holder_(client) { |
| 16 } | 17 } |
| 17 | 18 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 37 void SurfaceFactory::SubmitFrame(SurfaceId surface_id, | 38 void SurfaceFactory::SubmitFrame(SurfaceId surface_id, |
| 38 scoped_ptr<CompositorFrame> frame, | 39 scoped_ptr<CompositorFrame> frame, |
| 39 const base::Closure& callback) { | 40 const base::Closure& callback) { |
| 40 OwningSurfaceMap::iterator it = surface_map_.find(surface_id); | 41 OwningSurfaceMap::iterator it = surface_map_.find(surface_id); |
| 41 DCHECK(it != surface_map_.end()); | 42 DCHECK(it != surface_map_.end()); |
| 42 DCHECK(it->second->factory() == this); | 43 DCHECK(it->second->factory() == this); |
| 43 it->second->QueueFrame(frame.Pass(), callback); | 44 it->second->QueueFrame(frame.Pass(), callback); |
| 44 manager_->SurfaceModified(surface_id); | 45 manager_->SurfaceModified(surface_id); |
| 45 } | 46 } |
| 46 | 47 |
| 48 void SurfaceFactory::RequestCopyOfSurface( |
| 49 SurfaceId surface_id, |
| 50 scoped_ptr<CopyOutputRequest> copy_request) { |
| 51 OwningSurfaceMap::iterator it = surface_map_.find(surface_id); |
| 52 if (it == surface_map_.end()) { |
| 53 copy_request->SendEmptyResult(); |
| 54 return; |
| 55 } |
| 56 DCHECK(it->second->factory() == this); |
| 57 it->second->RequestCopyOfOutput(copy_request.Pass()); |
| 58 } |
| 59 |
| 47 void SurfaceFactory::ReceiveFromChild( | 60 void SurfaceFactory::ReceiveFromChild( |
| 48 const TransferableResourceArray& resources) { | 61 const TransferableResourceArray& resources) { |
| 49 holder_.ReceiveFromChild(resources); | 62 holder_.ReceiveFromChild(resources); |
| 50 } | 63 } |
| 51 | 64 |
| 52 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) { | 65 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) { |
| 53 holder_.RefResources(resources); | 66 holder_.RefResources(resources); |
| 54 } | 67 } |
| 55 | 68 |
| 56 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) { | 69 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) { |
| 57 holder_.UnrefResources(resources); | 70 holder_.UnrefResources(resources); |
| 58 } | 71 } |
| 59 | 72 |
| 60 } // namespace cc | 73 } // namespace cc |
| OLD | NEW |