| OLD | NEW |
| 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> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 11 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 12 #include "base/format_macros.h" | 14 #include "base/format_macros.h" |
| 13 #include "base/logging.h" | 15 #include "base/logging.h" |
| 14 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
| 15 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 16 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 << " for display id: " << display->display_id() | 124 << " for display id: " << display->display_id() |
| 123 << " with product id: " << display->product_id(); | 125 << " with product id: " << display->product_id(); |
| 124 | 126 |
| 125 scoped_ptr<ColorCalibrationData> data(new ColorCalibrationData()); | 127 scoped_ptr<ColorCalibrationData> data(new ColorCalibrationData()); |
| 126 base::Callback<bool(void)> request( | 128 base::Callback<bool(void)> request( |
| 127 base::Bind(&ParseFile, path, base::Unretained(data.get()))); | 129 base::Bind(&ParseFile, path, base::Unretained(data.get()))); |
| 128 base::PostTaskAndReplyWithResult( | 130 base::PostTaskAndReplyWithResult( |
| 129 blocking_pool_, FROM_HERE, request, | 131 blocking_pool_, FROM_HERE, request, |
| 130 base::Bind(&DisplayColorManager::UpdateCalibrationData, AsWeakPtr(), | 132 base::Bind(&DisplayColorManager::UpdateCalibrationData, AsWeakPtr(), |
| 131 display->display_id(), display->product_id(), | 133 display->display_id(), display->product_id(), |
| 132 base::Passed(data.Pass()))); | 134 base::Passed(std::move(data)))); |
| 133 } | 135 } |
| 134 | 136 |
| 135 void DisplayColorManager::UpdateCalibrationData( | 137 void DisplayColorManager::UpdateCalibrationData( |
| 136 int64_t display_id, | 138 int64_t display_id, |
| 137 int64_t product_id, | 139 int64_t product_id, |
| 138 scoped_ptr<ColorCalibrationData> data, | 140 scoped_ptr<ColorCalibrationData> data, |
| 139 bool success) { | 141 bool success) { |
| 140 DCHECK_EQ(base::MessageLoop::current()->type(), base::MessageLoop::TYPE_UI); | 142 DCHECK_EQ(base::MessageLoop::current()->type(), base::MessageLoop::TYPE_UI); |
| 141 if (success) { | 143 if (success) { |
| 142 // The map takes over ownership of the underlying memory. | 144 // The map takes over ownership of the underlying memory. |
| 143 calibration_map_[product_id] = data.release(); | 145 calibration_map_[product_id] = data.release(); |
| 144 ApplyDisplayColorCalibration(display_id, product_id); | 146 ApplyDisplayColorCalibration(display_id, product_id); |
| 145 } | 147 } |
| 146 } | 148 } |
| 147 | 149 |
| 148 DisplayColorManager::ColorCalibrationData::ColorCalibrationData() {} | 150 DisplayColorManager::ColorCalibrationData::ColorCalibrationData() {} |
| 149 | 151 |
| 150 DisplayColorManager::ColorCalibrationData::~ColorCalibrationData() {} | 152 DisplayColorManager::ColorCalibrationData::~ColorCalibrationData() {} |
| 151 | 153 |
| 152 } // namespace ash | 154 } // namespace ash |
| OLD | NEW |