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

Side by Side Diff: net/disk_cache/blockfile/file_posix.cc

Issue 2077413009: Add TaskPriority as a parameter to SequencedWorkerPool in preparation for TaskScheduler experiment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a2_hook
Patch Set: tweak comment Created 4 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 | « ios/web/web_thread_impl.cc ('k') | net/disk_cache/simple/simple_backend_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/disk_cache/blockfile/file.h" 5 #include "net/disk_cache/blockfile/file.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <limits> 8 #include <limits>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/run_loop.h" 15 #include "base/run_loop.h"
16 #include "base/task_runner_util.h" 16 #include "base/task_runner_util.h"
17 #include "base/threading/sequenced_worker_pool.h" 17 #include "base/threading/sequenced_worker_pool.h"
18 #include "net/base/net_errors.h" 18 #include "net/base/net_errors.h"
19 #include "net/disk_cache/disk_cache.h" 19 #include "net/disk_cache/disk_cache.h"
20 20
21 namespace { 21 namespace {
22 22
23 // The maximum number of threads for this pool. 23 // The maximum number of threads for this pool.
24 const int kMaxThreads = 5; 24 const int kMaxThreads = 5;
25 25
26 class FileWorkerPool : public base::SequencedWorkerPool { 26 class FileWorkerPool : public base::SequencedWorkerPool {
27 public: 27 public:
28 FileWorkerPool() : base::SequencedWorkerPool(kMaxThreads, "CachePool") {} 28 FileWorkerPool()
29 : base::SequencedWorkerPool(kMaxThreads,
30 "CachePool",
31 base::TaskPriority::USER_BLOCKING) {}
29 32
30 protected: 33 protected:
31 ~FileWorkerPool() override {} 34 ~FileWorkerPool() override {}
32 }; 35 };
33 36
34 base::LazyInstance<FileWorkerPool>::Leaky s_worker_pool = 37 base::LazyInstance<FileWorkerPool>::Leaky s_worker_pool =
35 LAZY_INSTANCE_INITIALIZER; 38 LAZY_INSTANCE_INITIALIZER;
36 39
37 } // namespace 40 } // namespace
38 41
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 return net::ERR_CACHE_WRITE_FAILURE; 182 return net::ERR_CACHE_WRITE_FAILURE;
180 } 183 }
181 184
182 // This method actually makes sure that the last reference to the file doesn't 185 // This method actually makes sure that the last reference to the file doesn't
183 // go away on the worker pool. 186 // go away on the worker pool.
184 void File::OnOperationComplete(FileIOCallback* callback, int result) { 187 void File::OnOperationComplete(FileIOCallback* callback, int result) {
185 callback->OnFileIOComplete(result); 188 callback->OnFileIOComplete(result);
186 } 189 }
187 190
188 } // namespace disk_cache 191 } // namespace disk_cache
OLDNEW
« no previous file with comments | « ios/web/web_thread_impl.cc ('k') | net/disk_cache/simple/simple_backend_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698