| 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 open_cont->url = mapped_url; | 401 open_cont->url = mapped_url; |
| 402 // Callback is now delegated from p to open_cont. So, here we manually clear | 402 // Callback is now delegated from p to open_cont. So, here we manually clear |
| 403 // complete callback. | 403 // complete callback. |
| 404 p->callback = NULL; | 404 p->callback = NULL; |
| 405 pp::CompletionCallback stream_cc = WeakRefNewCallback( | 405 pp::CompletionCallback stream_cc = WeakRefNewCallback( |
| 406 anchor_, | 406 anchor_, |
| 407 this, | 407 this, |
| 408 &PluginReverseInterface::StreamAsFile_MainThreadContinuation, | 408 &PluginReverseInterface::StreamAsFile_MainThreadContinuation, |
| 409 open_cont); | 409 open_cont); |
| 410 | 410 |
| 411 if (!plugin_->StreamAsFile(mapped_url, stream_cc)) { | 411 if (!plugin_->StreamAsFile(mapped_url, p->file_info, stream_cc)) { |
| 412 NaClLog(4, | 412 NaClLog(4, |
| 413 "OpenManifestEntry_MainThreadContinuation: " | 413 "OpenManifestEntry_MainThreadContinuation: " |
| 414 "StreamAsFile failed\n"); | 414 "StreamAsFile failed\n"); |
| 415 // Here, StreamAsFile is failed and stream_cc is not called. | 415 // Here, StreamAsFile is failed and stream_cc is not called. |
| 416 // However, open_cont will be released only by the invocation. | 416 // However, open_cont will be released only by the invocation. |
| 417 // So, we manually call it here with error. | 417 // So, we manually call it here with error. |
| 418 stream_cc.Run(PP_ERROR_FAILED); | 418 stream_cc.Run(PP_ERROR_FAILED); |
| 419 return; | 419 return; |
| 420 } | 420 } |
| 421 | 421 |
| 422 NaClLog(4, "OpenManifestEntry_MainThreadContinuation: StreamAsFile okay\n"); | 422 NaClLog(4, "OpenManifestEntry_MainThreadContinuation: StreamAsFile okay\n"); |
| 423 // p is deleted automatically | 423 // p is deleted automatically |
| 424 } | 424 } |
| 425 | 425 |
| 426 void PluginReverseInterface::StreamAsFile_MainThreadContinuation( | 426 void PluginReverseInterface::StreamAsFile_MainThreadContinuation( |
| 427 OpenManifestEntryResource* p, | 427 OpenManifestEntryResource* p, |
| 428 int32_t result) { | 428 int32_t result) { |
| 429 NaClLog(4, | 429 NaClLog(4, |
| 430 "Entered StreamAsFile_MainThreadContinuation\n"); | 430 "Entered StreamAsFile_MainThreadContinuation\n"); |
| 431 | 431 |
| 432 { | 432 { |
| 433 nacl::MutexLocker take(&mu_); | 433 nacl::MutexLocker take(&mu_); |
| 434 if (result == PP_OK) { | 434 if (result == PP_OK) { |
| 435 NaClLog(4, "StreamAsFile_MainThreadContinuation: GetFileInfo(%s)\n", | |
| 436 p->url.c_str()); | |
| 437 *p->file_info = plugin_->GetFileInfo(p->url); | |
| 438 | |
| 439 NaClLog(4, | 435 NaClLog(4, |
| 440 "StreamAsFile_MainThreadContinuation: PP_OK, desc %d\n", | 436 "StreamAsFile_MainThreadContinuation: PP_OK, desc %d\n", |
| 441 p->file_info->desc); | 437 p->file_info->desc); |
| 442 } else { | 438 } else { |
| 443 NaClLog( | 439 NaClLog( |
| 444 4, | 440 4, |
| 445 "StreamAsFile_MainThreadContinuation: !PP_OK, setting desc -1\n"); | 441 "StreamAsFile_MainThreadContinuation: !PP_OK, setting desc -1\n"); |
| 446 p->file_info->desc = -1; | 442 p->file_info->desc = -1; |
| 447 } | 443 } |
| 448 *p->op_complete_ptr = true; | 444 *p->op_complete_ptr = true; |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 | 831 |
| 836 nacl::string ServiceRuntime::GetCrashLogOutput() { | 832 nacl::string ServiceRuntime::GetCrashLogOutput() { |
| 837 if (NULL != subprocess_.get()) { | 833 if (NULL != subprocess_.get()) { |
| 838 return subprocess_->GetCrashLogOutput(); | 834 return subprocess_->GetCrashLogOutput(); |
| 839 } else { | 835 } else { |
| 840 return std::string(); | 836 return std::string(); |
| 841 } | 837 } |
| 842 } | 838 } |
| 843 | 839 |
| 844 } // namespace plugin | 840 } // namespace plugin |
| OLD | NEW |