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/bind.h" | 10 #include "base/bind.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "chrome/common/chrome_version_info.h" | 31 #include "chrome/common/chrome_version_info.h" |
32 #include "chrome/common/logging_chrome.h" | 32 #include "chrome/common/logging_chrome.h" |
33 #include "chrome/common/nacl_cmd_line.h" | 33 #include "chrome/common/nacl_cmd_line.h" |
34 #include "chrome/common/nacl_messages.h" | 34 #include "chrome/common/nacl_messages.h" |
35 #include "chrome/common/render_messages.h" | 35 #include "chrome/common/render_messages.h" |
36 #include "chrome/common/url_constants.h" | 36 #include "chrome/common/url_constants.h" |
37 #include "content/public/browser/browser_child_process_host.h" | 37 #include "content/public/browser/browser_child_process_host.h" |
38 #include "content/public/browser/browser_ppapi_host.h" | 38 #include "content/public/browser/browser_ppapi_host.h" |
39 #include "content/public/browser/child_process_data.h" | 39 #include "content/public/browser/child_process_data.h" |
40 #include "content/public/common/child_process_host.h" | 40 #include "content/public/common/child_process_host.h" |
| 41 #include "content/public/common/process_type.h" |
41 #include "extensions/common/constants.h" | 42 #include "extensions/common/constants.h" |
42 #include "extensions/common/url_pattern.h" | 43 #include "extensions/common/url_pattern.h" |
43 #include "ipc/ipc_channel.h" | 44 #include "ipc/ipc_channel.h" |
44 #include "ipc/ipc_switches.h" | 45 #include "ipc/ipc_switches.h" |
45 #include "native_client/src/shared/imc/nacl_imc.h" | 46 #include "native_client/src/shared/imc/nacl_imc.h" |
46 #include "net/base/net_util.h" | 47 #include "net/base/net_util.h" |
47 #include "net/base/tcp_listen_socket.h" | 48 #include "net/base/tcp_listen_socket.h" |
48 #include "ppapi/proxy/ppapi_messages.h" | 49 #include "ppapi/proxy/ppapi_messages.h" |
49 | 50 |
50 #if defined(OS_POSIX) | 51 #if defined(OS_POSIX) |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 // This method is called when NaClProcessHostMsg_PpapiChannelCreated is | 783 // This method is called when NaClProcessHostMsg_PpapiChannelCreated is |
783 // received or PpapiHostMsg_ChannelCreated is forwarded by our plugin | 784 // received or PpapiHostMsg_ChannelCreated is forwarded by our plugin |
784 // listener. | 785 // listener. |
785 void NaClProcessHost::OnPpapiChannelCreated( | 786 void NaClProcessHost::OnPpapiChannelCreated( |
786 const IPC::ChannelHandle& channel_handle) { | 787 const IPC::ChannelHandle& channel_handle) { |
787 // Only renderer processes should create a channel. | 788 // Only renderer processes should create a channel. |
788 DCHECK(enable_ppapi_proxy()); | 789 DCHECK(enable_ppapi_proxy()); |
789 // If the proxy channel is null, this must be the initial NaCl-Browser IPC | 790 // If the proxy channel is null, this must be the initial NaCl-Browser IPC |
790 // channel. | 791 // channel. |
791 if (!ipc_proxy_channel_.get()) { | 792 if (!ipc_proxy_channel_.get()) { |
| 793 DCHECK_EQ(content::PROCESS_TYPE_NACL_LOADER, process_->GetData().type); |
| 794 |
792 ipc_proxy_channel_.reset( | 795 ipc_proxy_channel_.reset( |
793 new IPC::ChannelProxy(channel_handle, | 796 new IPC::ChannelProxy(channel_handle, |
794 IPC::Channel::MODE_CLIENT, | 797 IPC::Channel::MODE_CLIENT, |
795 &ipc_plugin_listener_, | 798 &ipc_plugin_listener_, |
796 base::MessageLoopProxy::current())); | 799 base::MessageLoopProxy::current())); |
797 // Create the browser ppapi host and enable PPAPI message dispatching to the | 800 // Create the browser ppapi host and enable PPAPI message dispatching to the |
798 // browser process. | 801 // browser process. |
799 ppapi_host_.reset(content::BrowserPpapiHost::CreateExternalPluginProcess( | 802 ppapi_host_.reset(content::BrowserPpapiHost::CreateExternalPluginProcess( |
800 ipc_proxy_channel_.get(), //process_.get(), // sender | 803 ipc_proxy_channel_.get(), // sender |
801 permissions_, | 804 permissions_, |
802 process_->GetData().handle, | 805 process_->GetData().handle, |
803 ipc_proxy_channel_.get(), | 806 ipc_proxy_channel_.get(), |
804 chrome_render_message_filter_->GetHostResolver(), | 807 chrome_render_message_filter_->GetHostResolver(), |
805 chrome_render_message_filter_->render_process_id(), | 808 chrome_render_message_filter_->render_process_id(), |
806 render_view_id_)); | 809 render_view_id_)); |
807 | 810 |
808 // Send a message to create the NaCl-Renderer channel. The handle is just | 811 // Send a message to create the NaCl-Renderer channel. The handle is just |
809 // a place holder. | 812 // a place holder. |
810 ipc_proxy_channel_->Send( | 813 ipc_proxy_channel_->Send( |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 } else { | 939 } else { |
937 NaClStartDebugExceptionHandlerThread( | 940 NaClStartDebugExceptionHandlerThread( |
938 process_handle.Take(), info, | 941 process_handle.Take(), info, |
939 base::MessageLoopProxy::current(), | 942 base::MessageLoopProxy::current(), |
940 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 943 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
941 weak_factory_.GetWeakPtr())); | 944 weak_factory_.GetWeakPtr())); |
942 return true; | 945 return true; |
943 } | 946 } |
944 } | 947 } |
945 #endif | 948 #endif |
OLD | NEW |