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 #include <string> | |
10 | |
11 #include "base/macros.h" | |
12 #include "base/memory/singleton.h" | |
13 | |
14 class KeepAliveRegistry { | |
15 public: | |
16 static KeepAliveRegistry* GetInstance(); | |
17 | |
18 void RegisterToken(const std::string& token); | |
19 void UnregisterToken(const std::string& token); | |
20 | |
21 private: | |
22 friend struct base::DefaultSingletonTraits<KeepAliveRegistry>; | |
23 | |
24 KeepAliveRegistry(); | |
25 virtual ~KeepAliveRegistry(); | |
sky
2016/02/19 21:02:49
Why the virtual?
dgn
2016/02/22 18:01:20
No subclass involved here, so removed it.
| |
26 | |
27 std::multiset<std::string> registered_tokens_; | |
sky
2016/02/19 21:02:49
Is there a reason why you aren't using a map<strin
dgn
2016/02/22 18:01:20
With the int being the number of registered tokens
sky
2016/02/24 18:53:21
Couldn't you just as well use two map<enum,int> an
dgn
2016/02/24 19:55:45
I think we had different assumptions. I started wo
dgn
2016/02/24 21:04:18
Done.
| |
28 | |
29 DISALLOW_COPY_AND_ASSIGN(KeepAliveRegistry); | |
30 }; | |
31 | |
32 #endif // CHROME_BROWSER_LIFETIME_KEEP_ALIVE_REGISTRY_H_ | |
OLD | NEW |