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

Side by Side Diff: components/precache/core/fetcher_pool.h

Issue 1961153003: Add pause/resume functionality to precache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test fix Created 4 years, 6 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 | « components/precache/core/BUILD.gn ('k') | components/precache/core/precache_database.h » ('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 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 COMPONENTS_PRECACHE_CORE_FETCHER_POOL_H_ 5 #ifndef COMPONENTS_PRECACHE_CORE_FETCHER_POOL_H_
6 #define COMPONENTS_PRECACHE_CORE_FETCHER_POOL_H_ 6 #define COMPONENTS_PRECACHE_CORE_FETCHER_POOL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <unordered_map> 9 #include <unordered_map>
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 // Deletes all the elements in the pool. 61 // Deletes all the elements in the pool.
62 void DeleteAll() { elements_.clear(); } 62 void DeleteAll() { elements_.clear(); }
63 63
64 // Returns true iff the pool is empty. 64 // Returns true iff the pool is empty.
65 bool IsEmpty() const { return elements_.empty(); } 65 bool IsEmpty() const { return elements_.empty(); }
66 66
67 // Returns true iff the pool can accept a new element. 67 // Returns true iff the pool can accept a new element.
68 bool IsAvailable() const { return max_size_ > elements_.size(); } 68 bool IsAvailable() const { return max_size_ > elements_.size(); }
69 69
70 const std::unordered_map<const T*, std::unique_ptr<T>>& elements() const {
71 return elements_;
72 }
73
70 private: 74 private:
71 const size_t max_size_; 75 const size_t max_size_;
72 std::unordered_map<const T*, std::unique_ptr<T>> elements_; 76 std::unordered_map<const T*, std::unique_ptr<T>> elements_;
73 77
74 DISALLOW_COPY_AND_ASSIGN(FetcherPool); 78 DISALLOW_COPY_AND_ASSIGN(FetcherPool);
75 }; 79 };
76 80
77 } // namespace precache 81 } // namespace precache
78 82
79 #endif // COMPONENTS_PRECACHE_CORE_FETCHER_POOL_H_ 83 #endif // COMPONENTS_PRECACHE_CORE_FETCHER_POOL_H_
OLDNEW
« no previous file with comments | « components/precache/core/BUILD.gn ('k') | components/precache/core/precache_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698