| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 void SurfaceFactory::SubmitCompositorFrame(const LocalFrameId& local_frame_id, | 81 void SurfaceFactory::SubmitCompositorFrame(const LocalFrameId& local_frame_id, |
| 82 CompositorFrame frame, | 82 CompositorFrame frame, |
| 83 const DrawCallback& callback) { | 83 const DrawCallback& callback) { |
| 84 TRACE_EVENT0("cc", "SurfaceFactory::SubmitCompositorFrame"); | 84 TRACE_EVENT0("cc", "SurfaceFactory::SubmitCompositorFrame"); |
| 85 OwningSurfaceMap::iterator it = surface_map_.find(local_frame_id); | 85 OwningSurfaceMap::iterator it = surface_map_.find(local_frame_id); |
| 86 DCHECK(it != surface_map_.end()); | 86 DCHECK(it != surface_map_.end()); |
| 87 DCHECK(it->second->factory().get() == this); | 87 DCHECK(it->second->factory().get() == this); |
| 88 const CompositorFrame& previous_frame = it->second->GetEligibleFrame(); |
| 88 // Tell the SurfaceManager if this is the first frame submitted with this | 89 // Tell the SurfaceManager if this is the first frame submitted with this |
| 89 // LocalFrameId. | 90 // LocalFrameId. |
| 90 if (!it->second->HasFrame()) { | 91 if (!previous_frame.delegated_frame_data) { |
| 91 float device_scale_factor = frame.metadata.device_scale_factor; | 92 float device_scale_factor = frame.metadata.device_scale_factor; |
| 92 gfx::Size frame_size; | 93 gfx::Size frame_size; |
| 93 // CompositorFrames may not be populated with a RenderPass in unit tests. | 94 // CompositorFrames may not be populated with a RenderPass in unit tests. |
| 94 if (!frame.render_pass_list.empty()) | 95 if (frame.delegated_frame_data && |
| 95 frame_size = frame.render_pass_list[0]->output_rect.size(); | 96 !frame.delegated_frame_data->render_pass_list.empty()) { |
| 97 frame_size = |
| 98 frame.delegated_frame_data->render_pass_list[0]->output_rect.size(); |
| 99 } |
| 96 manager_->SurfaceCreated(it->second->surface_id(), frame_size, | 100 manager_->SurfaceCreated(it->second->surface_id(), frame_size, |
| 97 device_scale_factor); | 101 device_scale_factor); |
| 98 } | 102 } |
| 99 it->second->QueueFrame(std::move(frame), callback); | 103 it->second->QueueFrame(std::move(frame), callback); |
| 100 if (!manager_->SurfaceModified(SurfaceId(frame_sink_id_, local_frame_id))) { | 104 if (!manager_->SurfaceModified(SurfaceId(frame_sink_id_, local_frame_id))) { |
| 101 TRACE_EVENT_INSTANT0("cc", "Damage not visible.", TRACE_EVENT_SCOPE_THREAD); | 105 TRACE_EVENT_INSTANT0("cc", "Damage not visible.", TRACE_EVENT_SCOPE_THREAD); |
| 102 it->second->RunDrawCallbacks(); | 106 it->second->RunDrawCallbacks(); |
| 103 } | 107 } |
| 104 } | 108 } |
| 105 | 109 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 128 | 132 |
| 129 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) { | 133 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) { |
| 130 holder_.RefResources(resources); | 134 holder_.RefResources(resources); |
| 131 } | 135 } |
| 132 | 136 |
| 133 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) { | 137 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) { |
| 134 holder_.UnrefResources(resources); | 138 holder_.UnrefResources(resources); |
| 135 } | 139 } |
| 136 | 140 |
| 137 } // namespace cc | 141 } // namespace cc |
| OLD | NEW |