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

Unified Diff: chromeos/printing/ppd_provider.cc

Issue 2545663002: Hookup the PpdProvider in the printer setup flow. (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: chromeos/printing/ppd_provider.cc
diff --git a/chromeos/printing/ppd_provider.cc b/chromeos/printing/ppd_provider.cc
index 80e7b00f24cbc0469b878423c9148b9ddfa9f315..40bbc77e9d1c68080899a9449bd8de939549e4b9 100644
--- a/chromeos/printing/ppd_provider.cc
+++ b/chromeos/printing/ppd_provider.cc
@@ -6,6 +6,7 @@
#include <utility>
+#include "base/bind_helpers.h"
#include "base/files/file_util.h"
#include "base/json/json_parser.h"
#include "base/memory/ptr_util.h"
@@ -92,7 +93,7 @@ class PpdProviderImpl : public PpdProvider {
raw_cache_result_ptr),
base::Bind(&PpdProviderImpl::ResolveCacheLookupDone,
weak_factory_.GetWeakPtr(), ppd_reference, cb,
- std::move(cache_result)));
+ base::Passed(&cache_result)));
DCHECK(post_result);
}
@@ -115,9 +116,13 @@ class PpdProviderImpl : public PpdProvider {
bool CachePpd(const Printer::PpdReference& ppd_reference,
const base::FilePath& ppd_path) override {
+ VLOG(1) << "Caching PPD";
std::string buf;
if (!base::ReadFileToStringWithMaxSize(ppd_path, &buf,
options_.max_ppd_contents_size_)) {
+ VLOG(1) << "Read bytes: " << buf.size()
+ << " max: " << options_.max_ppd_contents_size_;
+ LOG(WARNING) << "Failed to read ppd file " << ppd_path.value();
return false;
}
return static_cast<bool>(cache_->Store(ppd_reference, buf));
@@ -132,7 +137,9 @@ class PpdProviderImpl : public PpdProvider {
void ResolveDoCacheLookup(
const Printer::PpdReference& reference,
base::Optional<base::FilePath>* cache_result) const {
+ VLOG(1) << "Checking cache for result";
*cache_result = cache_->Find(reference);
+ VLOG(1) << "result found? " << cache_result->has_value();
}
void QueryAvailableDoCacheLookup(
@@ -157,6 +164,7 @@ class PpdProviderImpl : public PpdProvider {
const std::unique_ptr<base::Optional<base::FilePath>>& cache_result) {
CHECK(resolve_sequence_checker_.CalledOnValidSequence());
if (*cache_result) {
+ VLOG(1) << "Cache hit!";
// Cache hit. Schedule the callback now and return.
resolve_inflight_ = false;
done_callback.Run(PpdProvider::SUCCESS, cache_result->value());
@@ -170,11 +178,13 @@ class PpdProviderImpl : public PpdProvider {
// probably means the quirks server one doesn't work for some reason, so we
// shouldn't silently use it.
if (!ppd_reference.user_supplied_ppd_url.empty()) {
+ VLOG(1) << "Input error";
resolve_inflight_ = false;
done_callback.Run(PpdProvider::NOT_FOUND, base::FilePath());
return;
}
+ VLOG(1) << "Perform PPD download";
// Missed in the cache, so start a URLRequest to resolve the request.
resolve_fetcher_delegate_ = base::MakeUnique<ForwardingURLFetcherDelegate>(
base::Bind(&PpdProviderImpl::OnResolveFetchComplete,

Powered by Google App Engine
This is Rietveld 408576698