OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_LIFETIME_KEEP_ALIVE_REGISTRY_H_ |
| 6 #define CHROME_BROWSER_LIFETIME_KEEP_ALIVE_REGISTRY_H_ |
| 7 |
| 8 #include <set> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/memory/singleton.h" |
| 12 |
| 13 struct KeepAliveOptions; |
| 14 |
| 15 class KeepAliveRegistry { |
| 16 public: |
| 17 static KeepAliveRegistry* GetInstance(); |
| 18 |
| 19 private: |
| 20 friend struct base::DefaultSingletonTraits<KeepAliveRegistry>; |
| 21 // Friend to be able to use Register/Unregister |
| 22 friend class ScopedKeepAlive; |
| 23 |
| 24 KeepAliveRegistry(); |
| 25 ~KeepAliveRegistry(); |
| 26 |
| 27 // Add/Remove entries. Do not use directly, use ScopedKeepAlive instead. |
| 28 void Register(const KeepAliveOptions* options); |
| 29 void Unregister(const KeepAliveOptions* options); |
| 30 |
| 31 std::multiset<const KeepAliveOptions*> registered_keep_alives_; |
| 32 |
| 33 DISALLOW_COPY_AND_ASSIGN(KeepAliveRegistry); |
| 34 }; |
| 35 |
| 36 #endif // CHROME_BROWSER_LIFETIME_KEEP_ALIVE_REGISTRY_H_ |
OLD | NEW |