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

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

Issue 2824053003: Split SurfaceFactoryClient Into Four Interfaces (Closed)
Patch Set: Address Nits Created 3 years, 8 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/framesink_manager.h ('k') | cc/surfaces/framesink_manager_client.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/framesink_manager.h" 5 #include "cc/surfaces/framesink_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "cc/surfaces/framesink_manager_client.h"
11 #include "cc/surfaces/surface_factory_client.h" 12 #include "cc/surfaces/surface_factory_client.h"
12 13
13 #if DCHECK_IS_ON() 14 #if DCHECK_IS_ON()
14 #include <sstream> 15 #include <sstream>
15 #endif 16 #endif
16 17
17 namespace cc { 18 namespace cc {
18 19
19 FrameSinkManager::FrameSinkSourceMapping::FrameSinkSourceMapping() 20 FrameSinkManager::FrameSinkSourceMapping::FrameSinkSourceMapping()
20 : source(nullptr) {} 21 : source(nullptr) {}
(...skipping 15 matching lines...) Expand all
36 37
37 void FrameSinkManager::RegisterFrameSinkId(const FrameSinkId& frame_sink_id) { 38 void FrameSinkManager::RegisterFrameSinkId(const FrameSinkId& frame_sink_id) {
38 bool inserted = valid_frame_sink_ids_.insert(frame_sink_id).second; 39 bool inserted = valid_frame_sink_ids_.insert(frame_sink_id).second;
39 DCHECK(inserted); 40 DCHECK(inserted);
40 } 41 }
41 42
42 void FrameSinkManager::InvalidateFrameSinkId(const FrameSinkId& frame_sink_id) { 43 void FrameSinkManager::InvalidateFrameSinkId(const FrameSinkId& frame_sink_id) {
43 valid_frame_sink_ids_.erase(frame_sink_id); 44 valid_frame_sink_ids_.erase(frame_sink_id);
44 } 45 }
45 46
46 void FrameSinkManager::RegisterSurfaceFactoryClient( 47 void FrameSinkManager::RegisterFrameSinkManagerClient(
47 const FrameSinkId& frame_sink_id, 48 const FrameSinkId& frame_sink_id,
48 SurfaceFactoryClient* client) { 49 FrameSinkManagerClient* client) {
49 DCHECK(client); 50 DCHECK(client);
50 DCHECK_EQ(valid_frame_sink_ids_.count(frame_sink_id), 1u); 51 DCHECK_EQ(valid_frame_sink_ids_.count(frame_sink_id), 1u);
51 52
52 clients_[frame_sink_id] = client; 53 clients_[frame_sink_id] = client;
53 54
54 auto it = frame_sink_source_map_.find(frame_sink_id); 55 auto it = frame_sink_source_map_.find(frame_sink_id);
55 if (it != frame_sink_source_map_.end()) { 56 if (it != frame_sink_source_map_.end()) {
56 if (it->second.source) 57 if (it->second.source)
57 client->SetBeginFrameSource(it->second.source); 58 client->SetBeginFrameSource(it->second.source);
58 } 59 }
59 } 60 }
60 61
61 void FrameSinkManager::UnregisterSurfaceFactoryClient( 62 void FrameSinkManager::UnregisterFrameSinkManagerClient(
62 const FrameSinkId& frame_sink_id) { 63 const FrameSinkId& frame_sink_id) {
63 DCHECK_EQ(valid_frame_sink_ids_.count(frame_sink_id), 1u); 64 DCHECK_EQ(valid_frame_sink_ids_.count(frame_sink_id), 1u);
64 auto client_iter = clients_.find(frame_sink_id); 65 auto client_iter = clients_.find(frame_sink_id);
65 DCHECK(client_iter != clients_.end()); 66 DCHECK(client_iter != clients_.end());
66 67
67 auto source_iter = frame_sink_source_map_.find(frame_sink_id); 68 auto source_iter = frame_sink_source_map_.find(frame_sink_id);
68 if (source_iter != frame_sink_source_map_.end()) { 69 if (source_iter != frame_sink_source_map_.end()) {
69 if (source_iter->second.source) 70 if (source_iter->second.source)
70 client_iter->second->SetBeginFrameSource(nullptr); 71 client_iter->second->SetBeginFrameSource(nullptr);
71 if (!source_iter->second.has_children()) 72 if (!source_iter->second.has_children())
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 if (!parent_source) 223 if (!parent_source)
223 return; 224 return;
224 225
225 // TODO(enne): these walks could be done in one step. 226 // TODO(enne): these walks could be done in one step.
226 RecursivelyDetachBeginFrameSource(child_frame_sink_id, parent_source); 227 RecursivelyDetachBeginFrameSource(child_frame_sink_id, parent_source);
227 for (auto source_iter : registered_sources_) 228 for (auto source_iter : registered_sources_)
228 RecursivelyAttachBeginFrameSource(source_iter.second, source_iter.first); 229 RecursivelyAttachBeginFrameSource(source_iter.second, source_iter.first);
229 } 230 }
230 231
231 } // namespace cc 232 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/framesink_manager.h ('k') | cc/surfaces/framesink_manager_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698