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

Unified Diff: ash/display/display_color_manager_chromeos.cc

Issue 1528963002: Quirks Client for downloading and providing display profiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove hacks for clean, but non-working, draft Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ash/display/display_color_manager_chromeos.cc
diff --git a/ash/display/display_color_manager_chromeos.cc b/ash/display/display_color_manager_chromeos.cc
index 1241978958018acff967d30fbfd9dcb2d0c961dd..ee39058251473a608a05349de7f5e17fa846643c 100644
--- a/ash/display/display_color_manager_chromeos.cc
+++ b/ash/display/display_color_manager_chromeos.cc
@@ -8,7 +8,6 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
-#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/format_macros.h"
@@ -20,6 +19,7 @@
#include "base/task_runner_util.h"
#include "base/threading/sequenced_worker_pool.h"
#include "chromeos/chromeos_paths.h"
+#include "components/quirks_client/quirks_client.h"
#include "third_party/qcms/src/qcms.h"
#include "ui/display/types/display_snapshot.h"
#include "ui/display/types/gamma_ramp_rgb_entry.h"
@@ -31,8 +31,42 @@ namespace ash {
namespace {
-bool ParseFile(const base::FilePath& path,
- DisplayColorManager::ColorCalibrationData* data) {
+class FakeDisplaySnapshot : public ui::DisplaySnapshot {
+ public:
+ FakeDisplaySnapshot(int64_t product_id)
+ : ui::DisplaySnapshot(0, gfx::Point(0, 0), gfx::Size(0, 0),
+ ui::DISPLAY_CONNECTION_TYPE_NONE, false, false,
+ "test", base::FilePath(),
+ std::vector<const ui::DisplayMode*>(),
+ nullptr, nullptr) {
+ product_id_ = product_id;
+ }
+ ~FakeDisplaySnapshot() override{};
+
+ // DisplaySnapshot override:
+ std::string ToString() const override { return display_name_; }
+
+ DISALLOW_COPY_AND_ASSIGN(FakeDisplaySnapshot);
+};
+
+bool ParseDisplayProfile(const int64_t display_id,
+ const int64_t product_id,
+ DisplayColorManager::ColorCalibrationData* data) {
+ quirks_client::QuirksClient::DownloadFinishedCallback* callback = nullptr;
+ // TODO(glevin): Do we want to add a callback so that we can apply the icc
+ // profile as soon as it's downloaded?
+ base::FilePath path =
+ quirks_client::QuirksClient::RequestIccProfilePath(product_id, callback);
+ std::string product_string = base::StringPrintf("0x%08" PRIx64, product_id);
+ if (path.empty()) {
+ VLOG(1) << "No icc file found with product id: " << product_string
+ << " for display id: " << display_id;
+ } else {
+ VLOG(1) << "Loading ICC file " << path.value()
+ << " for display id: " << display_id
+ << " with product id: " << product_string;
+ }
+
if (!base::PathExists(path)) // No icc file for this display; not an error.
return false;
qcms_profile* display_profile = qcms_profile_from_path(path.value().c_str());
@@ -65,18 +99,10 @@ bool ParseFile(const base::FilePath& path,
data->lut[i].b = vcgt_data[(vcgt_channel_length * 2) + i];
}
qcms_profile_release(display_profile);
+ VLOG(1) << "Gamma data successfully read from icc file";
return true;
}
-base::FilePath PathForDisplaySnapshot(const ui::DisplaySnapshot* snapshot) {
- base::FilePath path;
- CHECK(
- PathService::Get(chromeos::DIR_DEVICE_COLOR_CALIBRATION_PROFILES, &path));
- path = path.Append(
- base::StringPrintf("%08" PRIx64 ".icc", snapshot->product_id()));
- return path;
-}
-
} // namespace
DisplayColorManager::DisplayColorManager(
@@ -119,14 +145,10 @@ void DisplayColorManager::LoadCalibrationForDisplay(
return;
}
- base::FilePath path = PathForDisplaySnapshot(display);
- VLOG(1) << "Loading ICC file " << path.value()
- << " for display id: " << display->display_id()
- << " with product id: " << display->product_id();
-
scoped_ptr<ColorCalibrationData> data(new ColorCalibrationData());
base::Callback<bool(void)> request(
- base::Bind(&ParseFile, path, base::Unretained(data.get())));
+ base::Bind(&ParseDisplayProfile, display->display_id(),
+ display->product_id(), base::Unretained(data.get())));
base::PostTaskAndReplyWithResult(
blocking_pool_, FROM_HERE, request,
stevenjb 2016/01/12 19:48:34 I don't understand how this was ever correct. This
base::Bind(&DisplayColorManager::UpdateCalibrationData, AsWeakPtr(),
@@ -134,6 +156,15 @@ void DisplayColorManager::LoadCalibrationForDisplay(
base::Passed(std::move(data))));
}
+// TODO!!! Remove!
+// Temporary debugging function for ChromeOS on Linux. Provides an entry point
+// into ParseDisplayProfile() from the same thread / earlier up the stack from
+// it's actual calling location (which isn't hit due to lack of display device)
+void DisplayColorManager::LoadCalibrationForDisplayQuirksTest() {
+ FakeDisplaySnapshot fake_snapshot(0x06af5c10);
+ LoadCalibrationForDisplay(&fake_snapshot);
+}
+
void DisplayColorManager::UpdateCalibrationData(
int64_t display_id,
int64_t product_id,
« no previous file with comments | « ash/display/display_color_manager_chromeos.h ('k') | ash/shell.cc » ('j') | ash/shell.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698