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

Side by Side Diff: chromeos/printing/ppd_provider.h

Issue 2476073003: Update PpdProvider threading model. (Closed)
Patch Set: Add more logging, add bypass for manufacturer issue 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CHROMEOS_PRINTING_PPD_PROVIDER_H_ 5 #ifndef CHROMEOS_PRINTING_PPD_PROVIDER_H_
6 #define CHROMEOS_PRINTING_PPD_PROVIDER_H_ 6 #define CHROMEOS_PRINTING_PPD_PROVIDER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/sequenced_task_runner.h"
15 #include "chromeos/chromeos_export.h" 16 #include "chromeos/chromeos_export.h"
16 #include "chromeos/printing/printer_configuration.h" 17 #include "chromeos/printing/printer_configuration.h"
17 18
18 namespace net { 19 namespace net {
19 class URLRequestContextGetter; 20 class URLRequestContextGetter;
20 } 21 }
21 22
22 namespace chromeos { 23 namespace chromeos {
23 namespace printing { 24 namespace printing {
24 25
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 69
69 // hostname of quirks server to query. 70 // hostname of quirks server to query.
70 std::string quirks_server = "chromeosquirksserver-pa.googleapis.com"; 71 std::string quirks_server = "chromeosquirksserver-pa.googleapis.com";
71 72
72 // Maximum size of the contents of a PPD file, in bytes. Trying to use a 73 // Maximum size of the contents of a PPD file, in bytes. Trying to use a
73 // PPD file bigger than this will cause INTERNAL_ERRORs at resolution time. 74 // PPD file bigger than this will cause INTERNAL_ERRORs at resolution time.
74 size_t max_ppd_contents_size_ = 100 * 1024; 75 size_t max_ppd_contents_size_ = 100 * 1024;
75 }; 76 };
76 77
77 // Create and return a new PpdProvider with the given cache and options. 78 // Create and return a new PpdProvider with the given cache and options.
79 // |disk_task_runner| is used to run operations that hit the disk. References
80 // to |url_context_getter| and |disk_task_runner| are taken.
78 static std::unique_ptr<PpdProvider> Create( 81 static std::unique_ptr<PpdProvider> Create(
79 const std::string& api_key, 82 const std::string& api_key,
80 scoped_refptr<net::URLRequestContextGetter> url_context_getter, 83 scoped_refptr<net::URLRequestContextGetter> url_context_getter,
84 scoped_refptr<base::SequencedTaskRunner> disk_task_runner,
stevenjb 2016/11/11 19:26:44 nit: file_task_runner is a more common term.
81 std::unique_ptr<PpdCache> cache, 85 std::unique_ptr<PpdCache> cache,
82 const Options& options = Options()); 86 const Options& options = Options());
83 87
84 virtual ~PpdProvider() {} 88 virtual ~PpdProvider() {}
85 89
86 // Given a PpdReference, attempt to resolve the PPD for printing. 90 // Given a PpdReference, attempt to resolve the PPD for printing.
87 // 91 //
88 // Must be called from a Sequenced Task context (i.e. 92 // Must be called from a Sequenced Task context (i.e.
89 // base::SequencedTaskRunnerHandle::IsSet() must be true). 93 // base::SequencedTaskRunnerHandle::IsSet() must be true).
90 // 94 //
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // whatever they give us directly into the cache without doing a resolve. 126 // whatever they give us directly into the cache without doing a resolve.
123 // This hook lets is do that. 127 // This hook lets is do that.
124 virtual bool CachePpd(const Printer::PpdReference& ppd_reference, 128 virtual bool CachePpd(const Printer::PpdReference& ppd_reference,
125 const base::FilePath& ppd_path) = 0; 129 const base::FilePath& ppd_path) = 0;
126 }; 130 };
127 131
128 } // namespace printing 132 } // namespace printing
129 } // namespace chromeos 133 } // namespace chromeos
130 134
131 #endif // CHROMEOS_PRINTING_PPD_PROVIDER_H_ 135 #endif // CHROMEOS_PRINTING_PPD_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698