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

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

Issue 1528373002: Replace Pass() with std::move in ui/ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add #include <utility> Created 5 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
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 <xf86drm.h> 8 #include <xf86drm.h>
9 #include <utility>
9 10
10 #include "base/files/file_enumerator.h" 11 #include "base/files/file_enumerator.h"
11 #include "base/thread_task_runner_handle.h" 12 #include "base/thread_task_runner_handle.h"
12 #include "base/threading/thread_restrictions.h" 13 #include "base/threading/thread_restrictions.h"
13 #include "base/threading/worker_pool.h" 14 #include "base/threading/worker_pool.h"
14 #include "ui/display/types/display_snapshot.h" 15 #include "ui/display/types/display_snapshot.h"
15 #include "ui/events/ozone/device/device_event.h" 16 #include "ui/events/ozone/device/device_event.h"
16 #include "ui/events/ozone/device/device_manager.h" 17 #include "ui/events/ozone/device/device_manager.h"
17 #include "ui/ozone/common/display_util.h" 18 #include "ui/ozone/common/display_util.h"
18 #include "ui/ozone/common/gpu/ozone_gpu_messages.h" 19 #include "ui/ozone/common/gpu/ozone_gpu_messages.h"
(...skipping 20 matching lines...) Expand all
39 "CHANGE", 40 "CHANGE",
40 }; 41 };
41 42
42 void OpenDeviceOnWorkerThread( 43 void OpenDeviceOnWorkerThread(
43 const base::FilePath& path, 44 const base::FilePath& path,
44 const scoped_refptr<base::TaskRunner>& reply_runner, 45 const scoped_refptr<base::TaskRunner>& reply_runner,
45 const OnOpenDeviceReplyCallback& callback) { 46 const OnOpenDeviceReplyCallback& callback) {
46 scoped_ptr<DrmDeviceHandle> handle(new DrmDeviceHandle()); 47 scoped_ptr<DrmDeviceHandle> handle(new DrmDeviceHandle());
47 handle->Initialize(path); 48 handle->Initialize(path);
48 reply_runner->PostTask( 49 reply_runner->PostTask(
49 FROM_HERE, base::Bind(callback, path, base::Passed(handle.Pass()))); 50 FROM_HERE, base::Bind(callback, path, base::Passed(std::move(handle))));
50 } 51 }
51 52
52 base::FilePath GetPrimaryDisplayCardPath() { 53 base::FilePath GetPrimaryDisplayCardPath() {
53 struct drm_mode_card_res res; 54 struct drm_mode_card_res res;
54 for (int i = 0; /* end on first card# that does not exist */; i++) { 55 for (int i = 0; /* end on first card# that does not exist */; i++) {
55 std::string card_path = base::StringPrintf(kDefaultGraphicsCardPattern, i); 56 std::string card_path = base::StringPrintf(kDefaultGraphicsCardPattern, i);
56 57
57 if (access(card_path.c_str(), F_OK) != 0) 58 if (access(card_path.c_str(), F_OK) != 0)
58 break; 59 break;
59 60
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 // Signal that we're taking DRM master since we're going through the 322 // Signal that we're taking DRM master since we're going through the
322 // initialization process again and we'll take all the available resources. 323 // initialization process again and we'll take all the available resources.
323 if (!take_display_control_callback_.is_null()) 324 if (!take_display_control_callback_.is_null())
324 OnTakeDisplayControl(true); 325 OnTakeDisplayControl(true);
325 326
326 if (!relinquish_display_control_callback_.is_null()) 327 if (!relinquish_display_control_callback_.is_null())
327 OnRelinquishDisplayControl(false); 328 OnRelinquishDisplayControl(false);
328 329
329 drm_devices_.clear(); 330 drm_devices_.clear();
330 drm_devices_.insert(primary_graphics_card_path_); 331 drm_devices_.insert(primary_graphics_card_path_);
331 scoped_ptr<DrmDeviceHandle> handle = primary_drm_device_handle_.Pass(); 332 scoped_ptr<DrmDeviceHandle> handle = std::move(primary_drm_device_handle_);
332 if (!handle) { 333 if (!handle) {
333 base::ThreadRestrictions::ScopedAllowIO allow_io; 334 base::ThreadRestrictions::ScopedAllowIO allow_io;
334 handle.reset(new DrmDeviceHandle()); 335 handle.reset(new DrmDeviceHandle());
335 if (!handle->Initialize(primary_graphics_card_path_)) 336 if (!handle->Initialize(primary_graphics_card_path_))
336 LOG(FATAL) << "Failed to open primary graphics card"; 337 LOG(FATAL) << "Failed to open primary graphics card";
337 } 338 }
338 339
339 // Send the primary device first since this is used to initialize graphics 340 // Send the primary device first since this is used to initialize graphics
340 // state. 341 // state.
341 proxy_->Send(new OzoneGpuMsg_AddGraphicsDevice( 342 proxy_->Send(new OzoneGpuMsg_AddGraphicsDevice(
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 468
468 callback.Run(snapshots); 469 callback.Run(snapshots);
469 } 470 }
470 471
471 void DrmDisplayHostManager::NotifyDisplayDelegate() const { 472 void DrmDisplayHostManager::NotifyDisplayDelegate() const {
472 if (delegate_) 473 if (delegate_)
473 delegate_->OnConfigurationChanged(); 474 delegate_->OnConfigurationChanged();
474 } 475 }
475 476
476 } // namespace ui 477 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/host/drm_device_handle.cc ('k') | ui/ozone/platform/drm/ozone_platform_gbm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698