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

Unified Diff: chrome/browser/worker_process_host.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/browser/worker_process_host.h ('k') | chrome/browser/worker_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/worker_process_host.cc
===================================================================
--- chrome/browser/worker_process_host.cc (revision 0)
+++ chrome/browser/worker_process_host.cc (revision 0)
@@ -0,0 +1,73 @@
+// Copyright (c) 2009 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 "chrome/browser/worker_process_host.h"
+
+#include <windows.h>
+
+#include "base/command_line.h"
+#include "base/debug_util.h"
+#include "base/logging.h"
+#include "base/path_service.h"
+#include "base/process_util.h"
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/worker_service.h"
+#include "chrome/browser/sandbox_policy.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/common/debug_flags.h"
+#include "chrome/common/process_watcher.h"
+#include "chrome/common/render_messages.h"
+#include "chrome/common/worker_messages.h"
+#include "sandbox/src/sandbox.h"
+
+
+WorkerProcessHost::WorkerProcessHost(MessageLoop* main_message_loop)
+ : ChildProcessHost(WORKER_PROCESS, main_message_loop) {
+}
+
+WorkerProcessHost::~WorkerProcessHost() {
+}
+
+bool WorkerProcessHost::Init() {
+ // TODO(jabdelmalek): figure out what to set as the title.
+ set_name(L"TBD");
+
+ if (!CreateChannel())
+ return false;
+
+ std::wstring exe_path;
+ if (!PathService::Get(base::FILE_EXE, &exe_path))
+ return false;
+
+ CommandLine cmd_line(exe_path);
+
+ // TODO(jabdelmalek): factor out common code from renderer/plugin that does
+ // sandboxing and command line copying and reuse here.
+ cmd_line.AppendSwitchWithValue(switches::kProcessType,
+ switches::kWorkerProcess);
+ cmd_line.AppendSwitchWithValue(switches::kProcessChannelID, channel_id());
+ HANDLE handle;
+ if (!base::LaunchApp(cmd_line, false, false, &handle))
+ return false;
+ SetHandle(handle);
+
+ return true;
+}
+
+void WorkerProcessHost::CreateWorker(const GURL& url, int route_id) {
+ route_ids_.insert(route_id);
+ Send(new WorkerProcessMsg_CreateWorker(url, route_id));
+}
+
+bool WorkerProcessHost::HasRouteId(int id) {
+ return route_ids_.find(id) != route_ids_.end();
+}
+
+void WorkerProcessHost::OnMessageReceived(const IPC::Message& msg) {
+/*
+ IPC_BEGIN_MESSAGE_MAP(WorkerProcessHost, msg)
+ IPC_MESSAGE_UNHANDLED_ERROR()
+ IPC_END_MESSAGE_MAP()
+*/
+}
« no previous file with comments | « chrome/browser/worker_process_host.h ('k') | chrome/browser/worker_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698