Chromium Code Reviews| Index: chrome/browser/lifetime/keep_alive_registry.h |
| diff --git a/chrome/browser/lifetime/keep_alive_registry.h b/chrome/browser/lifetime/keep_alive_registry.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b521bbb39c3cbf726be7808da2317cfe2ce6243e |
| --- /dev/null |
| +++ b/chrome/browser/lifetime/keep_alive_registry.h |
| @@ -0,0 +1,32 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_LIFETIME_KEEP_ALIVE_REGISTRY_H_ |
| +#define CHROME_BROWSER_LIFETIME_KEEP_ALIVE_REGISTRY_H_ |
| + |
| +#include <set> |
| +#include <string> |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/singleton.h" |
| + |
| +class KeepAliveRegistry { |
| + public: |
| + static KeepAliveRegistry* GetInstance(); |
| + |
| + void RegisterToken(const std::string& token); |
| + void UnregisterToken(const std::string& token); |
| + |
| + private: |
| + friend struct base::DefaultSingletonTraits<KeepAliveRegistry>; |
| + |
| + KeepAliveRegistry(); |
| + 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.
|
| + |
| + 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.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(KeepAliveRegistry); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_LIFETIME_KEEP_ALIVE_REGISTRY_H_ |