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

Unified Diff: chromeos/printing/ppd_cache.cc

Issue 2476073003: Update PpdProvider threading model. (Closed)
Patch Set: Change CHECK to DCHECK Created 4 years, 1 month 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: chromeos/printing/ppd_cache.cc
diff --git a/chromeos/printing/ppd_cache.cc b/chromeos/printing/ppd_cache.cc
index 437d626a5b3fecc1baab73a02398581731b289b9..6671780b68d3438371efec6d34b1e00b0d45c8aa 100644
--- a/chromeos/printing/ppd_cache.cc
+++ b/chromeos/printing/ppd_cache.cc
@@ -13,6 +13,7 @@
#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
+#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "base/values.h"
#include "crypto/sha2.h"
@@ -48,6 +49,7 @@ class PpdCacheImpl : public PpdCache {
// Public API functions.
base::Optional<base::FilePath> Find(
const Printer::PpdReference& reference) const override {
+ base::ThreadRestrictions::AssertIOAllowed();
base::Optional<base::FilePath> ret;
// We can't know here if we have a gzipped or un-gzipped version, so just
@@ -91,6 +93,7 @@ class PpdCacheImpl : public PpdCache {
}
const PpdProvider::AvailablePrintersMap* FindAvailablePrinters() override {
+ base::ThreadRestrictions::AssertIOAllowed();
if (available_printers_ != nullptr &&
base::Time::Now() - available_printers_timestamp_ <
options_.max_available_list_staleness) {
@@ -159,7 +162,8 @@ class PpdCacheImpl : public PpdCache {
}
if (base::WriteFile(available_printers_file_, contents.data(),
contents.size()) != static_cast<int>(contents.size())) {
- LOG(ERROR) << "Failed to write available printers cache";
+ LOG(ERROR) << "Failed to write available printers cache to "
+ << available_printers_file_.MaybeAsASCII();
}
}
@@ -229,7 +233,8 @@ class PpdCacheImpl : public PpdCache {
if (!base::ReadFileToStringWithMaxSize(
available_printers_file_, buf,
options_.max_available_list_cached_size)) {
- LOG(ERROR) << "Failed to read printer cache";
+ LOG(ERROR) << "Failed to read printer cache from "
+ << available_printers_file_.MaybeAsASCII();
buf->clear();
return false;
}
« no previous file with comments | « chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc ('k') | chromeos/printing/ppd_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698