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

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

Issue 2614423003: Adding SatisfySequence and RequireSequence to SurfaceManager (Closed)
Patch Set: Created 3 years, 11 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 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_manager.h" 5 #include "cc/surfaces/surface_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <queue> 10 #include <queue>
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 parent_to_child_refs_.erase(surface_id); 70 parent_to_child_refs_.erase(surface_id);
71 } 71 }
72 72
73 void SurfaceManager::Destroy(std::unique_ptr<Surface> surface) { 73 void SurfaceManager::Destroy(std::unique_ptr<Surface> surface) {
74 DCHECK(thread_checker_.CalledOnValidThread()); 74 DCHECK(thread_checker_.CalledOnValidThread());
75 surface->set_destroyed(true); 75 surface->set_destroyed(true);
76 surfaces_to_destroy_.push_back(std::move(surface)); 76 surfaces_to_destroy_.push_back(std::move(surface));
77 GarbageCollectSurfaces(); 77 GarbageCollectSurfaces();
78 } 78 }
79 79
80 void SurfaceManager::DidSatisfySequences(const FrameSinkId& frame_sink_id, 80 void SurfaceManager::RequireSequence(const SurfaceId& surface_id,
81 std::vector<uint32_t>* sequence) { 81 const SurfaceSequence& sequence) {
82 auto* surface = GetSurfaceForId(surface_id);
83 if (!surface) {
84 LOG(ERROR) << "Attempting to require callback on nonexistent surface";
danakj 2017/01/09 19:07:43 We don't usually put LOGs in code that we ship, I'
85 return;
86 }
87 surface->AddDestructionDependency(sequence);
88 }
89
90 void SurfaceManager::SatisfySequence(const SurfaceSequence& sequence) {
82 DCHECK(thread_checker_.CalledOnValidThread()); 91 DCHECK(thread_checker_.CalledOnValidThread());
83 DCHECK_EQ(lifetime_type_, LifetimeType::SEQUENCES); 92 DCHECK_EQ(lifetime_type_, LifetimeType::SEQUENCES);
84 for (uint32_t value : *sequence) 93 satisfied_sequences_.insert(sequence);
85 satisfied_sequences_.insert(SurfaceSequence(frame_sink_id, value));
86 sequence->clear();
87 GarbageCollectSurfaces(); 94 GarbageCollectSurfaces();
88 } 95 }
89 96
90 void SurfaceManager::RegisterFrameSinkId(const FrameSinkId& frame_sink_id) { 97 void SurfaceManager::RegisterFrameSinkId(const FrameSinkId& frame_sink_id) {
91 bool inserted = valid_frame_sink_ids_.insert(frame_sink_id).second; 98 bool inserted = valid_frame_sink_ids_.insert(frame_sink_id).second;
92 DCHECK(inserted); 99 DCHECK(inserted);
93 } 100 }
94 101
95 void SurfaceManager::InvalidateFrameSinkId(const FrameSinkId& frame_sink_id) { 102 void SurfaceManager::InvalidateFrameSinkId(const FrameSinkId& frame_sink_id) {
96 valid_frame_sink_ids_.erase(frame_sink_id); 103 valid_frame_sink_ids_.erase(frame_sink_id);
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 return changed; 502 return changed;
496 } 503 }
497 504
498 void SurfaceManager::SurfaceCreated(const SurfaceInfo& surface_info) { 505 void SurfaceManager::SurfaceCreated(const SurfaceInfo& surface_info) {
499 CHECK(thread_checker_.CalledOnValidThread()); 506 CHECK(thread_checker_.CalledOnValidThread());
500 for (auto& observer : observer_list_) 507 for (auto& observer : observer_list_)
501 observer.OnSurfaceCreated(surface_info); 508 observer.OnSurfaceCreated(surface_info);
502 } 509 }
503 510
504 } // namespace cc 511 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698