| Index: chrome/worker/worker_process.cc
|
| ===================================================================
|
| --- chrome/worker/worker_process.cc (revision 0)
|
| +++ chrome/worker/worker_process.cc (revision 0)
|
| @@ -0,0 +1,49 @@
|
| +// Copyright (c) 2006-2008 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 <windows.h>
|
| +#include "chrome/worker/worker_process.h"
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "base/scoped_handle.h"
|
| +#include "chrome/common/ipc_channel.h"
|
| +#include "chrome/common/ipc_message_utils.h"
|
| +#include "chrome/common/worker_messages.h"
|
| +
|
| +// Custom factory to allow us to pass additional ctor arguments.
|
| +class WorkerProcessFactory : public ChildProcessFactoryInterface {
|
| + public:
|
| + explicit WorkerProcessFactory() {}
|
| +
|
| + virtual ChildProcess* Create(const std::wstring& channel_name) {
|
| + return new WorkerProcess(channel_name);
|
| + }
|
| +};
|
| +
|
| +
|
| +// No AddRef required when using WorkerProcess with RunnableMethod. This is
|
| +// okay since the lifetime of the WorkerProcess is always greater than the
|
| +// lifetime of WorkerThread because it's a member variable.
|
| +template <> struct RunnableMethodTraits<WorkerProcess> {
|
| + static void RetainCallee(WorkerProcess*) {}
|
| + static void ReleaseCallee(WorkerProcess*) {}
|
| +};
|
| +
|
| +WorkerProcess::WorkerProcess(const std::wstring& channel_name) :
|
| +#pragma warning(suppress: 4355) // Okay to pass "this" here.
|
| + worker_thread_(this, channel_name) {
|
| +}
|
| +
|
| +WorkerProcess::~WorkerProcess() {
|
| +}
|
| +
|
| +bool WorkerProcess::GlobalInit(const std::wstring &channel_name) {
|
| + WorkerProcessFactory factory;
|
| + return ChildProcess::GlobalInit(channel_name, &factory);
|
| +}
|
| +
|
| +
|
| +// Note: may be called on any thread
|
| +void WorkerProcess::OnFinalRelease() {
|
| +}
|
|
|