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..c6f5cce24c51d9cb45d7b024492d98fbfc5b1095 |
--- /dev/null |
+++ b/chrome/browser/lifetime/keep_alive_registry.h |
@@ -0,0 +1,39 @@ |
+// 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" |
+ |
+enum class OptimizationOptions { |
+ NONE = 0, |
+ RESTART_ALLOWED, |
+ OPTIMIZATION_OPTIONS_LAST = RESTART_ALLOWED |
+}; |
+ |
+class KeepAliveRegistry { |
Bernhard Bauer
2016/02/19 17:39:28
You might be able to move this whole class into an
dgn
2016/02/19 18:04:28
Can I do that at the end of the migration? I'm not
Bernhard Bauer
2016/02/22 18:19:38
Okay… Could you make the Register/Unregister metho
dgn
2016/02/22 19:07:19
Done.
|
+ public: |
+ static KeepAliveRegistry* GetInstance(); |
+ |
+ void RegisterToken(const std::string& token, OptimizationOptions opt); |
+ void UnregisterToken(const std::string& token, OptimizationOptions opt); |
+ |
+ private: |
+ friend struct base::DefaultSingletonTraits<KeepAliveRegistry>; |
+ |
+ KeepAliveRegistry(); |
+ virtual ~KeepAliveRegistry(); |
+ |
+ std::multiset<std::string> registered_tokens_; |
+ std::multiset<std::string> reset_allowed_tokens_; |
Bernhard Bauer
2016/02/19 17:39:28
|restart_allowed_tokens_|?
dgn
2016/02/19 18:04:28
oops forgot to fix that. Done.
|
+ |
+ DISALLOW_COPY_AND_ASSIGN(KeepAliveRegistry); |
+}; |
+ |
+#endif // CHROME_BROWSER_LIFETIME_KEEP_ALIVE_REGISTRY_H_ |