OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 BASE_REVOCABLE_STORE_H__ | 5 #ifndef BASE_REVOCABLE_STORE_H_ |
6 #define BASE_REVOCABLE_STORE_H__ | 6 #define BASE_REVOCABLE_STORE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | |
9 #include "base/logging.h" | |
10 #include "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
11 | 9 |
12 // |RevocableStore| is a container of items that can be removed from the store. | 10 // |RevocableStore| is a container of items that can be removed from the store. |
13 class RevocableStore { | 11 class RevocableStore { |
14 public: | 12 public: |
15 // A |StoreRef| is used to link the |RevocableStore| to its items. There is | 13 // A |StoreRef| is used to link the |RevocableStore| to its items. There is |
16 // one StoreRef per store, and each item holds a reference to it. If the | 14 // one StoreRef per store, and each item holds a reference to it. If the |
17 // store wishes to revoke its items, it sets |store_| to null. Items are | 15 // store wishes to revoke its items, it sets |store_| to null. Items are |
18 // permitted to release their reference to the |StoreRef| when they no longer | 16 // permitted to release their reference to the |StoreRef| when they no longer |
19 // require the store. | 17 // require the store. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 64 |
67 // This is the reference the unrevoked items in the store hold. | 65 // This is the reference the unrevoked items in the store hold. |
68 scoped_refptr<StoreRef> owning_reference_; | 66 scoped_refptr<StoreRef> owning_reference_; |
69 | 67 |
70 // The number of unrevoked items in the store. | 68 // The number of unrevoked items in the store. |
71 int count_; | 69 int count_; |
72 | 70 |
73 DISALLOW_EVIL_CONSTRUCTORS(RevocableStore); | 71 DISALLOW_EVIL_CONSTRUCTORS(RevocableStore); |
74 }; | 72 }; |
75 | 73 |
76 #endif // BASE_REVOCABLE_STORE_H__ | 74 #endif // BASE_REVOCABLE_STORE_H_ |
77 | |
OLD | NEW |