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

Side by Side Diff: content/browser/worker_host/worker_process_host.cc

Issue 8787004: Make ChildProcessHost be used through an interface in content/public, instead of by inheritence. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/utility_process_host.cc ('k') | content/common/child_process_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/worker_host/worker_process_host.h" 5 #include "content/browser/worker_host/worker_process_host.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base_switches.h" 10 #include "base/base_switches.h"
(...skipping 13 matching lines...) Expand all
24 #include "content/browser/renderer_host/database_message_filter.h" 24 #include "content/browser/renderer_host/database_message_filter.h"
25 #include "content/browser/renderer_host/file_utilities_message_filter.h" 25 #include "content/browser/renderer_host/file_utilities_message_filter.h"
26 #include "content/browser/renderer_host/render_view_host.h" 26 #include "content/browser/renderer_host/render_view_host.h"
27 #include "content/browser/renderer_host/render_view_host_delegate.h" 27 #include "content/browser/renderer_host/render_view_host_delegate.h"
28 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" 28 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h"
29 #include "content/browser/resource_context.h" 29 #include "content/browser/resource_context.h"
30 #include "content/browser/user_metrics.h" 30 #include "content/browser/user_metrics.h"
31 #include "content/browser/worker_host/message_port_service.h" 31 #include "content/browser/worker_host/message_port_service.h"
32 #include "content/browser/worker_host/worker_message_filter.h" 32 #include "content/browser/worker_host/worker_message_filter.h"
33 #include "content/browser/worker_host/worker_service.h" 33 #include "content/browser/worker_host/worker_service.h"
34 #include "content/common/child_process_host.h" 34 #include "content/common/child_process_host_impl.h"
35 #include "content/common/debug_flags.h" 35 #include "content/common/debug_flags.h"
36 #include "content/common/view_messages.h" 36 #include "content/common/view_messages.h"
37 #include "content/common/worker_messages.h" 37 #include "content/common/worker_messages.h"
38 #include "content/public/browser/browser_thread.h" 38 #include "content/public/browser/browser_thread.h"
39 #include "content/public/browser/content_browser_client.h" 39 #include "content/public/browser/content_browser_client.h"
40 #include "content/public/common/content_switches.h" 40 #include "content/public/common/content_switches.h"
41 #include "content/public/common/result_codes.h" 41 #include "content/public/common/result_codes.h"
42 #include "ipc/ipc_switches.h" 42 #include "ipc/ipc_switches.h"
43 #include "net/base/mime_util.h" 43 #include "net/base/mime_util.h"
44 #include "net/base/registry_controlled_domain.h" 44 #include "net/base/registry_controlled_domain.h"
45 #include "ui/base/ui_base_switches.h" 45 #include "ui/base/ui_base_switches.h"
46 #include "webkit/fileapi/file_system_context.h" 46 #include "webkit/fileapi/file_system_context.h"
47 #include "webkit/fileapi/file_system_path_manager.h" 47 #include "webkit/fileapi/file_system_path_manager.h"
48 #include "webkit/fileapi/sandbox_mount_point_provider.h" 48 #include "webkit/fileapi/sandbox_mount_point_provider.h"
49 #include "webkit/glue/resource_type.h" 49 #include "webkit/glue/resource_type.h"
50 50
51 using content::BrowserThread; 51 using content::BrowserThread;
52 using content::ChildProcessHost;
52 53
53 namespace { 54 namespace {
54 55
55 // Helper class that we pass to SocketStreamDispatcherHost so that it can find 56 // Helper class that we pass to SocketStreamDispatcherHost so that it can find
56 // the right net::URLRequestContext for a request. 57 // the right net::URLRequestContext for a request.
57 class URLRequestContextSelector 58 class URLRequestContextSelector
58 : public ResourceMessageFilter::URLRequestContextSelector { 59 : public ResourceMessageFilter::URLRequestContextSelector {
59 public: 60 public:
60 explicit URLRequestContextSelector( 61 explicit URLRequestContextSelector(
61 net::URLRequestContext* url_request_context) 62 net::URLRequestContext* url_request_context)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 parent_iter->render_view_id())); 106 parent_iter->render_view_id()));
106 } 107 }
107 WorkerService::GetInstance()->NotifyWorkerDestroyed(this, 108 WorkerService::GetInstance()->NotifyWorkerDestroyed(this,
108 i->worker_route_id()); 109 i->worker_route_id());
109 } 110 }
110 111
111 ChildProcessSecurityPolicy::GetInstance()->Remove(id()); 112 ChildProcessSecurityPolicy::GetInstance()->Remove(id());
112 } 113 }
113 114
114 bool WorkerProcessHost::Init(int render_process_id) { 115 bool WorkerProcessHost::Init(int render_process_id) {
115 if (!child_process_host()->CreateChannel()) 116 std::string channel_id = child_process_host()->CreateChannel();
117 if (channel_id.empty())
116 return false; 118 return false;
117 119
118 #if defined(OS_LINUX) 120 #if defined(OS_LINUX)
119 int flags = ChildProcessHost::CHILD_ALLOW_SELF; 121 int flags = ChildProcessHost::CHILD_ALLOW_SELF;
120 #else 122 #else
121 int flags = ChildProcessHost::CHILD_NORMAL; 123 int flags = ChildProcessHost::CHILD_NORMAL;
122 #endif 124 #endif
123 125
124 FilePath exe_path = ChildProcessHost::GetChildPath(flags); 126 FilePath exe_path = ChildProcessHost::GetChildPath(flags);
125 if (exe_path.empty()) 127 if (exe_path.empty())
126 return false; 128 return false;
127 129
128 CommandLine* cmd_line = new CommandLine(exe_path); 130 CommandLine* cmd_line = new CommandLine(exe_path);
129 cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kWorkerProcess); 131 cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kWorkerProcess);
130 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, 132 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id);
131 child_process_host()->channel_id());
132 std::string locale = 133 std::string locale =
133 content::GetContentClient()->browser()->GetApplicationLocale(); 134 content::GetContentClient()->browser()->GetApplicationLocale();
134 cmd_line->AppendSwitchASCII(switches::kLang, locale); 135 cmd_line->AppendSwitchASCII(switches::kLang, locale);
135 136
136 static const char* const kSwitchNames[] = { 137 static const char* const kSwitchNames[] = {
137 switches::kWebWorkerShareProcesses, 138 switches::kWebWorkerShareProcesses,
138 switches::kDisableApplicationCache, 139 switches::kDisableApplicationCache,
139 switches::kDisableDatabases, 140 switches::kDisableDatabases,
140 switches::kEnableLogging, 141 switches::kEnableLogging,
141 switches::kLoggingLevel, 142 switches::kLoggingLevel,
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 } 627 }
627 } 628 }
628 return false; 629 return false;
629 } 630 }
630 631
631 WorkerProcessHost::WorkerInstance::FilterInfo 632 WorkerProcessHost::WorkerInstance::FilterInfo
632 WorkerProcessHost::WorkerInstance::GetFilter() const { 633 WorkerProcessHost::WorkerInstance::GetFilter() const {
633 DCHECK(NumFilters() == 1); 634 DCHECK(NumFilters() == 1);
634 return *filters_.begin(); 635 return *filters_.begin();
635 } 636 }
OLDNEW
« no previous file with comments | « content/browser/utility_process_host.cc ('k') | content/common/child_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698