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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 { | 351 { |
352 nacl::MutexLocker take(&mu_); | 352 nacl::MutexLocker take(&mu_); |
353 *p->op_complete_ptr = true; // done... | 353 *p->op_complete_ptr = true; // done... |
354 p->file_info->desc = -1; // but failed. | 354 p->file_info->desc = -1; // but failed. |
355 NaClXCondVarBroadcast(&cv_); | 355 NaClXCondVarBroadcast(&cv_); |
356 } | 356 } |
357 p->MaybeRunCallback(PP_OK); | 357 p->MaybeRunCallback(PP_OK); |
358 return; | 358 return; |
359 } | 359 } |
360 | 360 |
361 if (PnaclUrls::IsPnaclComponent(mapped_url)) { | |
362 // Special PNaCl support files, that are installed on the | |
363 // user machine. | |
364 PP_FileHandle handle = plugin_->nacl_interface()->GetReadonlyPnaclFd( | |
365 PnaclUrls::PnaclComponentURLToFilename(mapped_url).c_str()); | |
366 int32_t fd = -1; | |
367 if (handle != PP_kInvalidFileHandle) | |
368 fd = ConvertFileDescriptor(handle, true); | |
369 | |
370 if (fd < 0) { | |
371 // We checked earlier if the pnacl component wasn't installed | |
372 // yet, so this shouldn't happen. At this point, we can't do much | |
373 // anymore, so just continue with an invalid fd. | |
374 NaClLog(4, | |
375 "OpenManifestEntry_MainThreadContinuation: " | |
376 "GetReadonlyPnaclFd failed\n"); | |
377 } | |
378 { | |
379 nacl::MutexLocker take(&mu_); | |
380 *p->op_complete_ptr = true; // done! | |
381 // TODO(ncbray): enable the fast loading and validation paths for this | |
382 // type of file. | |
383 p->file_info->desc = fd; | |
384 NaClXCondVarBroadcast(&cv_); | |
385 } | |
386 NaClLog(4, | |
387 "OpenManifestEntry_MainThreadContinuation: GetPnaclFd okay\n"); | |
388 p->MaybeRunCallback(PP_OK); | |
389 return; | |
390 } | |
391 | |
392 // Hereafter, normal files. | |
393 | |
394 // Because p is owned by the callback of this invocation, so it is necessary | 361 // Because p is owned by the callback of this invocation, so it is necessary |
395 // to create another instance. | 362 // to create another instance. |
396 OpenManifestEntryResource* open_cont = new OpenManifestEntryResource(*p); | 363 OpenManifestEntryResource* open_cont = new OpenManifestEntryResource(*p); |
397 open_cont->url = mapped_url; | 364 open_cont->url = mapped_url; |
398 // Callback is now delegated from p to open_cont. So, here we manually clear | 365 // Callback is now delegated from p to open_cont. So, here we manually clear |
399 // complete callback. | 366 // complete callback. |
400 p->callback = NULL; | 367 p->callback = NULL; |
401 | 368 |
402 pp::CompletionCallback stream_cc = WeakRefNewCallback( | 369 pp::CompletionCallback stream_cc = WeakRefNewCallback( |
403 anchor_, | 370 anchor_, |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 | 772 |
806 nacl::string ServiceRuntime::GetCrashLogOutput() { | 773 nacl::string ServiceRuntime::GetCrashLogOutput() { |
807 if (NULL != subprocess_.get()) { | 774 if (NULL != subprocess_.get()) { |
808 return subprocess_->GetCrashLogOutput(); | 775 return subprocess_->GetCrashLogOutput(); |
809 } else { | 776 } else { |
810 return std::string(); | 777 return std::string(); |
811 } | 778 } |
812 } | 779 } |
813 | 780 |
814 } // namespace plugin | 781 } // namespace plugin |
OLD | NEW |