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/output/copy_output_request.h" |
9 #include "cc/surfaces/surface.h" | 9 #include "cc/surfaces/surface.h" |
10 #include "cc/surfaces/surface_manager.h" | 10 #include "cc/surfaces/surface_manager.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 manager_->Destroy(surface_map_.take_and_erase(it)); | 44 manager_->Destroy(surface_map_.take_and_erase(it)); |
45 } | 45 } |
46 | 46 |
47 void SurfaceFactory::SubmitFrame(SurfaceId surface_id, | 47 void SurfaceFactory::SubmitFrame(SurfaceId surface_id, |
48 scoped_ptr<CompositorFrame> frame, | 48 scoped_ptr<CompositorFrame> frame, |
49 const DrawCallback& callback) { | 49 const DrawCallback& callback) { |
50 OwningSurfaceMap::iterator it = surface_map_.find(surface_id); | 50 OwningSurfaceMap::iterator it = surface_map_.find(surface_id); |
51 DCHECK(it != surface_map_.end()); | 51 DCHECK(it != surface_map_.end()); |
52 DCHECK(it->second->factory().get() == this); | 52 DCHECK(it->second->factory().get() == this); |
53 it->second->QueueFrame(frame.Pass(), callback); | 53 it->second->QueueFrame(frame.Pass(), callback); |
54 manager_->SurfaceModified(surface_id); | 54 if (!manager_->SurfaceModified(surface_id)) |
| 55 it->second->RunDrawCallbacks(SurfaceDrawStatus::DRAW_SKIPPED); |
55 } | 56 } |
56 | 57 |
57 void SurfaceFactory::RequestCopyOfSurface( | 58 void SurfaceFactory::RequestCopyOfSurface( |
58 SurfaceId surface_id, | 59 SurfaceId surface_id, |
59 scoped_ptr<CopyOutputRequest> copy_request) { | 60 scoped_ptr<CopyOutputRequest> copy_request) { |
60 OwningSurfaceMap::iterator it = surface_map_.find(surface_id); | 61 OwningSurfaceMap::iterator it = surface_map_.find(surface_id); |
61 if (it == surface_map_.end()) { | 62 if (it == surface_map_.end()) { |
62 copy_request->SendEmptyResult(); | 63 copy_request->SendEmptyResult(); |
63 return; | 64 return; |
64 } | 65 } |
65 DCHECK(it->second->factory().get() == this); | 66 DCHECK(it->second->factory().get() == this); |
66 it->second->RequestCopyOfOutput(copy_request.Pass()); | 67 it->second->RequestCopyOfOutput(copy_request.Pass()); |
67 manager_->SurfaceModified(surface_id); | 68 manager_->SurfaceModified(surface_id); |
68 } | 69 } |
69 | 70 |
70 void SurfaceFactory::ReceiveFromChild( | 71 void SurfaceFactory::ReceiveFromChild( |
71 const TransferableResourceArray& resources) { | 72 const TransferableResourceArray& resources) { |
72 holder_.ReceiveFromChild(resources); | 73 holder_.ReceiveFromChild(resources); |
73 } | 74 } |
74 | 75 |
75 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) { | 76 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) { |
76 holder_.RefResources(resources); | 77 holder_.RefResources(resources); |
77 } | 78 } |
78 | 79 |
79 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) { | 80 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) { |
80 holder_.UnrefResources(resources); | 81 holder_.UnrefResources(resources); |
81 } | 82 } |
82 | 83 |
83 } // namespace cc | 84 } // namespace cc |
OLD | NEW |