| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 } | 137 } |
| 138 | 138 |
| 139 bool NaClProcessHost::PluginListener::OnMessageReceived( | 139 bool NaClProcessHost::PluginListener::OnMessageReceived( |
| 140 const IPC::Message& msg) { | 140 const IPC::Message& msg) { |
| 141 return host_->OnUntrustedMessageForwarded(msg); | 141 return host_->OnUntrustedMessageForwarded(msg); |
| 142 } | 142 } |
| 143 | 143 |
| 144 NaClProcessHost::NaClProcessHost(const GURL& manifest_url, | 144 NaClProcessHost::NaClProcessHost(const GURL& manifest_url, |
| 145 int render_view_id, | 145 int render_view_id, |
| 146 uint32 permission_bits, | 146 uint32 permission_bits, |
| 147 bool off_the_record) | 147 bool off_the_record, |
| 148 bool uses_irt) |
| 148 : manifest_url_(manifest_url), | 149 : manifest_url_(manifest_url), |
| 149 permissions_(GetNaClPermissions(permission_bits)), | 150 permissions_(GetNaClPermissions(permission_bits)), |
| 150 #if defined(OS_WIN) | 151 #if defined(OS_WIN) |
| 151 process_launched_by_broker_(false), | 152 process_launched_by_broker_(false), |
| 152 #elif defined(OS_LINUX) | 153 #elif defined(OS_LINUX) |
| 153 wait_for_nacl_gdb_(false), | 154 wait_for_nacl_gdb_(false), |
| 154 #endif | 155 #endif |
| 155 reply_msg_(NULL), | 156 reply_msg_(NULL), |
| 156 #if defined(OS_WIN) | 157 #if defined(OS_WIN) |
| 157 debug_exception_handler_requested_(false), | 158 debug_exception_handler_requested_(false), |
| 158 #endif | 159 #endif |
| 159 internal_(new NaClInternal()), | 160 internal_(new NaClInternal()), |
| 160 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), | 161 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), |
| 161 enable_exception_handling_(false), | 162 enable_exception_handling_(false), |
| 162 enable_debug_stub_(false), | 163 enable_debug_stub_(false), |
| 163 off_the_record_(off_the_record), | 164 off_the_record_(off_the_record), |
| 164 enable_ipc_proxy_(false), | 165 enable_ipc_proxy_(false), |
| 166 uses_irt_(uses_irt), |
| 165 ALLOW_THIS_IN_INITIALIZER_LIST(ipc_plugin_listener_(this)), | 167 ALLOW_THIS_IN_INITIALIZER_LIST(ipc_plugin_listener_(this)), |
| 166 render_view_id_(render_view_id) { | 168 render_view_id_(render_view_id) { |
| 167 process_.reset(content::BrowserChildProcessHost::Create( | 169 process_.reset(content::BrowserChildProcessHost::Create( |
| 168 content::PROCESS_TYPE_NACL_LOADER, this)); | 170 content::PROCESS_TYPE_NACL_LOADER, this)); |
| 169 | 171 |
| 170 // Set the display name so the user knows what plugin the process is running. | 172 // Set the display name so the user knows what plugin the process is running. |
| 171 // We aren't on the UI thread so getting the pref locale for language | 173 // We aren't on the UI thread so getting the pref locale for language |
| 172 // formatting isn't possible, so IDN will be lost, but this is probably OK | 174 // formatting isn't possible, so IDN will be lost, but this is probably OK |
| 173 // for this use case. | 175 // for this use case. |
| 174 process_->SetName(net::FormatUrl(manifest_url_, std::string())); | 176 process_->SetName(net::FormatUrl(manifest_url_, std::string())); |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); | 707 NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); |
| 706 | 708 |
| 707 nacl::NaClStartParams params; | 709 nacl::NaClStartParams params; |
| 708 params.validation_cache_enabled = nacl_browser->ValidationCacheIsEnabled(); | 710 params.validation_cache_enabled = nacl_browser->ValidationCacheIsEnabled(); |
| 709 params.validation_cache_key = nacl_browser->GetValidationCacheKey(); | 711 params.validation_cache_key = nacl_browser->GetValidationCacheKey(); |
| 710 params.version = chrome::VersionInfo().CreateVersionString(); | 712 params.version = chrome::VersionInfo().CreateVersionString(); |
| 711 params.enable_exception_handling = enable_exception_handling_; | 713 params.enable_exception_handling = enable_exception_handling_; |
| 712 params.enable_debug_stub = enable_debug_stub_ && | 714 params.enable_debug_stub = enable_debug_stub_ && |
| 713 NaClBrowser::GetInstance()->URLMatchesDebugPatterns(manifest_url_); | 715 NaClBrowser::GetInstance()->URLMatchesDebugPatterns(manifest_url_); |
| 714 params.enable_ipc_proxy = enable_ipc_proxy_; | 716 params.enable_ipc_proxy = enable_ipc_proxy_; |
| 717 params.uses_irt = uses_irt_; |
| 715 | 718 |
| 716 base::PlatformFile irt_file = nacl_browser->IrtFile(); | 719 base::PlatformFile irt_file = nacl_browser->IrtFile(); |
| 717 CHECK_NE(irt_file, base::kInvalidPlatformFileValue); | 720 CHECK_NE(irt_file, base::kInvalidPlatformFileValue); |
| 718 | 721 |
| 719 const ChildProcessData& data = process_->GetData(); | 722 const ChildProcessData& data = process_->GetData(); |
| 720 for (size_t i = 0; i < internal_->sockets_for_sel_ldr.size(); i++) { | 723 for (size_t i = 0; i < internal_->sockets_for_sel_ldr.size(); i++) { |
| 721 if (!ShareHandleToSelLdr(data.handle, | 724 if (!ShareHandleToSelLdr(data.handle, |
| 722 internal_->sockets_for_sel_ldr[i], true, | 725 internal_->sockets_for_sel_ldr[i], true, |
| 723 ¶ms.handles)) { | 726 ¶ms.handles)) { |
| 724 return false; | 727 return false; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 } else { | 932 } else { |
| 930 NaClStartDebugExceptionHandlerThread( | 933 NaClStartDebugExceptionHandlerThread( |
| 931 process_handle.Take(), info, | 934 process_handle.Take(), info, |
| 932 base::MessageLoopProxy::current(), | 935 base::MessageLoopProxy::current(), |
| 933 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 936 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
| 934 weak_factory_.GetWeakPtr())); | 937 weak_factory_.GetWeakPtr())); |
| 935 return true; | 938 return true; |
| 936 } | 939 } |
| 937 } | 940 } |
| 938 #endif | 941 #endif |
| OLD | NEW |