OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/ozone/platform/dri/display_manager.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "ui/display/types/display_snapshot.h" |
| 9 |
| 10 namespace ui { |
| 11 |
| 12 DisplayManager::DisplayManager() { |
| 13 } |
| 14 |
| 15 DisplayManager::~DisplayManager() { |
| 16 } |
| 17 |
| 18 void DisplayManager::RegisterDisplay(DisplaySnapshot* display) { |
| 19 std::pair<DisplayMap::iterator, bool> result = display_map_.insert( |
| 20 std::pair<int64_t, DisplaySnapshot*>(display->display_id(), display)); |
| 21 DCHECK(result.second) << "Display " << display->display_id() |
| 22 << " already added."; |
| 23 } |
| 24 |
| 25 void DisplayManager::UnregisterDisplay(DisplaySnapshot* display) { |
| 26 DisplayMap::iterator it = display_map_.find(display->display_id()); |
| 27 if (it != display_map_.end()) |
| 28 display_map_.erase(it); |
| 29 else |
| 30 NOTREACHED() << "Attempting to remove non-existing display " |
| 31 << display->display_id(); |
| 32 } |
| 33 |
| 34 DisplaySnapshot* DisplayManager::GetDisplay(int64_t display) { |
| 35 DisplayMap::iterator it = display_map_.find(display); |
| 36 if (it == display_map_.end()) |
| 37 return nullptr; |
| 38 |
| 39 return it->second; |
| 40 } |
| 41 |
| 42 } // namespace ui |
OLD | NEW |