Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
4 : // Use of this source code is governed by a BSD-style license that can be
5 : // found in the LICENSE file.
6 :
7 : #include "chrome/common/child_process.h"
8 :
9 : #include "base/basictypes.h"
10 : #include "base/string_util.h"
11 : #include "chrome/common/child_thread.h"
12 :
13 : ChildProcess* ChildProcess::child_process_;
14 :
15 2 : ChildProcess::ChildProcess(ChildThread* child_thread)
16 2 : : child_thread_(child_thread) {
17 2 : DCHECK(!child_process_);
18 2 : child_process_ = this;
19 2 : if (child_thread_.get()) // null in unittests.
20 2 : child_thread_->Run();
21 2 : }
22 :
23 0 : ChildProcess::~ChildProcess() {
24 0 : DCHECK(child_process_ == this);
25 :
26 0 : if (child_thread_.get())
27 0 : child_thread_->Stop();
28 :
29 0 : child_process_ = NULL;
30 0 : }
|