[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / mojo / shell / keep_alive.h
blobd9b61275ca8ecf6e19bd61626845dfcb056648aa
1 // Copyright 2014 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.
5 #ifndef MOJO_SHELL_KEEP_ALIVE_H_
6 #define MOJO_SHELL_KEEP_ALIVE_H_
8 #include "base/basictypes.h"
10 namespace mojo {
11 namespace shell {
13 class Context;
14 class KeepAlive;
16 class KeepAliveCounter {
17 public:
18 KeepAliveCounter() : count_(0) {
20 private:
21 friend class KeepAlive;
22 int count_;
25 // Instantiate this class to extend the lifetime of the thread associated
26 // with |context| (i.e., the shell's UI thread). Must only be used from
27 // the shell's UI thread.
28 class KeepAlive {
29 public:
30 explicit KeepAlive(Context* context);
31 ~KeepAlive();
33 private:
34 static void MaybeQuit(Context* context);
36 Context* context_;
38 DISALLOW_COPY_AND_ASSIGN(KeepAlive);
41 } // namespace shell
42 } // namespace mojo
44 #endif // MOJO_SHELL_KEEP_ALIVE_H_