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