Disable UserAddingScreenTest.AddingSeveralUsers, very flaky.
[chromium-blink-merge.git] / content / child / scoped_child_process_reference.cc
blobf7d35fb2842763947ce3778aa9bb14554fa6b84c
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 #include "content/child/scoped_child_process_reference.h"
7 #include "base/bind.h"
8 #include "base/time/time.h"
9 #include "content/child/child_process.h"
11 namespace content {
13 ScopedChildProcessReference::ScopedChildProcessReference()
14 : has_reference_(true) {
15 ChildProcess::current()->AddRefProcess();
18 ScopedChildProcessReference::~ScopedChildProcessReference() {
19 if (has_reference_)
20 ChildProcess::current()->ReleaseProcess();
23 void ScopedChildProcessReference::ReleaseWithDelay(
24 const base::TimeDelta& delay) {
25 DCHECK(has_reference_);
26 base::MessageLoop::current()->PostDelayedTask(
27 FROM_HERE,
28 base::Bind(&ChildProcess::ReleaseProcess,
29 base::Unretained(ChildProcess::current())),
30 delay);
31 has_reference_ = false;
34 } // namespace content