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

Side by Side Diff: ash/display/display_color_manager_chromeos.cc

Issue 1867223004: Convert //ash from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 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 "ash/display/display_color_manager_chromeos.h" 5 #include "ash/display/display_color_manager_chromeos.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "base/task_runner_util.h" 13 #include "base/task_runner_util.h"
14 #include "base/threading/sequenced_worker_pool.h" 14 #include "base/threading/sequenced_worker_pool.h"
15 #include "components/quirks/quirks_manager.h" 15 #include "components/quirks/quirks_manager.h"
16 #include "third_party/qcms/src/qcms.h" 16 #include "third_party/qcms/src/qcms.h"
17 #include "ui/display/types/display_snapshot.h" 17 #include "ui/display/types/display_snapshot.h"
18 #include "ui/display/types/gamma_ramp_rgb_entry.h" 18 #include "ui/display/types/gamma_ramp_rgb_entry.h"
19 #include "ui/gfx/display.h" 19 #include "ui/gfx/display.h"
20 20
21 namespace ash { 21 namespace ash {
22 22
23 namespace { 23 namespace {
24 24
25 scoped_ptr<DisplayColorManager::ColorCalibrationData> ParseDisplayProfile( 25 std::unique_ptr<DisplayColorManager::ColorCalibrationData> ParseDisplayProfile(
26 const base::FilePath& path, 26 const base::FilePath& path,
27 bool has_color_correction_matrix) { 27 bool has_color_correction_matrix) {
28 VLOG(1) << "Trying ICC file " << path.value() 28 VLOG(1) << "Trying ICC file " << path.value()
29 << " has_color_correction_matrix: " 29 << " has_color_correction_matrix: "
30 << (has_color_correction_matrix ? "true" : "false"); 30 << (has_color_correction_matrix ? "true" : "false");
31 qcms_profile* display_profile = qcms_profile_from_path(path.value().c_str()); 31 qcms_profile* display_profile = qcms_profile_from_path(path.value().c_str());
32 if (!display_profile) { 32 if (!display_profile) {
33 LOG(WARNING) << "Unable to load ICC file: " << path.value(); 33 LOG(WARNING) << "Unable to load ICC file: " << path.value();
34 return nullptr; 34 return nullptr;
35 } 35 }
36 36
37 size_t vcgt_channel_length = 37 size_t vcgt_channel_length =
38 qcms_profile_get_vcgt_channel_length(display_profile); 38 qcms_profile_get_vcgt_channel_length(display_profile);
39 39
40 if (!has_color_correction_matrix && !vcgt_channel_length) { 40 if (!has_color_correction_matrix && !vcgt_channel_length) {
41 LOG(WARNING) << "No vcgt table or color correction matrix in ICC file: " 41 LOG(WARNING) << "No vcgt table or color correction matrix in ICC file: "
42 << path.value(); 42 << path.value();
43 qcms_profile_release(display_profile); 43 qcms_profile_release(display_profile);
44 return nullptr; 44 return nullptr;
45 } 45 }
46 46
47 scoped_ptr<DisplayColorManager::ColorCalibrationData> data( 47 std::unique_ptr<DisplayColorManager::ColorCalibrationData> data(
48 new DisplayColorManager::ColorCalibrationData()); 48 new DisplayColorManager::ColorCalibrationData());
49 if (vcgt_channel_length) { 49 if (vcgt_channel_length) {
50 VLOG_IF(1, has_color_correction_matrix) 50 VLOG_IF(1, has_color_correction_matrix)
51 << "Using VCGT data on CTM enabled platform."; 51 << "Using VCGT data on CTM enabled platform.";
52 52
53 std::vector<uint16_t> vcgt_data; 53 std::vector<uint16_t> vcgt_data;
54 vcgt_data.resize(vcgt_channel_length * 3); 54 vcgt_data.resize(vcgt_channel_length * 3);
55 if (!qcms_profile_get_vcgt_rgb_channels(display_profile, &vcgt_data[0])) { 55 if (!qcms_profile_get_vcgt_rgb_channels(display_profile, &vcgt_data[0])) {
56 LOG(WARNING) << "Unable to get vcgt data"; 56 LOG(WARNING) << "Unable to get vcgt data";
57 qcms_profile_release(display_profile); 57 qcms_profile_release(display_profile);
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 base::PostTaskAndReplyWithResult( 229 base::PostTaskAndReplyWithResult(
230 blocking_pool_, FROM_HERE, 230 blocking_pool_, FROM_HERE,
231 base::Bind(&ParseDisplayProfile, path, has_color_correction_matrix), 231 base::Bind(&ParseDisplayProfile, path, has_color_correction_matrix),
232 base::Bind(&DisplayColorManager::UpdateCalibrationData, 232 base::Bind(&DisplayColorManager::UpdateCalibrationData,
233 weak_ptr_factory_.GetWeakPtr(), display_id, product_id)); 233 weak_ptr_factory_.GetWeakPtr(), display_id, product_id));
234 } 234 }
235 235
236 void DisplayColorManager::UpdateCalibrationData( 236 void DisplayColorManager::UpdateCalibrationData(
237 int64_t display_id, 237 int64_t display_id,
238 int64_t product_id, 238 int64_t product_id,
239 scoped_ptr<ColorCalibrationData> data) { 239 std::unique_ptr<ColorCalibrationData> data) {
240 DCHECK(thread_checker_.CalledOnValidThread()); 240 DCHECK(thread_checker_.CalledOnValidThread());
241 if (data) { 241 if (data) {
242 // The map takes over ownership of the underlying memory. 242 // The map takes over ownership of the underlying memory.
243 calibration_map_[product_id] = data.release(); 243 calibration_map_[product_id] = data.release();
244 ApplyDisplayColorCalibration(display_id, product_id); 244 ApplyDisplayColorCalibration(display_id, product_id);
245 } 245 }
246 } 246 }
247 247
248 DisplayColorManager::ColorCalibrationData::ColorCalibrationData() {} 248 DisplayColorManager::ColorCalibrationData::ColorCalibrationData() {}
249 249
250 DisplayColorManager::ColorCalibrationData::~ColorCalibrationData() {} 250 DisplayColorManager::ColorCalibrationData::~ColorCalibrationData() {}
251 251
252 } // namespace ash 252 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698