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

Side by Side Diff: ui/ozone/platform/drm/gpu/drm_device_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: 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/drm_device_manager.h" 5 #include "ui/ozone/platform/drm/gpu/drm_device_manager.h"
6 6
7 #include "base/file_descriptor_posix.h" 7 #include "base/file_descriptor_posix.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "ui/ozone/platform/drm/gpu/drm_device.h" 9 #include "ui/ozone/platform/drm/gpu/drm_device.h"
10 #include "ui/ozone/platform/drm/gpu/drm_device_generator.h" 10 #include "ui/ozone/platform/drm/gpu/drm_device_generator.h"
(...skipping 11 matching lines...) Expand all
22 } 22 }
23 23
24 private: 24 private:
25 base::FilePath path_; 25 base::FilePath path_;
26 }; 26 };
27 27
28 } // namespace 28 } // namespace
29 29
30 DrmDeviceManager::DrmDeviceManager( 30 DrmDeviceManager::DrmDeviceManager(
31 scoped_ptr<DrmDeviceGenerator> drm_device_generator) 31 scoped_ptr<DrmDeviceGenerator> drm_device_generator)
32 : drm_device_generator_(drm_device_generator.Pass()) { 32 : drm_device_generator_(std::move(drm_device_generator)) {}
33 }
34 33
35 DrmDeviceManager::~DrmDeviceManager() { 34 DrmDeviceManager::~DrmDeviceManager() {
36 DCHECK(drm_device_map_.empty()); 35 DCHECK(drm_device_map_.empty());
37 } 36 }
38 37
39 bool DrmDeviceManager::AddDrmDevice(const base::FilePath& path, 38 bool DrmDeviceManager::AddDrmDevice(const base::FilePath& path,
40 const base::FileDescriptor& fd) { 39 const base::FileDescriptor& fd) {
41 base::File file(fd.fd); 40 base::File file(fd.fd);
42 auto it = 41 auto it =
43 std::find_if(devices_.begin(), devices_.end(), FindByDevicePath(path)); 42 std::find_if(devices_.begin(), devices_.end(), FindByDevicePath(path));
44 if (it != devices_.end()) { 43 if (it != devices_.end()) {
45 VLOG(2) << "Got request to add existing device: " << path.value(); 44 VLOG(2) << "Got request to add existing device: " << path.value();
46 return false; 45 return false;
47 } 46 }
48 47
49 scoped_refptr<DrmDevice> device = 48 scoped_refptr<DrmDevice> device = drm_device_generator_->CreateDevice(
50 drm_device_generator_->CreateDevice(path, file.Pass(), !primary_device_); 49 path, std::move(file), !primary_device_);
51 if (!device) { 50 if (!device) {
52 LOG(ERROR) << "Could not initialize DRM device for " << path.value(); 51 LOG(ERROR) << "Could not initialize DRM device for " << path.value();
53 return false; 52 return false;
54 } 53 }
55 54
56 if (!primary_device_) 55 if (!primary_device_)
57 primary_device_ = device; 56 primary_device_ = device;
58 57
59 devices_.push_back(device); 58 devices_.push_back(device);
60 return true; 59 return true;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 return primary_device_; 97 return primary_device_;
99 98
100 return it->second; 99 return it->second;
101 } 100 }
102 101
103 const DrmDeviceVector& DrmDeviceManager::GetDrmDevices() const { 102 const DrmDeviceVector& DrmDeviceManager::GetDrmDevices() const {
104 return devices_; 103 return devices_;
105 } 104 }
106 105
107 } // namespace ui 106 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698