Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / child / scoped_child_process_reference.h
blob3f9ba6cbb6fa915438f28786aaf6be0c523630f1
1 // Copyright 2013 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 CONTENT_CHILD_SCOPED_CHILD_PROCESS_REFERENCE_H_
6 #define CONTENT_CHILD_SCOPED_CHILD_PROCESS_REFERENCE_H_
8 #include "base/basictypes.h"
10 namespace base {
11 class TimeDelta;
14 namespace content {
16 // Scoper class that automatically adds a reference to the current child
17 // process in constructor and releases the reference on scope out.
18 // Consumers of this class can call ReleaseWithDelay() to explicitly release
19 // the reference with a certain delay.
20 class ScopedChildProcessReference {
21 public:
22 ScopedChildProcessReference();
23 ~ScopedChildProcessReference();
25 // Releases the process reference after |delay|. Once this is called
26 // scoping out has no effect.
27 // It is not valid to call this more than once.
28 void ReleaseWithDelay(const base::TimeDelta& delay);
30 private:
31 bool has_reference_;
32 DISALLOW_COPY_AND_ASSIGN(ScopedChildProcessReference);
35 } // namespace content
37 #endif // CONTENT_CHILD_SCOPED_CHILD_PROCESS_REFERENCE_H_