| OLD | NEW |
| 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_CACHE_H_ | 5 #ifndef CHROMEOS_PRINTING_PPD_CACHE_H_ |
| 6 #define CHROMEOS_PRINTING_PPD_CACHE_H_ | 6 #define CHROMEOS_PRINTING_PPD_CACHE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "chromeos/chromeos_export.h" | 15 #include "chromeos/chromeos_export.h" |
| 16 | 16 |
| 17 namespace chromeos { | 17 namespace chromeos { |
| 18 namespace printing { | |
| 19 | 18 |
| 20 // PpdCache manages a cache of locally-stored PPD files. At its core, it | 19 // PpdCache manages a cache of locally-stored PPD files. At its core, it |
| 21 // operates like a persistent hash from PpdReference to files. If you give the | 20 // operates like a persistent hash from PpdReference to files. If you give the |
| 22 // same PpdReference to Find() that was previously given to store, you should | 21 // same PpdReference to Find() that was previously given to store, you should |
| 23 // get the same FilePath back out (unless the previous entry has timed out of | 22 // get the same FilePath back out (unless the previous entry has timed out of |
| 24 // the cache). However, changing *any* field in PpdReference will make the | 23 // the cache). However, changing *any* field in PpdReference will make the |
| 25 // previous cache entry invalid. This is the intentional behavior -- we want to | 24 // previous cache entry invalid. This is the intentional behavior -- we want to |
| 26 // re-run the resolution logic if we have new meta-information about a printer. | 25 // re-run the resolution logic if we have new meta-information about a printer. |
| 27 // | 26 // |
| 28 // All cache functions must be called on a thread which is permitted to do I/O. | 27 // All cache functions must be called on a thread which is permitted to do I/O. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 55 // be invoked on completion. | 54 // be invoked on completion. |
| 56 virtual void Store(const std::string& key, | 55 virtual void Store(const std::string& key, |
| 57 const std::string& contents, | 56 const std::string& contents, |
| 58 const base::Closure& cb) = 0; | 57 const base::Closure& cb) = 0; |
| 59 | 58 |
| 60 protected: | 59 protected: |
| 61 friend class base::RefCounted<PpdCache>; | 60 friend class base::RefCounted<PpdCache>; |
| 62 virtual ~PpdCache() {} | 61 virtual ~PpdCache() {} |
| 63 }; | 62 }; |
| 64 | 63 |
| 65 } // namespace printing | |
| 66 } // namespace chromeos | 64 } // namespace chromeos |
| 67 | 65 |
| 68 #endif // CHROMEOS_PRINTING_PPD_CACHE_H_ | 66 #endif // CHROMEOS_PRINTING_PPD_CACHE_H_ |
| OLD | NEW |