OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "components/nacl/renderer/ppb_nacl_private_impl.h" | 5 #include "components/nacl/renderer/ppb_nacl_private_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/containers/scoped_ptr_hash_map.h" | 8 #include "base/containers/scoped_ptr_hash_map.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
469 if (load_manager) { | 469 if (load_manager) { |
470 nacl::NexeLoadManager::ProgressEvent event(event_type); | 470 nacl::NexeLoadManager::ProgressEvent event(event_type); |
471 event.resource_url = resource_url; | 471 event.resource_url = resource_url; |
472 event.length_is_computable = PP_ToBool(length_is_computable); | 472 event.length_is_computable = PP_ToBool(length_is_computable); |
473 event.loaded_bytes = loaded_bytes; | 473 event.loaded_bytes = loaded_bytes; |
474 event.total_bytes = total_bytes; | 474 event.total_bytes = total_bytes; |
475 load_manager->DispatchEvent(event); | 475 load_manager->DispatchEvent(event); |
476 } | 476 } |
477 } | 477 } |
478 | 478 |
479 void NexeFileDidOpen(PP_Instance instance, | |
480 int32_t pp_error, | |
481 int32_t fd, | |
482 int32_t http_status, | |
483 int64_t nexe_bytes_read, | |
484 const char* url) { | |
485 nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance); | |
486 if (load_manager) | |
487 load_manager->NexeFileDidOpen(pp_error, fd, http_status, nexe_bytes_read, | |
488 url); | |
teravest
2014/04/09 16:57:44
This indentation looks funny to me.
| |
489 } | |
490 | |
479 void ReportLoadSuccess(PP_Instance instance, | 491 void ReportLoadSuccess(PP_Instance instance, |
480 const char* url, | 492 const char* url, |
481 uint64_t loaded_bytes, | 493 uint64_t loaded_bytes, |
482 uint64_t total_bytes) { | 494 uint64_t total_bytes) { |
483 nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 495 nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance); |
484 if (load_manager) | 496 if (load_manager) |
485 load_manager->ReportLoadSuccess(url, loaded_bytes, total_bytes); | 497 load_manager->ReportLoadSuccess(url, loaded_bytes, total_bytes); |
486 } | 498 } |
487 | 499 |
488 void ReportLoadError(PP_Instance instance, | 500 void ReportLoadError(PP_Instance instance, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
622 } | 634 } |
623 | 635 |
624 int64_t GetNexeSize(PP_Instance instance) { | 636 int64_t GetNexeSize(PP_Instance instance) { |
625 nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 637 nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance); |
626 DCHECK(load_manager); | 638 DCHECK(load_manager); |
627 if (load_manager) | 639 if (load_manager) |
628 return load_manager->nexe_size(); | 640 return load_manager->nexe_size(); |
629 return 0; | 641 return 0; |
630 } | 642 } |
631 | 643 |
632 void SetNexeSize(PP_Instance instance, int64_t nexe_size) { | |
633 nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance); | |
634 DCHECK(load_manager); | |
635 if (load_manager) | |
636 return load_manager->set_nexe_size(nexe_size); | |
637 } | |
638 | |
639 const PPB_NaCl_Private nacl_interface = { | 644 const PPB_NaCl_Private nacl_interface = { |
640 &LaunchSelLdr, | 645 &LaunchSelLdr, |
641 &StartPpapiProxy, | 646 &StartPpapiProxy, |
642 &UrandomFD, | 647 &UrandomFD, |
643 &Are3DInterfacesDisabled, | 648 &Are3DInterfacesDisabled, |
644 &BrokerDuplicateHandle, | 649 &BrokerDuplicateHandle, |
645 &GetReadonlyPnaclFD, | 650 &GetReadonlyPnaclFD, |
646 &CreateTemporaryFile, | 651 &CreateTemporaryFile, |
647 &GetNumberOfProcessors, | 652 &GetNumberOfProcessors, |
648 &IsNonSFIModeEnabled, | 653 &IsNonSFIModeEnabled, |
649 &GetNexeFd, | 654 &GetNexeFd, |
650 &ReportTranslationFinished, | 655 &ReportTranslationFinished, |
651 &OpenNaClExecutable, | 656 &OpenNaClExecutable, |
652 &DispatchEvent, | 657 &DispatchEvent, |
658 &NexeFileDidOpen, | |
653 &ReportLoadSuccess, | 659 &ReportLoadSuccess, |
654 &ReportLoadError, | 660 &ReportLoadError, |
655 &ReportLoadAbort, | 661 &ReportLoadAbort, |
656 &NexeDidCrash, | 662 &NexeDidCrash, |
657 &InstanceCreated, | 663 &InstanceCreated, |
658 &InstanceDestroyed, | 664 &InstanceDestroyed, |
659 &NaClDebugEnabledForURL, | 665 &NaClDebugEnabledForURL, |
660 &GetSandboxArch, | 666 &GetSandboxArch, |
661 &GetUrlScheme, | 667 &GetUrlScheme, |
662 &LogToConsole, | 668 &LogToConsole, |
663 &GetNaClReadyState, | 669 &GetNaClReadyState, |
664 &SetNaClReadyState, | 670 &SetNaClReadyState, |
665 &GetIsInstalled, | 671 &GetIsInstalled, |
666 &SetIsInstalled, | 672 &SetIsInstalled, |
667 &SetReadyTime, | 673 &SetReadyTime, |
668 &GetExitStatus, | 674 &GetExitStatus, |
669 &SetExitStatus, | 675 &SetExitStatus, |
670 &Vlog, | 676 &Vlog, |
671 &SetInitTime, | 677 &SetInitTime, |
672 &GetNexeSize, | 678 &GetNexeSize |
673 &SetNexeSize | |
674 }; | 679 }; |
675 | 680 |
676 } // namespace | 681 } // namespace |
677 | 682 |
678 namespace nacl { | 683 namespace nacl { |
679 | 684 |
680 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 685 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
681 return &nacl_interface; | 686 return &nacl_interface; |
682 } | 687 } |
683 | 688 |
684 } // namespace nacl | 689 } // namespace nacl |
OLD | NEW |