Chromium Code Reviews| 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 v_flag = cmdline->GetSwitchValueASCII(switches::kV); | |
|
dmichael (off chromium)
2013/04/10 23:10:22
Is it worth doing:
std::string flagWhitelist[] = [
| |
| 851 if (!v_flag.empty()) { | |
| 852 args.switch_names.push_back(switches::kV); | |
| 853 args.switch_values.push_back(v_flag); | |
| 854 } | |
| 855 std::string vmodule_flag = cmdline->GetSwitchValueASCII(switches::kVModule); | |
| 856 if (!vmodule_flag.empty()) { | |
| 857 args.switch_names.push_back(switches::kVModule); | |
| 858 args.switch_values.push_back(vmodule_flag); | |
| 859 } | |
| 860 | |
| 843 // Send a message to create the NaCl-Renderer channel. The handle is just | 861 // Send a message to create the NaCl-Renderer channel. The handle is just |
| 844 // a place holder. | 862 // a place holder. |
| 845 ipc_proxy_channel_->Send( | 863 ipc_proxy_channel_->Send( |
| 846 new PpapiMsg_CreateNaClChannel( | 864 new PpapiMsg_CreateNaClChannel( |
| 847 chrome_render_message_filter_->render_process_id(), | 865 chrome_render_message_filter_->render_process_id(), |
| 848 permissions_, | 866 args, |
| 849 chrome_render_message_filter_->off_the_record(), | |
| 850 SerializedHandle(SerializedHandle::CHANNEL_HANDLE, | 867 SerializedHandle(SerializedHandle::CHANNEL_HANDLE, |
| 851 IPC::InvalidPlatformFileForTransit()))); | 868 IPC::InvalidPlatformFileForTransit()))); |
| 852 } else if (reply_msg_) { | 869 } else if (reply_msg_) { |
| 853 // Otherwise, this must be a renderer channel. | 870 // Otherwise, this must be a renderer channel. |
| 854 ReplyToRenderer(channel_handle); | 871 ReplyToRenderer(channel_handle); |
| 855 } else { | 872 } else { |
| 856 // Attempt to open more than 1 renderer channel is not supported. | 873 // Attempt to open more than 1 renderer channel is not supported. |
| 857 // Shut down the NaCl process. | 874 // Shut down the NaCl process. |
| 858 process_->GetHost()->ForceShutdown(); | 875 process_->GetHost()->ForceShutdown(); |
| 859 } | 876 } |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 971 } else { | 988 } else { |
| 972 NaClStartDebugExceptionHandlerThread( | 989 NaClStartDebugExceptionHandlerThread( |
| 973 process_handle.Take(), info, | 990 process_handle.Take(), info, |
| 974 base::MessageLoopProxy::current(), | 991 base::MessageLoopProxy::current(), |
| 975 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 992 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
| 976 weak_factory_.GetWeakPtr())); | 993 weak_factory_.GetWeakPtr())); |
| 977 return true; | 994 return true; |
| 978 } | 995 } |
| 979 } | 996 } |
| 980 #endif | 997 #endif |
| OLD | NEW |