Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Side by Side Diff: chrome/browser/lifetime/keep_alive_registry.h

Issue 1708343002: Add ScopedKeepAlive to c/b/lifetime (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698