Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: ppapi/native_client/src/trusted/plugin/plugin.cc

Issue 7741036: NaCl PPAPI Proxy: wrap up with crash detection. Clean-up handling code to skip remote shutdown ca... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #ifdef _MSC_VER 7 #ifdef _MSC_VER
8 // Do not warn about use of std::copy with raw pointers. 8 // Do not warn about use of std::copy with raw pointers.
9 #pragma warning(disable : 4996) 9 #pragma warning(disable : 4996)
10 #endif 10 #endif
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 465
466 static int const kAbiHeaderBuffer = 256; // must be at least EI_ABIVERSION + 1 466 static int const kAbiHeaderBuffer = 256; // must be at least EI_ABIVERSION + 1
467 467
468 void Plugin::LoadMethods() { 468 void Plugin::LoadMethods() {
469 PLUGIN_PRINTF(("Plugin::LoadMethods ()\n")); 469 PLUGIN_PRINTF(("Plugin::LoadMethods ()\n"));
470 // Properties implemented by Plugin. 470 // Properties implemented by Plugin.
471 AddPropertyGet(GetReadyStateProperty, "readyState", "i"); 471 AddPropertyGet(GetReadyStateProperty, "readyState", "i");
472 } 472 }
473 473
474 bool Plugin::HasMethod(uintptr_t method_id, CallType call_type) { 474 bool Plugin::HasMethod(uintptr_t method_id, CallType call_type) {
475 PLUGIN_PRINTF(("Plugin::HasMethod (method_id=%x) = ", 475 PLUGIN_PRINTF(("Plugin::HasMethod (method_id=%x)\n",
476 static_cast<int>(method_id))); 476 static_cast<int>(method_id)));
477 if (GetMethodInfo(method_id, call_type)) { 477 if (GetMethodInfo(method_id, call_type)) {
478 PLUGIN_PRINTF(("true\n")); 478 PLUGIN_PRINTF(("true\n"));
479 return true; 479 return true;
480 } 480 }
481 if (!ExperimentalJavaScriptApisAreEnabled()) { 481 if (!ExperimentalJavaScriptApisAreEnabled()) {
482 PLUGIN_PRINTF(("false\n")); 482 PLUGIN_PRINTF(("false\n"));
483 return false; 483 return false;
484 } 484 }
485 if (call_type != METHOD_CALL) { 485 if (call_type != METHOD_CALL) {
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 is_valid_proxy)); 1298 is_valid_proxy));
1299 if (!is_valid_proxy) { 1299 if (!is_valid_proxy) {
1300 error_info->SetReport(ERROR_START_PROXY_CRASH, 1300 error_info->SetReport(ERROR_START_PROXY_CRASH,
1301 "instance crashed after creation."); 1301 "instance crashed after creation.");
1302 } 1302 }
1303 return is_valid_proxy; 1303 return is_valid_proxy;
1304 } 1304 }
1305 1305
1306 void Plugin::ReportDeadNexe() { 1306 void Plugin::ReportDeadNexe() {
1307 PLUGIN_PRINTF(("Plugin::ReportDeadNexe\n")); 1307 PLUGIN_PRINTF(("Plugin::ReportDeadNexe\n"));
1308 if (ppapi_proxy_ != NULL)
1309 ppapi_proxy_->ReportDeadNexe();
1308 1310
1309 if (nacl_ready_state() == DONE) { // After loadEnd. 1311 if (nacl_ready_state() == DONE) { // After loadEnd.
1310 int64_t crash_time = NaClGetTimeOfDayMicroseconds(); 1312 int64_t crash_time = NaClGetTimeOfDayMicroseconds();
1311 // Crashes will be more likely near startup, so use a medium histogram 1313 // Crashes will be more likely near startup, so use a medium histogram
1312 // instead of a large one. 1314 // instead of a large one.
1313 HistogramTimeMedium( 1315 HistogramTimeMedium(
1314 "NaCl.ModuleUptime.Crash", 1316 "NaCl.ModuleUptime.Crash",
1315 (crash_time - ready_time_) / NACL_MICROS_PER_MILLI); 1317 (crash_time - ready_time_) / NACL_MICROS_PER_MILLI);
1316 1318
1317 EnqueueProgressEvent("crash", 1319 EnqueueProgressEvent("crash",
1318 LENGTH_IS_NOT_COMPUTABLE, 1320 LENGTH_IS_NOT_COMPUTABLE,
1319 kUnknownBytes, 1321 kUnknownBytes,
1320 kUnknownBytes); 1322 kUnknownBytes);
1321 CHECK(ppapi_proxy_ != NULL && !ppapi_proxy_->is_valid()); 1323 CHECK(ppapi_proxy_ != NULL && !ppapi_proxy_->is_valid());
1322 ShutdownProxy(); 1324 ShutdownProxy();
1323 } 1325 }
1324 // else LoadNaClModule and NexeFileDidOpen will provide error handling. 1326 // else ReportLoadError() and ReportAbortError() will be used by loading code
1327 // to provide error handling and proxy shutdown.
1328 //
1325 // NOTE: not all crashes during load will make it here. 1329 // NOTE: not all crashes during load will make it here.
1326 // Those in BrowserPpp::InitializeModule and creation of PPP interfaces 1330 // Those in BrowserPpp::InitializeModule and creation of PPP interfaces
1327 // will just get reported back as PP_ERROR_FAILED. 1331 // will just get reported back as PP_ERROR_FAILED.
1328 } 1332 }
1329 1333
1330 void Plugin::ShutdownProxy() { 1334 void Plugin::ShutdownProxy() {
1331 PLUGIN_PRINTF(("Plugin::ShutdownProxy (ppapi_proxy=%p)\n", 1335 PLUGIN_PRINTF(("Plugin::ShutdownProxy (ppapi_proxy=%p)\n",
1332 static_cast<void*>(ppapi_proxy_))); 1336 static_cast<void*>(ppapi_proxy_)));
1333 // We do not call remote PPP_Instance::DidDestroy because the untrusted 1337 // We do not call remote PPP_Instance::DidDestroy because the untrusted
1334 // side can no longer take full advantage of mostly asynchronous Pepper 1338 // side can no longer take full advantage of mostly asynchronous Pepper
1335 // per-Instance interfaces at this point. 1339 // per-Instance interfaces at this point.
1336 if (BrowserPpp::is_valid(ppapi_proxy_)) 1340 if (ppapi_proxy_ != NULL) {
1337 ppapi_proxy_->ShutdownModule(); 1341 ppapi_proxy_->ShutdownModule();
1338 delete ppapi_proxy_; 1342 delete ppapi_proxy_;
1339 ppapi_proxy_ = NULL; 1343 ppapi_proxy_ = NULL;
1344 }
1340 } 1345 }
1341 1346
1342 void Plugin::NaClManifestBufferReady(int32_t pp_error) { 1347 void Plugin::NaClManifestBufferReady(int32_t pp_error) {
1343 PLUGIN_PRINTF(("Plugin::NaClManifestBufferReady (pp_error=%" 1348 PLUGIN_PRINTF(("Plugin::NaClManifestBufferReady (pp_error=%"
1344 NACL_PRId32")\n", pp_error)); 1349 NACL_PRId32")\n", pp_error));
1345 ErrorInfo error_info; 1350 ErrorInfo error_info;
1346 set_manifest_url(nexe_downloader_.url()); 1351 set_manifest_url(nexe_downloader_.url());
1347 if (pp_error != PP_OK) { 1352 if (pp_error != PP_OK) {
1348 if (pp_error == PP_ERROR_ABORTED) { 1353 if (pp_error == PP_ERROR_ABORTED) {
1349 ReportLoadAbort(); 1354 ReportLoadAbort();
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1860 std::string scheme = canonicalized.AsString().substr(comps.scheme.begin, 1865 std::string scheme = canonicalized.AsString().substr(comps.scheme.begin,
1861 comps.scheme.len); 1866 comps.scheme.len);
1862 if (scheme == kChromeExtensionUriScheme) 1867 if (scheme == kChromeExtensionUriScheme)
1863 return SCHEME_CHROME_EXTENSION; 1868 return SCHEME_CHROME_EXTENSION;
1864 if (scheme == kDataUriScheme) 1869 if (scheme == kDataUriScheme)
1865 return SCHEME_DATA; 1870 return SCHEME_DATA;
1866 return SCHEME_OTHER; 1871 return SCHEME_OTHER;
1867 } 1872 }
1868 1873
1869 } // namespace plugin 1874 } // namespace plugin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698