OLD | NEW |
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/base_switches.h" |
10 #include "base/bind.h" | 11 #include "base/bind.h" |
11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
12 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
13 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
14 #include "base/path_service.h" | 15 #include "base/path_service.h" |
15 #include "base/process_util.h" | 16 #include "base/process_util.h" |
16 #include "base/string_util.h" | 17 #include "base/string_util.h" |
17 #include "base/stringprintf.h" | 18 #include "base/stringprintf.h" |
18 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
19 #include "base/strings/string_split.h" | 20 #include "base/strings/string_split.h" |
(...skipping 21 matching lines...) Expand all Loading... |
41 #include "content/public/common/child_process_host.h" | 42 #include "content/public/common/child_process_host.h" |
42 #include "content/public/common/process_type.h" | 43 #include "content/public/common/process_type.h" |
43 #include "extensions/common/constants.h" | 44 #include "extensions/common/constants.h" |
44 #include "extensions/common/url_pattern.h" | 45 #include "extensions/common/url_pattern.h" |
45 #include "ipc/ipc_channel.h" | 46 #include "ipc/ipc_channel.h" |
46 #include "ipc/ipc_switches.h" | 47 #include "ipc/ipc_switches.h" |
47 #include "native_client/src/shared/imc/nacl_imc_c.h" | 48 #include "native_client/src/shared/imc/nacl_imc_c.h" |
48 #include "net/base/net_util.h" | 49 #include "net/base/net_util.h" |
49 #include "net/base/tcp_listen_socket.h" | 50 #include "net/base/tcp_listen_socket.h" |
50 #include "ppapi/proxy/ppapi_messages.h" | 51 #include "ppapi/proxy/ppapi_messages.h" |
| 52 #include "ppapi/shared_impl/ppapi_nacl_channel_args.h" |
51 | 53 |
52 #if defined(OS_POSIX) | 54 #if defined(OS_POSIX) |
53 #include <fcntl.h> | 55 #include <fcntl.h> |
54 | 56 |
55 #include "ipc/ipc_channel_posix.h" | 57 #include "ipc/ipc_channel_posix.h" |
56 #elif defined(OS_WIN) | 58 #elif defined(OS_WIN) |
57 #include <windows.h> | 59 #include <windows.h> |
58 | 60 |
59 #include "base/process_util.h" | 61 #include "base/process_util.h" |
60 #include "base/threading/thread.h" | 62 #include "base/threading/thread.h" |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 // browser process. | 835 // browser process. |
834 ppapi_host_.reset(content::BrowserPpapiHost::CreateExternalPluginProcess( | 836 ppapi_host_.reset(content::BrowserPpapiHost::CreateExternalPluginProcess( |
835 ipc_proxy_channel_.get(), // sender | 837 ipc_proxy_channel_.get(), // sender |
836 permissions_, | 838 permissions_, |
837 process_->GetData().handle, | 839 process_->GetData().handle, |
838 ipc_proxy_channel_.get(), | 840 ipc_proxy_channel_.get(), |
839 chrome_render_message_filter_->GetHostResolver(), | 841 chrome_render_message_filter_->GetHostResolver(), |
840 chrome_render_message_filter_->render_process_id(), | 842 chrome_render_message_filter_->render_process_id(), |
841 render_view_id_)); | 843 render_view_id_)); |
842 | 844 |
| 845 ppapi::PpapiNaClChannelArgs args; |
| 846 args.off_the_record = chrome_render_message_filter_->off_the_record(); |
| 847 args.permissions = permissions_; |
| 848 CommandLine* cmdline = CommandLine::ForCurrentProcess(); |
| 849 DCHECK(cmdline); |
| 850 std::string flag_whitelist[] = {switches::kV, switches::kVModule}; |
| 851 for (size_t i = 0; i < arraysize(flag_whitelist); ++i) { |
| 852 std::string value = cmdline->GetSwitchValueASCII(flag_whitelist[i]); |
| 853 if (!value.empty()) { |
| 854 args.switch_names.push_back(flag_whitelist[i]); |
| 855 args.switch_values.push_back(value); |
| 856 } |
| 857 } |
| 858 |
843 // Send a message to create the NaCl-Renderer channel. The handle is just | 859 // Send a message to create the NaCl-Renderer channel. The handle is just |
844 // a place holder. | 860 // a place holder. |
845 ipc_proxy_channel_->Send( | 861 ipc_proxy_channel_->Send( |
846 new PpapiMsg_CreateNaClChannel( | 862 new PpapiMsg_CreateNaClChannel( |
847 chrome_render_message_filter_->render_process_id(), | 863 chrome_render_message_filter_->render_process_id(), |
848 permissions_, | 864 args, |
849 chrome_render_message_filter_->off_the_record(), | |
850 SerializedHandle(SerializedHandle::CHANNEL_HANDLE, | 865 SerializedHandle(SerializedHandle::CHANNEL_HANDLE, |
851 IPC::InvalidPlatformFileForTransit()))); | 866 IPC::InvalidPlatformFileForTransit()))); |
852 } else if (reply_msg_) { | 867 } else if (reply_msg_) { |
853 // Otherwise, this must be a renderer channel. | 868 // Otherwise, this must be a renderer channel. |
854 ReplyToRenderer(channel_handle); | 869 ReplyToRenderer(channel_handle); |
855 } else { | 870 } else { |
856 // Attempt to open more than 1 renderer channel is not supported. | 871 // Attempt to open more than 1 renderer channel is not supported. |
857 // Shut down the NaCl process. | 872 // Shut down the NaCl process. |
858 process_->GetHost()->ForceShutdown(); | 873 process_->GetHost()->ForceShutdown(); |
859 } | 874 } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 } else { | 986 } else { |
972 NaClStartDebugExceptionHandlerThread( | 987 NaClStartDebugExceptionHandlerThread( |
973 process_handle.Take(), info, | 988 process_handle.Take(), info, |
974 base::MessageLoopProxy::current(), | 989 base::MessageLoopProxy::current(), |
975 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 990 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
976 weak_factory_.GetWeakPtr())); | 991 weak_factory_.GetWeakPtr())); |
977 return true; | 992 return true; |
978 } | 993 } |
979 } | 994 } |
980 #endif | 995 #endif |
OLD | NEW |