| 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/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/frame_sink_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 17 matching lines...) Expand all Loading... |
| 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::RegisterSurfaceFactoryClient( |
| 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 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |