Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9494)

Unified Diff: chrome/worker/worker_process.cc

Issue 20413: old1 (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/worker/worker_process.h ('k') | chrome/worker/worker_thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
+}
« no previous file with comments | « chrome/worker/worker_process.h ('k') | chrome/worker/worker_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698