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 #ifdef _MSC_VER | 5 #ifdef _MSC_VER |
6 // Do not warn about use of std::copy with raw pointers. | 6 // Do not warn about use of std::copy with raw pointers. |
7 #pragma warning(disable : 4996) | 7 #pragma warning(disable : 4996) |
8 #endif | 8 #endif |
9 | 9 |
10 #include "ppapi/native_client/src/trusted/plugin/plugin.h" | 10 #include "ppapi/native_client/src/trusted/plugin/plugin.h" |
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1201 ReportLoadError(error_info); | 1201 ReportLoadError(error_info); |
1202 return; | 1202 return; |
1203 } | 1203 } |
1204 | 1204 |
1205 if (manifest_->GetProgramURL(&program_url, &pnacl_options, &error_info)) { | 1205 if (manifest_->GetProgramURL(&program_url, &pnacl_options, &error_info)) { |
1206 is_installed_ = GetUrlScheme(program_url) == SCHEME_CHROME_EXTENSION; | 1206 is_installed_ = GetUrlScheme(program_url) == SCHEME_CHROME_EXTENSION; |
1207 set_nacl_ready_state(LOADING); | 1207 set_nacl_ready_state(LOADING); |
1208 // Inform JavaScript that we found a nexe URL to load. | 1208 // Inform JavaScript that we found a nexe URL to load. |
1209 EnqueueProgressEvent(kProgressEventProgress); | 1209 EnqueueProgressEvent(kProgressEventProgress); |
1210 if (pnacl_options.translate()) { | 1210 if (pnacl_options.translate()) { |
1211 if (this->nacl_interface()->IsPnaclEnabled()) { | 1211 CHECK(nacl_interface()->IsPnaclEnabled()); |
1212 // Check whether PNaCl has been crashing "frequently". If so, report | 1212 pp::CompletionCallback translate_callback = |
1213 // a load error. | 1213 callback_factory_.NewCallback(&Plugin::BitcodeDidTranslate); |
1214 pp::CompletionCallback translate_callback = | 1214 // Will always call the callback on success or failure. |
1215 callback_factory_.NewCallback(&Plugin::BitcodeDidTranslate); | 1215 pnacl_coordinator_.reset( |
1216 // Will always call the callback on success or failure. | 1216 PnaclCoordinator::BitcodeToNative(this, |
1217 pnacl_coordinator_.reset( | 1217 program_url, |
1218 PnaclCoordinator::BitcodeToNative(this, | 1218 pnacl_options, |
1219 program_url, | 1219 translate_callback)); |
1220 pnacl_options, | 1220 return; |
1221 translate_callback)); | |
1222 return; | |
1223 } else { | |
1224 error_info.SetReport(ERROR_PNACL_NOT_ENABLED, | |
1225 "PNaCl has not been enabled (e.g., by setting " | |
1226 "the --enable-pnacl flag)."); | |
1227 } | |
1228 } else { | 1221 } else { |
1229 // Try the fast path first. This will only block if the file is installed. | 1222 // Try the fast path first. This will only block if the file is installed. |
1230 if (OpenURLFast(program_url, &nexe_downloader_)) { | 1223 if (OpenURLFast(program_url, &nexe_downloader_)) { |
1231 NexeFileDidOpen(PP_OK); | 1224 NexeFileDidOpen(PP_OK); |
1232 } else { | 1225 } else { |
1233 pp::CompletionCallback open_callback = | 1226 pp::CompletionCallback open_callback = |
1234 callback_factory_.NewCallback(&Plugin::NexeFileDidOpen); | 1227 callback_factory_.NewCallback(&Plugin::NexeFileDidOpen); |
1235 // Will always call the callback on success or failure. | 1228 // Will always call the callback on success or failure. |
1236 CHECK( | 1229 CHECK( |
1237 nexe_downloader_.Open(program_url, | 1230 nexe_downloader_.Open(program_url, |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1689 static_cast<uint32_t>(text.size())); | 1682 static_cast<uint32_t>(text.size())); |
1690 const PPB_Console* console_interface = | 1683 const PPB_Console* console_interface = |
1691 static_cast<const PPB_Console*>( | 1684 static_cast<const PPB_Console*>( |
1692 module->GetBrowserInterface(PPB_CONSOLE_INTERFACE)); | 1685 module->GetBrowserInterface(PPB_CONSOLE_INTERFACE)); |
1693 console_interface->LogWithSource(pp_instance(), PP_LOGLEVEL_LOG, prefix, str); | 1686 console_interface->LogWithSource(pp_instance(), PP_LOGLEVEL_LOG, prefix, str); |
1694 var_interface->Release(prefix); | 1687 var_interface->Release(prefix); |
1695 var_interface->Release(str); | 1688 var_interface->Release(str); |
1696 } | 1689 } |
1697 | 1690 |
1698 } // namespace plugin | 1691 } // namespace plugin |
OLD | NEW |