| 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> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 static const int kFrameIndexStart = 2; | 23 static const int kFrameIndexStart = 2; |
| 24 | 24 |
| 25 Surface::Surface( | 25 Surface::Surface( |
| 26 const SurfaceInfo& surface_info, | 26 const SurfaceInfo& surface_info, |
| 27 base::WeakPtr<CompositorFrameSinkSupport> compositor_frame_sink_support) | 27 base::WeakPtr<CompositorFrameSinkSupport> compositor_frame_sink_support) |
| 28 : surface_info_(surface_info), | 28 : surface_info_(surface_info), |
| 29 previous_frame_surface_id_(surface_info.id()), | 29 previous_frame_surface_id_(surface_info.id()), |
| 30 compositor_frame_sink_support_(std::move(compositor_frame_sink_support)), | 30 compositor_frame_sink_support_(std::move(compositor_frame_sink_support)), |
| 31 surface_manager_(compositor_frame_sink_support_->surface_manager()), | 31 surface_manager_(compositor_frame_sink_support_->surface_manager()), |
| 32 frame_index_(kFrameIndexStart), | 32 frame_index_(kFrameIndexStart), |
| 33 destroyed_(false) {} | 33 destroyed_(false), |
| 34 weak_factory_(this) {} |
| 34 | 35 |
| 35 Surface::~Surface() { | 36 Surface::~Surface() { |
| 36 ClearCopyRequests(); | 37 ClearCopyRequests(); |
| 37 surface_manager_->SurfaceDiscarded(this); | 38 surface_manager_->SurfaceDiscarded(this); |
| 38 | 39 |
| 39 UnrefFrameResourcesAndRunDrawCallback(std::move(pending_frame_data_)); | 40 UnrefFrameResourcesAndRunDrawCallback(std::move(pending_frame_data_)); |
| 40 UnrefFrameResourcesAndRunDrawCallback(std::move(active_frame_data_)); | 41 UnrefFrameResourcesAndRunDrawCallback(std::move(active_frame_data_)); |
| 41 } | 42 } |
| 42 | 43 |
| 43 void Surface::SetPreviousFrameSurface(Surface* surface) { | 44 void Surface::SetPreviousFrameSurface(Surface* surface) { |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 if (latency_info->empty()) { | 370 if (latency_info->empty()) { |
| 370 frame->metadata.latency_info.swap(*latency_info); | 371 frame->metadata.latency_info.swap(*latency_info); |
| 371 return; | 372 return; |
| 372 } | 373 } |
| 373 std::copy(frame->metadata.latency_info.begin(), | 374 std::copy(frame->metadata.latency_info.begin(), |
| 374 frame->metadata.latency_info.end(), | 375 frame->metadata.latency_info.end(), |
| 375 std::back_inserter(*latency_info)); | 376 std::back_inserter(*latency_info)); |
| 376 frame->metadata.latency_info.clear(); | 377 frame->metadata.latency_info.clear(); |
| 377 } | 378 } |
| 378 | 379 |
| 380 base::WeakPtr<Surface> Surface::AsWeakPtr() { |
| 381 return weak_factory_.GetWeakPtr(); |
| 382 } |
| 383 |
| 379 } // namespace cc | 384 } // namespace cc |
| OLD | NEW |