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

Side by Side Diff: ui/ozone/platform/drm/host/drm_display_host_manager.cc

Issue 2571543002: Fix use after free for cached_displays_. (Closed)
Patch Set: Add invalidate to tests. Created 4 years 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
« no previous file with comments | « ui/ozone/demo/ozone_demo.cc ('k') | ui/ozone/platform/drm/host/drm_native_display_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/drm/host/drm_display_host_manager.h" 5 #include "ui/ozone/platform/drm/host/drm_display_host_manager.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <xf86drm.h> 9 #include <xf86drm.h>
10 10
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 GpuRelinquishedDisplayControl(false); 352 GpuRelinquishedDisplayControl(false);
353 353
354 device_manager_->ScanDevices(this); 354 device_manager_->ScanDevices(this);
355 NotifyDisplayDelegate(); 355 NotifyDisplayDelegate();
356 } 356 }
357 357
358 void DrmDisplayHostManager::OnGpuThreadRetired() {} 358 void DrmDisplayHostManager::OnGpuThreadRetired() {}
359 359
360 void DrmDisplayHostManager::GpuHasUpdatedNativeDisplays( 360 void DrmDisplayHostManager::GpuHasUpdatedNativeDisplays(
361 const std::vector<DisplaySnapshot_Params>& params) { 361 const std::vector<DisplaySnapshot_Params>& params) {
362 if (delegate_)
363 delegate_->OnDisplaySnapshotsInvalidated();
362 std::vector<std::unique_ptr<DrmDisplayHost>> old_displays; 364 std::vector<std::unique_ptr<DrmDisplayHost>> old_displays;
363 displays_.swap(old_displays); 365 displays_.swap(old_displays);
364 for (size_t i = 0; i < params.size(); ++i) { 366 for (size_t i = 0; i < params.size(); ++i) {
365 auto it = std::find_if(old_displays.begin(), old_displays.end(), 367 auto it = std::find_if(old_displays.begin(), old_displays.end(),
366 FindDrmDisplayHostById(params[i].display_id)); 368 FindDrmDisplayHostById(params[i].display_id));
367 if (it == old_displays.end()) { 369 if (it == old_displays.end()) {
368 displays_.push_back(base::MakeUnique<DrmDisplayHost>( 370 displays_.push_back(base::MakeUnique<DrmDisplayHost>(
369 proxy_, params[i], false /* is_dummy */)); 371 proxy_, params[i], false /* is_dummy */));
370 } else { 372 } else {
371 (*it)->UpdateDisplaySnapshot(params[i]); 373 (*it)->UpdateDisplaySnapshot(params[i]);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 461
460 callback.Run(snapshots); 462 callback.Run(snapshots);
461 } 463 }
462 464
463 void DrmDisplayHostManager::NotifyDisplayDelegate() const { 465 void DrmDisplayHostManager::NotifyDisplayDelegate() const {
464 if (delegate_) 466 if (delegate_)
465 delegate_->OnConfigurationChanged(); 467 delegate_->OnConfigurationChanged();
466 } 468 }
467 469
468 } // namespace ui 470 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/demo/ozone_demo.cc ('k') | ui/ozone/platform/drm/host/drm_native_display_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698