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

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

Issue 548613002: Revert of [Ozone-GBM] Handle GPU crashes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 46
47 for (int i = 0; i < property->count_enums; ++i) 47 for (int i = 0; i < property->count_enums; ++i)
48 if (name == property->enums[i].name) 48 if (name == property->enums[i].name)
49 return i; 49 return i;
50 50
51 NOTREACHED(); 51 NOTREACHED();
52 return 0; 52 return 0;
53 } 53 }
54 54
55 class DisplaySnapshotComparator {
56 public:
57 DisplaySnapshotComparator(const DisplaySnapshotDri* snapshot)
58 : snapshot_(snapshot) {}
59
60 bool operator()(const DisplaySnapshotDri* other) const {
61 if (snapshot_->connector() == other->connector() &&
62 snapshot_->crtc() == other->crtc())
63 return true;
64
65 return false;
66 }
67
68 private:
69 const DisplaySnapshotDri* snapshot_;
70 };
71
72 } // namespace 55 } // namespace
73 56
74 NativeDisplayDelegateDri::NativeDisplayDelegateDri( 57 NativeDisplayDelegateDri::NativeDisplayDelegateDri(
75 DriWrapper* dri, 58 DriWrapper* dri,
76 ScreenManager* screen_manager, 59 ScreenManager* screen_manager,
77 DeviceManager* device_manager) 60 DeviceManager* device_manager)
78 : dri_(dri), 61 : dri_(dri),
79 screen_manager_(screen_manager), 62 screen_manager_(screen_manager),
80 device_manager_(device_manager) { 63 device_manager_(device_manager) {
81 } 64 }
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 VLOG(1) << "Got display changed event"; 281 VLOG(1) << "Got display changed event";
299 FOR_EACH_OBSERVER( 282 FOR_EACH_OBSERVER(
300 NativeDisplayObserver, observers_, OnConfigurationChanged()); 283 NativeDisplayObserver, observers_, OnConfigurationChanged());
301 } 284 }
302 } 285 }
303 286
304 void NativeDisplayDelegateDri::NotifyScreenManager( 287 void NativeDisplayDelegateDri::NotifyScreenManager(
305 const std::vector<DisplaySnapshotDri*>& new_displays, 288 const std::vector<DisplaySnapshotDri*>& new_displays,
306 const std::vector<DisplaySnapshotDri*>& old_displays) const { 289 const std::vector<DisplaySnapshotDri*>& old_displays) const {
307 for (size_t i = 0; i < old_displays.size(); ++i) { 290 for (size_t i = 0; i < old_displays.size(); ++i) {
308 const std::vector<DisplaySnapshotDri*>::const_iterator it = 291 bool found = false;
309 std::find_if(new_displays.begin(), 292 for (size_t j = 0; j < new_displays.size(); ++j) {
310 new_displays.end(), 293 if (old_displays[i]->connector() == new_displays[j]->connector() &&
311 DisplaySnapshotComparator(old_displays[i])); 294 old_displays[i]->crtc() == new_displays[j]->crtc()) {
295 found = true;
296 break;
297 }
298 }
312 299
313 if (it == new_displays.end()) 300 if (!found)
314 screen_manager_->RemoveDisplayController(old_displays[i]->crtc()); 301 screen_manager_->RemoveDisplayController(old_displays[i]->crtc());
315 } 302 }
316
317 for (size_t i = 0; i < new_displays.size(); ++i) {
318 const std::vector<DisplaySnapshotDri*>::const_iterator it =
319 std::find_if(old_displays.begin(),
320 old_displays.end(),
321 DisplaySnapshotComparator(new_displays[i]));
322
323 if (it == old_displays.end())
324 screen_manager_->AddDisplayController(new_displays[i]->crtc(),
325 new_displays[i]->connector());
326 }
327 } 303 }
328 304
329 } // namespace ui 305 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698