Bug 1277705 - Remove some child_process code (r=dvander)

This commit is contained in:
Bill McCloskey 2016-06-01 20:38:34 -07:00
Родитель 0a5b384f55
Коммит f70e677000
2 изменённых файлов: 1 добавлений и 39 удалений

Просмотреть файл

@ -13,9 +13,7 @@
ChildProcess* ChildProcess::child_process_;
ChildProcess::ChildProcess(ChildThread* child_thread)
: child_thread_(child_thread),
ref_count_(0),
shutdown_event_(true, false) {
: child_thread_(child_thread) {
DCHECK(!child_process_);
child_process_ = this;
if (child_thread_.get()) // null in unittests.
@ -25,32 +23,8 @@ ChildProcess::ChildProcess(ChildThread* child_thread)
ChildProcess::~ChildProcess() {
DCHECK(child_process_ == this);
// Signal this event before destroying the child process. That way all
// background threads can cleanup.
// For example, in the renderer the RenderThread instances will be able to
// notice shutdown before the render process begins waiting for them to exit.
shutdown_event_.Signal();
if (child_thread_.get())
child_thread_->Stop();
child_process_ = NULL;
}
void ChildProcess::AddRefProcess() {
DCHECK(!child_thread_.get() || // null in unittests.
MessageLoop::current() == child_thread_->message_loop());
ref_count_++;
}
void ChildProcess::ReleaseProcess() {
DCHECK(!child_thread_.get() || // null in unittests.
MessageLoop::current() == child_thread_->message_loop());
DCHECK(ref_count_);
DCHECK(child_process_);
if (--ref_count_)
return;
if (child_thread_.get()) // null in unittests.
child_thread_->OnProcessFinalRelease();
}

Просмотреть файл

@ -29,13 +29,6 @@ class ChildProcess {
// Getter for this process' main thread.
ChildThread* child_thread() { return child_thread_.get(); }
// These are used for ref-counting the child process. The process shuts
// itself down when the ref count reaches 0.
// For example, in the renderer process, generally each tab managed by this
// process will hold a reference to the process, and release when closed.
void AddRefProcess();
void ReleaseProcess();
// Getter for the one ChildProcess object for this process.
static ChildProcess* current() { return child_process_; }
@ -44,11 +37,6 @@ class ChildProcess {
// it depends on it (indirectly through IPC::SyncChannel).
mozilla::UniquePtr<ChildThread> child_thread_;
int ref_count_;
// An event that will be signalled when we shutdown.
base::WaitableEvent shutdown_event_;
// The singleton instance for this process.
static ChildProcess* child_process_;