| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 void SurfaceFactory::SubmitCompositorFrame(const LocalFrameId& local_frame_id, | 72 void SurfaceFactory::SubmitCompositorFrame(const LocalFrameId& local_frame_id, |
| 73 CompositorFrame frame, | 73 CompositorFrame frame, |
| 74 const DrawCallback& callback) { | 74 const DrawCallback& callback) { |
| 75 TRACE_EVENT0("cc", "SurfaceFactory::SubmitCompositorFrame"); | 75 TRACE_EVENT0("cc", "SurfaceFactory::SubmitCompositorFrame"); |
| 76 OwningSurfaceMap::iterator it = surface_map_.find(local_frame_id); | 76 OwningSurfaceMap::iterator it = surface_map_.find(local_frame_id); |
| 77 DCHECK(it != surface_map_.end()); | 77 DCHECK(it != surface_map_.end()); |
| 78 DCHECK(it->second->factory().get() == this); | 78 DCHECK(it->second->factory().get() == this); |
| 79 const CompositorFrame& previous_frame = it->second->GetEligibleFrame(); | |
| 80 // Tell the SurfaceManager if this is the first frame submitted with this | 79 // Tell the SurfaceManager if this is the first frame submitted with this |
| 81 // LocalFrameId. | 80 // LocalFrameId. |
| 82 if (!previous_frame.delegated_frame_data) { | 81 if (!it->second->HasFrame()) { |
| 83 float device_scale_factor = frame.metadata.device_scale_factor; | 82 float device_scale_factor = frame.metadata.device_scale_factor; |
| 84 gfx::Size frame_size; | 83 gfx::Size frame_size; |
| 85 // CompositorFrames may not be populated with a RenderPass in unit tests. | 84 // CompositorFrames may not be populated with a RenderPass in unit tests. |
| 86 if (frame.delegated_frame_data && | 85 if (!frame.render_pass_list.empty()) |
| 87 !frame.delegated_frame_data->render_pass_list.empty()) { | 86 frame_size = frame.render_pass_list[0]->output_rect.size(); |
| 88 frame_size = | |
| 89 frame.delegated_frame_data->render_pass_list[0]->output_rect.size(); | |
| 90 } | |
| 91 manager_->SurfaceCreated(it->second->surface_id(), frame_size, | 87 manager_->SurfaceCreated(it->second->surface_id(), frame_size, |
| 92 device_scale_factor); | 88 device_scale_factor); |
| 93 } | 89 } |
| 94 it->second->QueueFrame(std::move(frame), callback); | 90 it->second->QueueFrame(std::move(frame), callback); |
| 95 if (!manager_->SurfaceModified(SurfaceId(frame_sink_id_, local_frame_id))) { | 91 if (!manager_->SurfaceModified(SurfaceId(frame_sink_id_, local_frame_id))) { |
| 96 TRACE_EVENT_INSTANT0("cc", "Damage not visible.", TRACE_EVENT_SCOPE_THREAD); | 92 TRACE_EVENT_INSTANT0("cc", "Damage not visible.", TRACE_EVENT_SCOPE_THREAD); |
| 97 it->second->RunDrawCallbacks(); | 93 it->second->RunDrawCallbacks(); |
| 98 } | 94 } |
| 99 } | 95 } |
| 100 | 96 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 123 | 119 |
| 124 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) { | 120 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) { |
| 125 holder_.RefResources(resources); | 121 holder_.RefResources(resources); |
| 126 } | 122 } |
| 127 | 123 |
| 128 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) { | 124 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) { |
| 129 holder_.UnrefResources(resources); | 125 holder_.UnrefResources(resources); |
| 130 } | 126 } |
| 131 | 127 |
| 132 } // namespace cc | 128 } // namespace cc |
| OLD | NEW |