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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 void SurfaceFactory::SubmitCompositorFrame(const SurfaceId& surface_id, | 69 void SurfaceFactory::SubmitCompositorFrame(const SurfaceId& surface_id, |
70 CompositorFrame frame, | 70 CompositorFrame frame, |
71 const DrawCallback& callback) { | 71 const DrawCallback& callback) { |
72 TRACE_EVENT0("cc", "SurfaceFactory::SubmitCompositorFrame"); | 72 TRACE_EVENT0("cc", "SurfaceFactory::SubmitCompositorFrame"); |
73 OwningSurfaceMap::iterator it = surface_map_.find(surface_id); | 73 OwningSurfaceMap::iterator it = surface_map_.find(surface_id); |
74 DCHECK(it != surface_map_.end()); | 74 DCHECK(it != surface_map_.end()); |
75 DCHECK(it->second->factory().get() == this); | 75 DCHECK(it->second->factory().get() == this); |
| 76 const CompositorFrame& previous_frame = it->second->GetEligibleFrame(); |
| 77 if (!previous_frame.delegated_frame_data) { |
| 78 gfx::Size frame_size = |
| 79 frame.delegated_frame_data->render_pass_list[0]->output_rect.size(); |
| 80 float device_scale_factor = frame.metadata.device_scale_factor; |
| 81 manager_->DidCreateNewSurface(frame_size, device_scale_factor, |
| 82 it->second->surface_id()); |
| 83 } |
76 it->second->QueueFrame(std::move(frame), callback); | 84 it->second->QueueFrame(std::move(frame), callback); |
77 if (!manager_->SurfaceModified(surface_id)) { | 85 if (!manager_->SurfaceModified(surface_id)) { |
78 TRACE_EVENT_INSTANT0("cc", "Damage not visible.", TRACE_EVENT_SCOPE_THREAD); | 86 TRACE_EVENT_INSTANT0("cc", "Damage not visible.", TRACE_EVENT_SCOPE_THREAD); |
79 it->second->RunDrawCallbacks(); | 87 it->second->RunDrawCallbacks(); |
80 } | 88 } |
81 } | 89 } |
82 | 90 |
83 void SurfaceFactory::RequestCopyOfSurface( | 91 void SurfaceFactory::RequestCopyOfSurface( |
84 const SurfaceId& surface_id, | 92 const SurfaceId& surface_id, |
85 std::unique_ptr<CopyOutputRequest> copy_request) { | 93 std::unique_ptr<CopyOutputRequest> copy_request) { |
(...skipping 19 matching lines...) Expand all Loading... |
105 | 113 |
106 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) { | 114 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) { |
107 holder_.RefResources(resources); | 115 holder_.RefResources(resources); |
108 } | 116 } |
109 | 117 |
110 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) { | 118 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) { |
111 holder_.UnrefResources(resources); | 119 holder_.UnrefResources(resources); |
112 } | 120 } |
113 | 121 |
114 } // namespace cc | 122 } // namespace cc |
OLD | NEW |