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

Side by Side Diff: chrome/browser/nacl_host/nacl_process_host.cc

Issue 12662019: Split the ProcessType enum into process types that content knows about (which will remain in src\co… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/nacl_host/nacl_process_host.h" 5 #include "chrome/browser/nacl_host/nacl_process_host.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/process_util.h" 15 #include "base/process_util.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/stringprintf.h" 17 #include "base/stringprintf.h"
18 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
19 #include "base/strings/string_split.h" 19 #include "base/strings/string_split.h"
20 #include "base/utf_string_conversions.h" 20 #include "base/utf_string_conversions.h"
21 #include "base/win/windows_version.h" 21 #include "base/win/windows_version.h"
22 #include "build/build_config.h" 22 #include "build/build_config.h"
23 #include "chrome/browser/browser_process.h" 23 #include "chrome/browser/browser_process.h"
24 #include "chrome/browser/extensions/extension_info_map.h" 24 #include "chrome/browser/extensions/extension_info_map.h"
25 #include "chrome/browser/io_thread.h" 25 #include "chrome/browser/io_thread.h"
26 #include "chrome/browser/nacl_host/nacl_browser.h" 26 #include "chrome/browser/nacl_host/nacl_browser.h"
27 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" 27 #include "chrome/browser/renderer_host/chrome_render_message_filter.h"
28 #include "chrome/common/chrome_constants.h" 28 #include "chrome/common/chrome_constants.h"
29 #include "chrome/common/chrome_paths.h" 29 #include "chrome/common/chrome_paths.h"
30 #include "chrome/common/chrome_process_type.h"
30 #include "chrome/common/chrome_switches.h" 31 #include "chrome/common/chrome_switches.h"
31 #include "chrome/common/chrome_version_info.h" 32 #include "chrome/common/chrome_version_info.h"
32 #include "chrome/common/logging_chrome.h" 33 #include "chrome/common/logging_chrome.h"
33 #include "chrome/common/nacl_cmd_line.h" 34 #include "chrome/common/nacl_cmd_line.h"
34 #include "chrome/common/nacl_messages.h" 35 #include "chrome/common/nacl_messages.h"
35 #include "chrome/common/render_messages.h" 36 #include "chrome/common/render_messages.h"
36 #include "chrome/common/url_constants.h" 37 #include "chrome/common/url_constants.h"
37 #include "content/public/browser/browser_child_process_host.h" 38 #include "content/public/browser/browser_child_process_host.h"
38 #include "content/public/browser/browser_ppapi_host.h" 39 #include "content/public/browser/browser_ppapi_host.h"
39 #include "content/public/browser/child_process_data.h" 40 #include "content/public/browser/child_process_data.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 #endif 196 #endif
196 internal_(new NaClInternal()), 197 internal_(new NaClInternal()),
197 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), 198 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
198 enable_exception_handling_(false), 199 enable_exception_handling_(false),
199 enable_debug_stub_(false), 200 enable_debug_stub_(false),
200 uses_irt_(uses_irt), 201 uses_irt_(uses_irt),
201 off_the_record_(off_the_record), 202 off_the_record_(off_the_record),
202 ALLOW_THIS_IN_INITIALIZER_LIST(ipc_plugin_listener_(this)), 203 ALLOW_THIS_IN_INITIALIZER_LIST(ipc_plugin_listener_(this)),
203 render_view_id_(render_view_id) { 204 render_view_id_(render_view_id) {
204 process_.reset(content::BrowserChildProcessHost::Create( 205 process_.reset(content::BrowserChildProcessHost::Create(
205 content::PROCESS_TYPE_NACL_LOADER, this)); 206 PROCESS_TYPE_NACL_LOADER, this));
206 207
207 // Set the display name so the user knows what plugin the process is running. 208 // Set the display name so the user knows what plugin the process is running.
208 // We aren't on the UI thread so getting the pref locale for language 209 // We aren't on the UI thread so getting the pref locale for language
209 // formatting isn't possible, so IDN will be lost, but this is probably OK 210 // formatting isn't possible, so IDN will be lost, but this is probably OK
210 // for this use case. 211 // for this use case.
211 process_->SetName(net::FormatUrl(manifest_url_, std::string())); 212 process_->SetName(net::FormatUrl(manifest_url_, std::string()));
212 213
213 // We allow untrusted hardware exception handling to be enabled via 214 // We allow untrusted hardware exception handling to be enabled via
214 // an env var for consistency with the standalone build of NaCl. 215 // an env var for consistency with the standalone build of NaCl.
215 if (CommandLine::ForCurrentProcess()->HasSwitch( 216 if (CommandLine::ForCurrentProcess()->HasSwitch(
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 // This method is called when NaClProcessHostMsg_PpapiChannelCreated is 815 // This method is called when NaClProcessHostMsg_PpapiChannelCreated is
815 // received or PpapiHostMsg_ChannelCreated is forwarded by our plugin 816 // received or PpapiHostMsg_ChannelCreated is forwarded by our plugin
816 // listener. 817 // listener.
817 void NaClProcessHost::OnPpapiChannelCreated( 818 void NaClProcessHost::OnPpapiChannelCreated(
818 const IPC::ChannelHandle& channel_handle) { 819 const IPC::ChannelHandle& channel_handle) {
819 // Only renderer processes should create a channel. 820 // Only renderer processes should create a channel.
820 DCHECK(enable_ppapi_proxy()); 821 DCHECK(enable_ppapi_proxy());
821 // If the proxy channel is null, this must be the initial NaCl-Browser IPC 822 // If the proxy channel is null, this must be the initial NaCl-Browser IPC
822 // channel. 823 // channel.
823 if (!ipc_proxy_channel_.get()) { 824 if (!ipc_proxy_channel_.get()) {
824 DCHECK_EQ(content::PROCESS_TYPE_NACL_LOADER, process_->GetData().type); 825 DCHECK_EQ(PROCESS_TYPE_NACL_LOADER, process_->GetData().process_type);
825 826
826 ipc_proxy_channel_.reset( 827 ipc_proxy_channel_.reset(
827 new IPC::ChannelProxy(channel_handle, 828 new IPC::ChannelProxy(channel_handle,
828 IPC::Channel::MODE_CLIENT, 829 IPC::Channel::MODE_CLIENT,
829 &ipc_plugin_listener_, 830 &ipc_plugin_listener_,
830 base::MessageLoopProxy::current())); 831 base::MessageLoopProxy::current()));
831 // Create the browser ppapi host and enable PPAPI message dispatching to the 832 // Create the browser ppapi host and enable PPAPI message dispatching to the
832 // browser process. 833 // browser process.
833 ppapi_host_.reset(content::BrowserPpapiHost::CreateExternalPluginProcess( 834 ppapi_host_.reset(content::BrowserPpapiHost::CreateExternalPluginProcess(
834 ipc_proxy_channel_.get(), // sender 835 ipc_proxy_channel_.get(), // sender
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 } else { 971 } else {
971 NaClStartDebugExceptionHandlerThread( 972 NaClStartDebugExceptionHandlerThread(
972 process_handle.Take(), info, 973 process_handle.Take(), info,
973 base::MessageLoopProxy::current(), 974 base::MessageLoopProxy::current(),
974 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, 975 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker,
975 weak_factory_.GetWeakPtr())); 976 weak_factory_.GetWeakPtr()));
976 return true; 977 return true;
977 } 978 }
978 } 979 }
979 #endif 980 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698