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

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

Issue 9150017: Add a Content API around BrowserChildProcessHost, similar to what was done with ChildProcessHost.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix?! Created 8 years, 11 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 | « content/browser/utility_process_host.cc ('k') | content/browser/worker_host/worker_process_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/worker_host/worker_process_host.h
===================================================================
--- content/browser/worker_host/worker_process_host.h (revision 118420)
+++ content/browser/worker_host/worker_process_host.h (working copy)
@@ -11,11 +11,16 @@
#include "base/basictypes.h"
#include "base/file_path.h"
-#include "content/browser/browser_child_process_host.h"
+#include "base/memory/scoped_ptr.h"
#include "content/common/content_export.h"
#include "content/browser/worker_host/worker_document_set.h"
+#include "content/public/browser/browser_child_process_host_delegate.h"
+#include "content/public/browser/browser_child_process_host_iterator.h"
#include "googleurl/src/gurl.h"
+#include "ipc/ipc_message.h"
+class BrowserChildProcessHost;
+
namespace content {
class ResourceContext;
class WorkerServiceImpl;
@@ -27,7 +32,8 @@
// process, but that may change. However, we do assume (by storing a
// net::URLRequestContext) that a WorkerProcessHost serves a single
// BrowserContext.
-class WorkerProcessHost : public BrowserChildProcessHost {
+class WorkerProcessHost : public content::BrowserChildProcessHostDelegate,
+ public IPC::Message::Sender {
public:
// Contains information about each worker instance, needed to forward messages
// between the renderer and worker processes.
@@ -110,6 +116,9 @@
explicit WorkerProcessHost(const content::ResourceContext* resource_context);
virtual ~WorkerProcessHost();
+ // IPC::Message::Sender implementation:
+ virtual bool Send(IPC::Message* message) OVERRIDE;
+
// Starts the process. Returns true iff it succeeded.
// |render_process_id| is the renderer process responsible for starting this
// worker.
@@ -132,6 +141,8 @@
// Terminates the given worker, i.e. based on a UI action.
CONTENT_EXPORT void TerminateWorker(int worker_route_id);
+ CONTENT_EXPORT const content::ChildProcessData& GetData();
+
typedef std::list<WorkerInstance> Instances;
const Instances& instances() const { return instances_; }
@@ -145,16 +156,13 @@
Instances& mutable_instances() { return instances_; }
private:
- // Called when the process has been launched successfully.
+ // BrowserChildProcessHostDelegate implementation:
virtual void OnProcessLaunched() OVERRIDE;
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
// Creates and adds the message filters.
void CreateMessageFilters(int render_process_id);
- // IPC::Channel::Listener implementation:
- // Called when a message arrives from the worker process.
- virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
-
void OnWorkerContextClosed(int worker_route_id);
void OnAllowDatabase(int worker_route_id,
const GURL& url,
@@ -186,7 +194,18 @@
// process.
scoped_refptr<WorkerMessageFilter> worker_message_filter_;
+ scoped_ptr<BrowserChildProcessHost> process_;
+
DISALLOW_COPY_AND_ASSIGN(WorkerProcessHost);
};
+class WorkerProcessHostIterator
+ : public content::BrowserChildProcessHostTypeIterator<WorkerProcessHost> {
+ public:
+ WorkerProcessHostIterator()
+ : content::BrowserChildProcessHostTypeIterator<WorkerProcessHost>(
+ content::PROCESS_TYPE_WORKER) {
+ }
+};
+
#endif // CONTENT_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_
« no previous file with comments | « content/browser/utility_process_host.cc ('k') | content/browser/worker_host/worker_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698