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

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

Issue 1708343002: Add ScopedKeepAlive to c/b/lifetime (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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_SCOPED_KEEP_ALIVE_H_
6 #define CHROME_BROWSER_LIFETIME_SCOPED_KEEP_ALIVE_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11 #include "chrome/browser/lifetime/keep_alive_registry.h"
12
13 // Registers tokens with KeepAliveRegistry on creation and unregisters them
14 // on destruction.
15 //
16 // These tokens should be descriptive of what the KeepAlive's
17 // lifetime is tied to, to help with debugging.
18 //
19 // TODO(dgn)
20 // When registering a token, indictations of which kind of optimizations would
21 // be allowed during the KeepAlive's lifetime should be provided. This allows
22 // to take some liberties with the state of the browser to optimize the resource
23 // consumption.
24 //
25 // Use these objects with a scoped_ptr for easy management of the tokens.
26 class ScopedKeepAlive {
27 public:
28 explicit ScopedKeepAlive(const std::string& token);
29 ~ScopedKeepAlive();
30
31 private:
32 std::string token_;
sky 2016/02/19 21:02:49 const
dgn 2016/02/22 18:01:20 Done.
33
34 DISALLOW_COPY_AND_ASSIGN(ScopedKeepAlive);
35 };
36
37 #endif // CHROME_BROWSER_LIFETIME_SCOPED_KEEP_ALIVE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698