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

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

Issue 2661543002: Rename LocalFrameId to LocalSurfaceId (Closed)
Patch Set: c Created 3 years, 10 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/referenced_surface_tracker.h" 5 #include "cc/surfaces/referenced_surface_tracker.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 ReferencedSurfaceTracker::ReferencedSurfaceTracker( 13 ReferencedSurfaceTracker::ReferencedSurfaceTracker(
14 const FrameSinkId& frame_sink_id) 14 const FrameSinkId& frame_sink_id)
15 : current_surface_id_(frame_sink_id, LocalFrameId()) { 15 : current_surface_id_(frame_sink_id, LocalSurfaceId()) {
16 DCHECK(current_surface_id_.frame_sink_id().is_valid()); 16 DCHECK(current_surface_id_.frame_sink_id().is_valid());
17 } 17 }
18 18
19 ReferencedSurfaceTracker::~ReferencedSurfaceTracker() {} 19 ReferencedSurfaceTracker::~ReferencedSurfaceTracker() {}
20 20
21 void ReferencedSurfaceTracker::UpdateReferences( 21 void ReferencedSurfaceTracker::UpdateReferences(
22 const LocalFrameId& local_frame_id, 22 const LocalSurfaceId& local_surface_id,
23 const std::vector<SurfaceId>& referenced_surfaces) { 23 const std::vector<SurfaceId>& referenced_surfaces) {
24 DCHECK(local_frame_id.is_valid()); 24 DCHECK(local_surface_id.is_valid());
25 25
26 // Clear references to add/remove from the last frame. 26 // Clear references to add/remove from the last frame.
27 references_to_remove_.clear(); 27 references_to_remove_.clear();
28 references_to_add_.clear(); 28 references_to_add_.clear();
29 29
30 // If |current_surface_id_| is changing then update |current_surface_id_|. 30 // If |current_surface_id_| is changing then update |current_surface_id_|.
31 // Also clear |referenced_surfaces_| because we haven't added any references 31 // Also clear |referenced_surfaces_| because we haven't added any references
32 // from the new SurfaceId yet. 32 // from the new SurfaceId yet.
33 if (current_surface_id_.local_frame_id() != local_frame_id) { 33 if (current_surface_id_.local_surface_id() != local_surface_id) {
34 current_surface_id_ = 34 current_surface_id_ =
35 SurfaceId(current_surface_id_.frame_sink_id(), local_frame_id); 35 SurfaceId(current_surface_id_.frame_sink_id(), local_surface_id);
36 referenced_surfaces_.clear(); 36 referenced_surfaces_.clear();
37 } 37 }
38 38
39 std::unordered_set<SurfaceId, SurfaceIdHash> referenced_surface_set( 39 std::unordered_set<SurfaceId, SurfaceIdHash> referenced_surface_set(
40 referenced_surfaces.begin(), referenced_surfaces.end()); 40 referenced_surfaces.begin(), referenced_surfaces.end());
41 ProcessNewReferences(referenced_surface_set); 41 ProcessNewReferences(referenced_surface_set);
42 } 42 }
43 43
44 void ReferencedSurfaceTracker::ProcessNewReferences( 44 void ReferencedSurfaceTracker::ProcessNewReferences(
45 const std::unordered_set<SurfaceId, SurfaceIdHash>& 45 const std::unordered_set<SurfaceId, SurfaceIdHash>&
(...skipping 25 matching lines...) Expand all
71 } 71 }
72 72
73 void ReferencedSurfaceTracker::RemoveSurfaceReference( 73 void ReferencedSurfaceTracker::RemoveSurfaceReference(
74 const SurfaceId& surface_id) { 74 const SurfaceId& surface_id) {
75 references_to_remove_.push_back( 75 references_to_remove_.push_back(
76 SurfaceReference(current_surface_id_, surface_id)); 76 SurfaceReference(current_surface_id_, surface_id));
77 referenced_surfaces_.erase(surface_id); 77 referenced_surfaces_.erase(surface_id);
78 } 78 }
79 79
80 } // namespace cc 80 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/referenced_surface_tracker.h ('k') | cc/surfaces/referenced_surface_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698