OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2012 The Chromium 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 #define NACL_LOG_MODULE_NAME "Plugin_ServiceRuntime" | 7 #define NACL_LOG_MODULE_NAME "Plugin_ServiceRuntime" |
8 | 8 |
9 #include "ppapi/native_client/src/trusted/plugin/service_runtime.h" | 9 #include "ppapi/native_client/src/trusted/plugin/service_runtime.h" |
10 | 10 |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 "StreamAsFile_MainThreadContinuation: !PP_OK, setting desc -1\n"); | 445 "StreamAsFile_MainThreadContinuation: !PP_OK, setting desc -1\n"); |
446 p->file_info->desc = -1; | 446 p->file_info->desc = -1; |
447 } | 447 } |
448 *p->op_complete_ptr = true; | 448 *p->op_complete_ptr = true; |
449 NaClXCondVarBroadcast(&cv_); | 449 NaClXCondVarBroadcast(&cv_); |
450 } | 450 } |
451 p->MaybeRunCallback(PP_OK); | 451 p->MaybeRunCallback(PP_OK); |
452 } | 452 } |
453 | 453 |
454 bool PluginReverseInterface::CloseManifestEntry(int32_t desc) { | 454 bool PluginReverseInterface::CloseManifestEntry(int32_t desc) { |
455 bool op_complete = false; | 455 // We don't take any action on a call to CloseManifestEntry today, so always |
456 bool op_result; | 456 // return success. |
457 CloseManifestEntryResource* to_close = | 457 return true; |
458 new CloseManifestEntryResource(desc, &op_complete, &op_result); | |
459 | |
460 plugin::WeakRefCallOnMainThread( | |
461 anchor_, | |
462 0, | |
463 this, | |
464 &plugin::PluginReverseInterface:: | |
465 CloseManifestEntry_MainThreadContinuation, | |
466 to_close); | |
467 | |
468 // wait for completion or surf-away. | |
469 { | |
470 nacl::MutexLocker take(&mu_); | |
471 while (!shutting_down_ && !op_complete) | |
472 NaClXCondVarWait(&cv_, &mu_); | |
473 if (shutting_down_) | |
474 return false; | |
475 } | |
476 | |
477 // op_result true if close was successful; false otherwise (e.g., bad desc). | |
478 return op_result; | |
479 } | |
480 | |
481 void PluginReverseInterface::CloseManifestEntry_MainThreadContinuation( | |
482 CloseManifestEntryResource* cls, | |
483 int32_t err) { | |
484 UNREFERENCED_PARAMETER(err); | |
485 | |
486 nacl::MutexLocker take(&mu_); | |
487 // TODO(bsy): once the plugin has a reliable way to report that the | |
488 // file usage is done -- and sel_ldr uses this RPC call -- we should | |
489 // tell the plugin that the associated resources can be freed. | |
490 *cls->op_result_ptr = true; | |
491 *cls->op_complete_ptr = true; | |
492 NaClXCondVarBroadcast(&cv_); | |
493 // cls automatically deleted | |
494 } | 458 } |
495 | 459 |
496 void PluginReverseInterface::ReportCrash() { | 460 void PluginReverseInterface::ReportCrash() { |
497 NaClLog(4, "PluginReverseInterface::ReportCrash\n"); | 461 NaClLog(4, "PluginReverseInterface::ReportCrash\n"); |
498 | 462 |
499 if (crash_cb_.pp_completion_callback().func != NULL) { | 463 if (crash_cb_.pp_completion_callback().func != NULL) { |
500 NaClLog(4, "PluginReverseInterface::ReportCrash: invoking CB\n"); | 464 NaClLog(4, "PluginReverseInterface::ReportCrash: invoking CB\n"); |
501 pp::Module::Get()->core()->CallOnMainThread(0, crash_cb_, PP_OK); | 465 pp::Module::Get()->core()->CallOnMainThread(0, crash_cb_, PP_OK); |
502 } else { | 466 } else { |
503 NaClLog(1, | 467 NaClLog(1, |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 | 841 |
878 nacl::string ServiceRuntime::GetCrashLogOutput() { | 842 nacl::string ServiceRuntime::GetCrashLogOutput() { |
879 if (NULL != subprocess_.get()) { | 843 if (NULL != subprocess_.get()) { |
880 return subprocess_->GetCrashLogOutput(); | 844 return subprocess_->GetCrashLogOutput(); |
881 } else { | 845 } else { |
882 return std::string(); | 846 return std::string(); |
883 } | 847 } |
884 } | 848 } |
885 | 849 |
886 } // namespace plugin | 850 } // namespace plugin |
OLD | NEW |