Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(483)

Side by Side Diff: cc/surfaces/surface.cc

Issue 2940183002: cc: Move ownership of surfaces to SurfaceManager (Closed)
Patch Set: Fix exo Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/surfaces/surface.h ('k') | cc/surfaces/surface_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11 matching lines...) Expand all
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( 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) {}
34 33
35 Surface::~Surface() { 34 Surface::~Surface() {
36 ClearCopyRequests(); 35 ClearCopyRequests();
37 surface_manager_->SurfaceDiscarded(this); 36 surface_manager_->SurfaceDiscarded(this);
38 37
39 UnrefFrameResourcesAndRunDrawCallback(std::move(pending_frame_data_)); 38 UnrefFrameResourcesAndRunDrawCallback(std::move(pending_frame_data_));
40 UnrefFrameResourcesAndRunDrawCallback(std::move(active_frame_data_)); 39 UnrefFrameResourcesAndRunDrawCallback(std::move(active_frame_data_));
41 } 40 }
42 41
43 void Surface::SetPreviousFrameSurface(Surface* surface) { 42 void Surface::SetPreviousFrameSurface(Surface* surface) {
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 frame->metadata.latency_info.swap(*latency_info); 369 frame->metadata.latency_info.swap(*latency_info);
371 return; 370 return;
372 } 371 }
373 std::copy(frame->metadata.latency_info.begin(), 372 std::copy(frame->metadata.latency_info.begin(),
374 frame->metadata.latency_info.end(), 373 frame->metadata.latency_info.end(),
375 std::back_inserter(*latency_info)); 374 std::back_inserter(*latency_info));
376 frame->metadata.latency_info.clear(); 375 frame->metadata.latency_info.clear();
377 } 376 }
378 377
379 } // namespace cc 378 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface.h ('k') | cc/surfaces/surface_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698