| 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 "ui/ozone/platform/drm/gpu/screen_manager.h" | 5 #include "ui/ozone/platform/drm/gpu/screen_manager.h" |
| 6 | 6 |
| 7 #include <xf86drmMode.h> | 7 #include <xf86drmMode.h> |
| 8 | 8 |
| 9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
| 10 #include "ui/gfx/geometry/point.h" | 10 #include "ui/gfx/geometry/point.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 FindActiveDisplayControllerByLocation(bounds); | 209 FindActiveDisplayControllerByLocation(bounds); |
| 210 if (it != controllers_.end()) | 210 if (it != controllers_.end()) |
| 211 return it->get(); | 211 return it->get(); |
| 212 | 212 |
| 213 return nullptr; | 213 return nullptr; |
| 214 } | 214 } |
| 215 | 215 |
| 216 void ScreenManager::AddWindow(gfx::AcceleratedWidget widget, | 216 void ScreenManager::AddWindow(gfx::AcceleratedWidget widget, |
| 217 scoped_ptr<DrmWindow> window) { | 217 scoped_ptr<DrmWindow> window) { |
| 218 std::pair<WidgetToWindowMap::iterator, bool> result = | 218 std::pair<WidgetToWindowMap::iterator, bool> result = |
| 219 window_map_.add(widget, window.Pass()); | 219 window_map_.add(widget, std::move(window)); |
| 220 DCHECK(result.second) << "Window already added."; | 220 DCHECK(result.second) << "Window already added."; |
| 221 UpdateControllerToWindowMapping(); | 221 UpdateControllerToWindowMapping(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 scoped_ptr<DrmWindow> ScreenManager::RemoveWindow( | 224 scoped_ptr<DrmWindow> ScreenManager::RemoveWindow( |
| 225 gfx::AcceleratedWidget widget) { | 225 gfx::AcceleratedWidget widget) { |
| 226 scoped_ptr<DrmWindow> window = window_map_.take_and_erase(widget); | 226 scoped_ptr<DrmWindow> window = window_map_.take_and_erase(widget); |
| 227 DCHECK(window) << "Attempting to remove non-existing window for " << widget; | 227 DCHECK(window) << "Attempting to remove non-existing window for " << widget; |
| 228 UpdateControllerToWindowMapping(); | 228 UpdateControllerToWindowMapping(); |
| 229 return window.Pass(); | 229 return window; |
| 230 } | 230 } |
| 231 | 231 |
| 232 DrmWindow* ScreenManager::GetWindow(gfx::AcceleratedWidget widget) { | 232 DrmWindow* ScreenManager::GetWindow(gfx::AcceleratedWidget widget) { |
| 233 WidgetToWindowMap::iterator it = window_map_.find(widget); | 233 WidgetToWindowMap::iterator it = window_map_.find(widget); |
| 234 if (it != window_map_.end()) | 234 if (it != window_map_.end()) |
| 235 return it->second; | 235 return it->second; |
| 236 | 236 |
| 237 return nullptr; | 237 return nullptr; |
| 238 } | 238 } |
| 239 | 239 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 DrmWindow* ScreenManager::FindWindowAt(const gfx::Rect& bounds) const { | 381 DrmWindow* ScreenManager::FindWindowAt(const gfx::Rect& bounds) const { |
| 382 for (auto pair : window_map_) { | 382 for (auto pair : window_map_) { |
| 383 if (pair.second->bounds() == bounds) | 383 if (pair.second->bounds() == bounds) |
| 384 return pair.second; | 384 return pair.second; |
| 385 } | 385 } |
| 386 | 386 |
| 387 return nullptr; | 387 return nullptr; |
| 388 } | 388 } |
| 389 | 389 |
| 390 } // namespace ui | 390 } // namespace ui |
| OLD | NEW |