| 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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 | 776 |
| 776 // This method is called when NaClProcessHostMsg_PpapiChannelCreated is | 777 // This method is called when NaClProcessHostMsg_PpapiChannelCreated is |
| 777 // received or PpapiHostMsg_ChannelCreated is forwarded by our plugin | 778 // received or PpapiHostMsg_ChannelCreated is forwarded by our plugin |
| 778 // listener. | 779 // listener. |
| 779 void NaClProcessHost::OnPpapiChannelCreated( | 780 void NaClProcessHost::OnPpapiChannelCreated( |
| 780 const IPC::ChannelHandle& channel_handle) { | 781 const IPC::ChannelHandle& channel_handle) { |
| 781 DCHECK(enable_ipc_proxy_); | 782 DCHECK(enable_ipc_proxy_); |
| 782 // If the proxy channel is null, this must be the initial NaCl-Browser IPC | 783 // If the proxy channel is null, this must be the initial NaCl-Browser IPC |
| 783 // channel. | 784 // channel. |
| 784 if (!ipc_proxy_channel_.get()) { | 785 if (!ipc_proxy_channel_.get()) { |
| 786 DCHECK_EQ(content::PROCESS_TYPE_NACL_LOADER, process_->GetData().type); |
| 787 |
| 785 ipc_proxy_channel_.reset( | 788 ipc_proxy_channel_.reset( |
| 786 new IPC::ChannelProxy(channel_handle, | 789 new IPC::ChannelProxy(channel_handle, |
| 787 IPC::Channel::MODE_CLIENT, | 790 IPC::Channel::MODE_CLIENT, |
| 788 &ipc_plugin_listener_, | 791 &ipc_plugin_listener_, |
| 789 base::MessageLoopProxy::current())); | 792 base::MessageLoopProxy::current())); |
| 790 // 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 |
| 791 // browser process. | 794 // browser process. |
| 792 ppapi_host_.reset(content::BrowserPpapiHost::CreateExternalPluginProcess( | 795 ppapi_host_.reset(content::BrowserPpapiHost::CreateExternalPluginProcess( |
| 793 ipc_proxy_channel_.get(), //process_.get(), // sender | 796 ipc_proxy_channel_.get(), // sender |
| 794 permissions_, | 797 permissions_, |
| 795 process_->GetData().handle, | 798 process_->GetData().handle, |
| 796 ipc_proxy_channel_.get(), | 799 ipc_proxy_channel_.get(), |
| 797 chrome_render_message_filter_->GetHostResolver(), | 800 chrome_render_message_filter_->GetHostResolver(), |
| 798 chrome_render_message_filter_->render_process_id(), | 801 chrome_render_message_filter_->render_process_id(), |
| 799 render_view_id_)); | 802 render_view_id_)); |
| 800 | 803 |
| 801 // Send a message to create the NaCl-Renderer channel. The handle is just | 804 // Send a message to create the NaCl-Renderer channel. The handle is just |
| 802 // a place holder. | 805 // a place holder. |
| 803 ipc_proxy_channel_->Send( | 806 ipc_proxy_channel_->Send( |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 } else { | 930 } else { |
| 928 NaClStartDebugExceptionHandlerThread( | 931 NaClStartDebugExceptionHandlerThread( |
| 929 process_handle.Take(), info, | 932 process_handle.Take(), info, |
| 930 base::MessageLoopProxy::current(), | 933 base::MessageLoopProxy::current(), |
| 931 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 934 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
| 932 weak_factory_.GetWeakPtr())); | 935 weak_factory_.GetWeakPtr())); |
| 933 return true; | 936 return true; |
| 934 } | 937 } |
| 935 } | 938 } |
| 936 #endif | 939 #endif |
| OLD | NEW |