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.h" | 5 #include "cc/surfaces/surface.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
11 | 11 |
12 #include "cc/base/container_util.h" | 12 #include "cc/base/container_util.h" |
13 #include "cc/output/compositor_frame.h" | 13 #include "cc/output/compositor_frame.h" |
14 #include "cc/output/copy_output_request.h" | 14 #include "cc/output/copy_output_request.h" |
15 #include "cc/surfaces/surface_factory.h" | 15 #include "cc/surfaces/surface_factory.h" |
16 #include "cc/surfaces/surface_id_allocator.h" | 16 #include "cc/surfaces/surface_id_allocator.h" |
17 #include "cc/surfaces/surface_manager.h" | 17 #include "cc/surfaces/surface_manager.h" |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 | 20 |
21 // The frame index starts at 2 so that empty frames will be treated as | 21 // The frame index starts at 2 so that empty frames will be treated as |
22 // completely damaged the first time they're drawn from. | 22 // completely damaged the first time they're drawn from. |
23 static const int kFrameIndexStart = 2; | 23 static const int kFrameIndexStart = 2; |
24 | 24 |
25 Surface::Surface(SurfaceId id, SurfaceFactory* factory) | 25 Surface::Surface(const SurfaceId& id, SurfaceFactory* factory) |
26 : surface_id_(id), | 26 : surface_id_(id), |
27 previous_frame_surface_id_(id), | 27 previous_frame_surface_id_(id), |
28 factory_(factory->AsWeakPtr()), | 28 factory_(factory->AsWeakPtr()), |
29 frame_index_(kFrameIndexStart), | 29 frame_index_(kFrameIndexStart), |
30 destroyed_(false) {} | 30 destroyed_(false) {} |
31 | 31 |
32 Surface::~Surface() { | 32 Surface::~Surface() { |
33 ClearCopyRequests(); | 33 ClearCopyRequests(); |
34 if (current_frame_.delegated_frame_data && factory_) { | 34 if (current_frame_.delegated_frame_data && factory_) { |
35 UnrefFrameResources(current_frame_.delegated_frame_data.get()); | 35 UnrefFrameResources(current_frame_.delegated_frame_data.get()); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 if (current_frame_.delegated_frame_data) { | 189 if (current_frame_.delegated_frame_data) { |
190 for (const auto& render_pass : | 190 for (const auto& render_pass : |
191 current_frame_.delegated_frame_data->render_pass_list) { | 191 current_frame_.delegated_frame_data->render_pass_list) { |
192 for (const auto& copy_request : render_pass->copy_requests) | 192 for (const auto& copy_request : render_pass->copy_requests) |
193 copy_request->SendEmptyResult(); | 193 copy_request->SendEmptyResult(); |
194 } | 194 } |
195 } | 195 } |
196 } | 196 } |
197 | 197 |
198 } // namespace cc | 198 } // namespace cc |
OLD | NEW |