| Index: chrome/browser/lifetime/browser_keep_alive.h
|
| diff --git a/chrome/browser/lifetime/browser_keep_alive.h b/chrome/browser/lifetime/browser_keep_alive.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..73047f4362141da069e05375450d64d1da80bee2
|
| --- /dev/null
|
| +++ b/chrome/browser/lifetime/browser_keep_alive.h
|
| @@ -0,0 +1,45 @@
|
| +// Copyright 2015 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_BROWSER_KEEP_ALIVE_H_
|
| +#define CHROME_BROWSER_LIFETIME_BROWSER_KEEP_ALIVE_H_
|
| +
|
| +#include "base/macros.h"
|
| +
|
| +namespace browser_lifetime {
|
| +
|
| +// A class that can be put in a scoped_ptr to represent a "keep alive" resource.
|
| +// Prefer this over IncrementKeepAliveCount() / DecrementKeepAliveCount()
|
| +// whenever possible.
|
| +class ScopedKeepAlive {
|
| + public:
|
| + ScopedKeepAlive();
|
| + ~ScopedKeepAlive();
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(ScopedKeepAlive);
|
| +};
|
| +
|
| +// Tells the BrowserList to keep the application alive after the last Browser
|
| +// closes. This is implemented as a count, so callers should pair their calls
|
| +// to IncrementKeepAliveCount() with matching calls to DecrementKeepAliveCount()
|
| +// when they no
|
| +// longer need to keep the application running.
|
| +void IncrementKeepAliveCount();
|
| +
|
| +// Stops keeping the application alive after the last Browser is closed.
|
| +// Should match a previous call to IncrementKeepAliveCount().
|
| +void DecrementKeepAliveCount();
|
| +
|
| +// Returns true if application will continue running after the last Browser
|
| +// closes.
|
| +bool WillKeepAlive();
|
| +
|
| +// Disable browser shutdown for unit tests.
|
| +void DisableShutdownForTesting(bool disable_shutdown_for_testing);
|
| +
|
| +} // namespace browser_lifetime
|
| +
|
| +#endif // CHROME_BROWSER_LIFETIME_BROWSER_KEEP_ALIVE_H_
|
| +
|
|
|