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