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

Unified Diff: chrome/browser/worker_host/worker_process_host.h

Issue 27157: Initial checkin of the out of process worker implementation.... (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
Index: chrome/browser/worker_host/worker_process_host.h
===================================================================
--- chrome/browser/worker_host/worker_process_host.h (revision 0)
+++ chrome/browser/worker_host/worker_process_host.h (revision 0)
@@ -0,0 +1,56 @@
+// 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.
+
+#ifndef CHROME_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_
+#define CHROME_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_
+
+#include <list>
+
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+#include "chrome/common/child_process_host.h"
+#include "chrome/common/ipc_channel.h"
+#include "googleurl/src/gurl.h"
+
+class ResourceMessageFilter;
+
+class WorkerProcessHost : public ChildProcessHost {
+ public:
+ WorkerProcessHost(MessageLoop* main_message_loop);
+ ~WorkerProcessHost();
+
+ // Starts the process. Returns true iff it succeeded.
+ bool Init();
+
+ // Creates a worker object in the process.
+ void CreateWorker(const GURL& url,
+ int worker_route_id,
+ int renderer_route_id,
+ ResourceMessageFilter* filter);
+
+ // Returns true iff the given message from a renderer process was forwarded to
+ // the worker.
+ bool FilterMessage(const IPC::Message& message);
+
+ void RendererShutdown(ResourceMessageFilter* filter);
+
+ private:
+ // Called when a message arrives from the worker process.
+ void OnMessageReceived(const IPC::Message& message);
+
+ // Contains information about each worker instance, needed to forward messages
+ // between the renderer and worker processes.
+ struct WorkerInstance {
+ int worker_route_id;
+ int renderer_route_id;
+ ResourceMessageFilter* filter;
+ };
+
+ typedef std::list<WorkerInstance> Instances;
+ Instances instances_;
+
+ DISALLOW_COPY_AND_ASSIGN(WorkerProcessHost);
+};
+
+#endif // CHROME_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_
« no previous file with comments | « chrome/browser/renderer_host/resource_message_filter.cc ('k') | chrome/browser/worker_host/worker_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698