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

Side by Side Diff: chromeos/printing/ppd_cache.cc

Issue 2958183002: Add sequencing comment to PpdCacheImpl. (Closed)
Patch Set: Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chromeos/printing/ppd_cache.h" 5 #include "chromeos/printing/ppd_cache.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 static_cast<int>(checksum.size())) { 109 static_cast<int>(checksum.size())) {
110 LOG(ERROR) << "Failed to create ppd cache file"; 110 LOG(ERROR) << "Failed to create ppd cache file";
111 file.Close(); 111 file.Close();
112 if (!base::DeleteFile(path, false)) { 112 if (!base::DeleteFile(path, false)) {
113 LOG(ERROR) << "Failed to cleanup failed creation."; 113 LOG(ERROR) << "Failed to cleanup failed creation.";
114 } 114 }
115 } 115 }
116 } 116 }
117 } 117 }
118 118
119 // Implementation of the PpdCache that uses two separate task runners for Store
120 // and Fetch since the two operations have different priorities. It is okay
121 // that Store and Fetch are not synchronized because we assume that we won't
122 // overwrite a file that we're trying to read simultaneously. If this
123 // assumption is invalidated, the sequencing will require revisiting.
Carlson 2017/06/29 18:47:09 The more I think about it, the more I'm convinced
skau 2017/06/30 20:55:49 Okay. It's updated. Really, what we're saying is
119 class PpdCacheImpl : public PpdCache { 124 class PpdCacheImpl : public PpdCache {
120 public: 125 public:
121 explicit PpdCacheImpl(const base::FilePath& cache_base_dir) 126 explicit PpdCacheImpl(const base::FilePath& cache_base_dir)
122 : cache_base_dir_(cache_base_dir), 127 : cache_base_dir_(cache_base_dir),
123 fetch_task_runner_(base::CreateSequencedTaskRunnerWithTraits( 128 fetch_task_runner_(base::CreateSequencedTaskRunnerWithTraits(
124 {base::TaskPriority::USER_VISIBLE, base::MayBlock(), 129 {base::TaskPriority::USER_VISIBLE, base::MayBlock(),
125 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN})), 130 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN})),
126 store_task_runner_(base::CreateSequencedTaskRunnerWithTraits( 131 store_task_runner_(base::CreateSequencedTaskRunnerWithTraits(
127 {base::TaskPriority::BACKGROUND, base::MayBlock(), 132 {base::TaskPriority::BACKGROUND, base::MayBlock(),
128 base::TaskShutdownBehavior::BLOCK_SHUTDOWN})) {} 133 base::TaskShutdownBehavior::BLOCK_SHUTDOWN})) {}
(...skipping 26 matching lines...) Expand all
155 160
156 } // namespace 161 } // namespace
157 162
158 // static 163 // static
159 scoped_refptr<PpdCache> PpdCache::Create(const base::FilePath& cache_base_dir) { 164 scoped_refptr<PpdCache> PpdCache::Create(const base::FilePath& cache_base_dir) {
160 return scoped_refptr<PpdCache>(new PpdCacheImpl(cache_base_dir)); 165 return scoped_refptr<PpdCache>(new PpdCacheImpl(cache_base_dir));
161 } 166 }
162 167
163 } // namespace printing 168 } // namespace printing
164 } // namespace chromeos 169 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698