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

Side by Side Diff: net/disk_cache/simple/simple_backend_impl.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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/simple/simple_backend_impl.h" 5 #include "net/disk_cache/simple/simple_backend_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstdlib> 8 #include <cstdlib>
9 #include <functional> 9 #include <functional>
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 const char kThreadNamePrefix[] = "SimpleCache"; 59 const char kThreadNamePrefix[] = "SimpleCache";
60 60
61 // Maximum fraction of the cache that one entry can consume. 61 // Maximum fraction of the cache that one entry can consume.
62 const int kMaxFileRatio = 8; 62 const int kMaxFileRatio = 8;
63 63
64 class LeakySequencedWorkerPool { 64 class LeakySequencedWorkerPool {
65 public: 65 public:
66 LeakySequencedWorkerPool() 66 LeakySequencedWorkerPool()
67 : sequenced_worker_pool_( 67 : sequenced_worker_pool_(
68 new SequencedWorkerPool(kMaxWorkerThreads, kThreadNamePrefix)) {} 68 new SequencedWorkerPool(kMaxWorkerThreads,
69 kThreadNamePrefix,
70 base::TaskPriority::USER_BLOCKING)) {}
69 71
70 void FlushForTesting() { sequenced_worker_pool_->FlushForTesting(); } 72 void FlushForTesting() { sequenced_worker_pool_->FlushForTesting(); }
71 73
72 scoped_refptr<base::TaskRunner> GetTaskRunner() { 74 scoped_refptr<base::TaskRunner> GetTaskRunner() {
73 return sequenced_worker_pool_->GetTaskRunnerWithShutdownBehavior( 75 return sequenced_worker_pool_->GetTaskRunnerWithShutdownBehavior(
74 SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); 76 SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
75 } 77 }
76 78
77 private: 79 private:
78 scoped_refptr<SequencedWorkerPool> sequenced_worker_pool_; 80 scoped_refptr<SequencedWorkerPool> sequenced_worker_pool_;
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 } 718 }
717 719
718 // static 720 // static
719 void SimpleBackendImpl::FlushWorkerPoolForTesting() { 721 void SimpleBackendImpl::FlushWorkerPoolForTesting() {
720 // We only need to do this if we there is an active task runner. 722 // We only need to do this if we there is an active task runner.
721 if (base::ThreadTaskRunnerHandle::IsSet()) 723 if (base::ThreadTaskRunnerHandle::IsSet())
722 g_sequenced_worker_pool.Get().FlushForTesting(); 724 g_sequenced_worker_pool.Get().FlushForTesting();
723 } 725 }
724 726
725 } // namespace disk_cache 727 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/blockfile/file_posix.cc ('k') | net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698