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

Side by Side Diff: ui/ozone/platform/dri/chromeos/native_display_delegate_dri.cc

Issue 377753002: [Ozone-GBM] Add basic support for display configuration over IPC (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 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 | Annotate | Revision Log
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 "ui/ozone/platform/dri/chromeos/native_display_delegate_dri.h" 5 #include "ui/ozone/platform/dri/chromeos/native_display_delegate_dri.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "third_party/skia/include/core/SkCanvas.h" 8 #include "third_party/skia/include/core/SkCanvas.h"
9 #include "ui/display/types/chromeos/native_display_observer.h" 9 #include "ui/display/types/chromeos/native_display_observer.h"
10 #include "ui/events/ozone/device/device_event.h" 10 #include "ui/events/ozone/device/device_event.h"
(...skipping 14 matching lines...) Expand all
25 NativeDisplayDelegateDri::NativeDisplayDelegateDri( 25 NativeDisplayDelegateDri::NativeDisplayDelegateDri(
26 DriWrapper* dri, 26 DriWrapper* dri,
27 ScreenManager* screen_manager, 27 ScreenManager* screen_manager,
28 DeviceManager* device_manager) 28 DeviceManager* device_manager)
29 : dri_(dri), 29 : dri_(dri),
30 screen_manager_(screen_manager), 30 screen_manager_(screen_manager),
31 device_manager_(device_manager) { 31 device_manager_(device_manager) {
32 } 32 }
33 33
34 NativeDisplayDelegateDri::~NativeDisplayDelegateDri() { 34 NativeDisplayDelegateDri::~NativeDisplayDelegateDri() {
35 device_manager_->RemoveObserver(this); 35 if (device_manager_)
36 device_manager_->RemoveObserver(this);
37 }
38
39 DisplaySnapshot* NativeDisplayDelegateDri::FindDisplaySnapshot(int64_t id) {
40 for (size_t i = 0; i < cached_displays_.size(); ++i)
41 if (cached_displays_[i]->display_id() == id)
42 return cached_displays_[i];
43
44 return NULL;
36 } 45 }
37 46
38 void NativeDisplayDelegateDri::Initialize() { 47 void NativeDisplayDelegateDri::Initialize() {
39 device_manager_->AddObserver(this); 48 if (device_manager_)
49 device_manager_->AddObserver(this);
40 50
41 ScopedVector<HardwareDisplayControllerInfo> displays = 51 ScopedVector<HardwareDisplayControllerInfo> displays =
42 GetAvailableDisplayControllerInfos(dri_->get_fd()); 52 GetAvailableDisplayControllerInfos(dri_->get_fd());
43 53
44 // By default all displays show the same console buffer. 54 // By default all displays show the same console buffer.
45 console_buffer_.reset( 55 console_buffer_.reset(
46 new DriConsoleBuffer(dri_, displays[0]->crtc()->buffer_id)); 56 new DriConsoleBuffer(dri_, displays[0]->crtc()->buffer_id));
47 if (!console_buffer_->Initialize()) { 57 if (!console_buffer_->Initialize()) {
48 VLOG(1) << "Failed to initialize console buffer"; 58 VLOG(1) << "Failed to initialize console buffer";
49 console_buffer_.reset(); 59 console_buffer_.reset();
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 207 }
198 } 208 }
199 209
200 if (!found) 210 if (!found)
201 screen_manager_->RemoveDisplayController(old_displays[i]->crtc(), 211 screen_manager_->RemoveDisplayController(old_displays[i]->crtc(),
202 old_displays[i]->connector()); 212 old_displays[i]->connector());
203 } 213 }
204 } 214 }
205 215
206 } // namespace ui 216 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698