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 "components/nacl/browser/nacl_process_host.h" | 5 #include "components/nacl/browser/nacl_process_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "content/public/common/process_type.h" | 42 #include "content/public/common/process_type.h" |
43 #include "ipc/ipc_channel.h" | 43 #include "ipc/ipc_channel.h" |
44 #include "ipc/ipc_switches.h" | 44 #include "ipc/ipc_switches.h" |
45 #include "native_client/src/shared/imc/nacl_imc_c.h" | 45 #include "native_client/src/shared/imc/nacl_imc_c.h" |
46 #include "net/base/net_util.h" | 46 #include "net/base/net_util.h" |
47 #include "net/socket/tcp_listen_socket.h" | 47 #include "net/socket/tcp_listen_socket.h" |
48 #include "ppapi/host/host_factory.h" | 48 #include "ppapi/host/host_factory.h" |
49 #include "ppapi/host/ppapi_host.h" | 49 #include "ppapi/host/ppapi_host.h" |
50 #include "ppapi/proxy/ppapi_messages.h" | 50 #include "ppapi/proxy/ppapi_messages.h" |
51 #include "ppapi/shared_impl/ppapi_nacl_channel_args.h" | 51 #include "ppapi/shared_impl/ppapi_nacl_channel_args.h" |
| 52 #include "ppapi/shared_impl/ppapi_switches.h" |
52 | 53 |
53 #if defined(OS_POSIX) | 54 #if defined(OS_POSIX) |
54 #include <fcntl.h> | 55 #include <fcntl.h> |
55 | 56 |
56 #include "ipc/ipc_channel_posix.h" | 57 #include "ipc/ipc_channel_posix.h" |
57 #elif defined(OS_WIN) | 58 #elif defined(OS_WIN) |
58 #include <windows.h> | 59 #include <windows.h> |
59 | 60 |
60 #include "base/threading/thread.h" | 61 #include "base/threading/thread.h" |
61 #include "base/win/scoped_handle.h" | 62 #include "base/win/scoped_handle.h" |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 // Create the browser ppapi host and enable PPAPI message dispatching to the | 793 // Create the browser ppapi host and enable PPAPI message dispatching to the |
793 // browser process. | 794 // browser process. |
794 ppapi_host_.reset(content::BrowserPpapiHost::CreateExternalPluginProcess( | 795 ppapi_host_.reset(content::BrowserPpapiHost::CreateExternalPluginProcess( |
795 ipc_proxy_channel_.get(), // sender | 796 ipc_proxy_channel_.get(), // sender |
796 permissions_, | 797 permissions_, |
797 process_->GetData().handle, | 798 process_->GetData().handle, |
798 ipc_proxy_channel_.get(), | 799 ipc_proxy_channel_.get(), |
799 nacl_host_message_filter_->render_process_id(), | 800 nacl_host_message_filter_->render_process_id(), |
800 render_view_id_, | 801 render_view_id_, |
801 profile_directory_)); | 802 profile_directory_)); |
| 803 ppapi_host_->SetOnKeepaliveCallback( |
| 804 NaClBrowser::GetDelegate()->GetOnKeepaliveCallback()); |
802 | 805 |
803 ppapi::PpapiNaClChannelArgs args; | 806 ppapi::PpapiNaClChannelArgs args; |
804 args.off_the_record = nacl_host_message_filter_->off_the_record(); | 807 args.off_the_record = nacl_host_message_filter_->off_the_record(); |
805 args.permissions = permissions_; | 808 args.permissions = permissions_; |
806 args.supports_dev_channel = | 809 args.supports_dev_channel = |
807 content::PluginService::GetInstance()->PpapiDevChannelSupported(); | 810 content::PluginService::GetInstance()->PpapiDevChannelSupported(); |
808 CommandLine* cmdline = CommandLine::ForCurrentProcess(); | 811 CommandLine* cmdline = CommandLine::ForCurrentProcess(); |
809 DCHECK(cmdline); | 812 DCHECK(cmdline); |
810 std::string flag_whitelist[] = {switches::kV, switches::kVModule}; | 813 std::string flag_whitelist[] = { |
| 814 switches::kPpapiKeepAliveThrottle, |
| 815 switches::kV, |
| 816 switches::kVModule, |
| 817 }; |
811 for (size_t i = 0; i < arraysize(flag_whitelist); ++i) { | 818 for (size_t i = 0; i < arraysize(flag_whitelist); ++i) { |
812 std::string value = cmdline->GetSwitchValueASCII(flag_whitelist[i]); | 819 std::string value = cmdline->GetSwitchValueASCII(flag_whitelist[i]); |
813 if (!value.empty()) { | 820 if (!value.empty()) { |
814 args.switch_names.push_back(flag_whitelist[i]); | 821 args.switch_names.push_back(flag_whitelist[i]); |
815 args.switch_values.push_back(value); | 822 args.switch_values.push_back(value); |
816 } | 823 } |
817 } | 824 } |
818 | 825 |
819 ppapi_host_->GetPpapiHost()->AddHostFactoryFilter( | 826 ppapi_host_->GetPpapiHost()->AddHostFactoryFilter( |
820 scoped_ptr<ppapi::host::HostFactory>( | 827 scoped_ptr<ppapi::host::HostFactory>( |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 process_handle.Take(), info, | 1025 process_handle.Take(), info, |
1019 base::MessageLoopProxy::current(), | 1026 base::MessageLoopProxy::current(), |
1020 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 1027 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
1021 weak_factory_.GetWeakPtr())); | 1028 weak_factory_.GetWeakPtr())); |
1022 return true; | 1029 return true; |
1023 } | 1030 } |
1024 } | 1031 } |
1025 #endif | 1032 #endif |
1026 | 1033 |
1027 } // namespace nacl | 1034 } // namespace nacl |
OLD | NEW |