diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-14 16:21:05 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-14 16:21:05 +0000 |
commit | 6e07d8b7d3b054975a2e717a5d0a6e60bc0c9444 (patch) | |
tree | cf8cb65ab8ffa28c7165b1e9400f9918bdb4c712 /content/worker/webworker_stub_base.cc | |
parent | 5558fffd6a542a5eb0260ff4866ed9388438704b (diff) | |
download | chromium_src-6e07d8b7d3b054975a2e717a5d0a6e60bc0c9444.zip chromium_src-6e07d8b7d3b054975a2e717a5d0a6e60bc0c9444.tar.gz chromium_src-6e07d8b7d3b054975a2e717a5d0a6e60bc0c9444.tar.bz2 |
Move worker code from chrome\worker to content\worker.
TBR=atwilson
Review URL: http://codereview.chromium.org/6691004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78039 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/worker/webworker_stub_base.cc')
-rw-r--r-- | content/worker/webworker_stub_base.cc | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/content/worker/webworker_stub_base.cc b/content/worker/webworker_stub_base.cc new file mode 100644 index 0000000..c5232a3 --- /dev/null +++ b/content/worker/webworker_stub_base.cc @@ -0,0 +1,40 @@ +// Copyright (c) 2011 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. + +#include "content/worker/webworker_stub_base.h" + +#include "base/compiler_specific.h" +#include "content/common/child_process.h" +#include "content/worker/worker_thread.h" + +WebWorkerStubBase::WebWorkerStubBase( + int route_id, const WorkerAppCacheInitInfo& appcache_init_info) + : route_id_(route_id), + appcache_init_info_(appcache_init_info), + ALLOW_THIS_IN_INITIALIZER_LIST(client_(route_id, this)) { + + WorkerThread* workerThread = WorkerThread::current(); + DCHECK(workerThread); + workerThread->AddWorkerStub(this); + // Start processing incoming IPCs for this worker. + workerThread->AddRoute(route_id_, this); + ChildProcess::current()->AddRefProcess(); +} + +WebWorkerStubBase::~WebWorkerStubBase() { + WorkerThread* workerThread = WorkerThread::current(); + DCHECK(workerThread); + workerThread->RemoveWorkerStub(this); + workerThread->RemoveRoute(route_id_); + ChildProcess::current()->ReleaseProcess(); +} + +void WebWorkerStubBase::Shutdown() { + // The worker has exited - free ourselves and the client. + delete this; +} + +void WebWorkerStubBase::EnsureWorkerContextTerminates() { + client_.EnsureWorkerContextTerminates(); +} |