Chromium Code Reviews| 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 425 if (load_manager) { | 425 if (load_manager) { |
| 426 nacl::NexeLoadManager::ProgressEvent event(event_type); | 426 nacl::NexeLoadManager::ProgressEvent event(event_type); |
| 427 event.resource_url = resource_url; | 427 event.resource_url = resource_url; |
| 428 event.length_is_computable = PP_ToBool(length_is_computable); | 428 event.length_is_computable = PP_ToBool(length_is_computable); |
| 429 event.loaded_bytes = loaded_bytes; | 429 event.loaded_bytes = loaded_bytes; |
| 430 event.total_bytes = total_bytes; | 430 event.total_bytes = total_bytes; |
| 431 load_manager->DispatchEvent(event); | 431 load_manager->DispatchEvent(event); |
| 432 } | 432 } |
| 433 } | 433 } |
| 434 | 434 |
| 435 void SetReadOnlyProperty(PP_Instance instance, | |
| 436 struct PP_Var key, | |
| 437 struct PP_Var value) { | |
| 438 nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance); | |
| 439 if (load_manager) | |
| 440 load_manager->SetReadOnlyProperty(key, value); | |
| 441 } | |
| 442 | |
| 443 void ReportLoadSuccess(PP_Instance instance, | 435 void ReportLoadSuccess(PP_Instance instance, |
| 444 const char* url, | 436 const char* url, |
| 445 uint64_t loaded_bytes, | 437 uint64_t loaded_bytes, |
| 446 uint64_t total_bytes) { | 438 uint64_t total_bytes) { |
| 447 nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 439 nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance); |
| 448 if (load_manager) | 440 if (load_manager) |
| 449 load_manager->ReportLoadSuccess(url, loaded_bytes, total_bytes); | 441 load_manager->ReportLoadSuccess(url, loaded_bytes, total_bytes); |
| 450 } | 442 } |
| 451 | 443 |
| 452 void ReportLoadError(PP_Instance instance, | 444 void ReportLoadError(PP_Instance instance, |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 568 return 0; | 560 return 0; |
| 569 } | 561 } |
| 570 | 562 |
| 571 void SetReadyTime(PP_Instance instance, int64_t ready_time) { | 563 void SetReadyTime(PP_Instance instance, int64_t ready_time) { |
| 572 nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 564 nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance); |
| 573 DCHECK(load_manager); | 565 DCHECK(load_manager); |
| 574 if (load_manager) | 566 if (load_manager) |
| 575 load_manager->set_ready_time(ready_time); | 567 load_manager->set_ready_time(ready_time); |
| 576 } | 568 } |
| 577 | 569 |
| 570 int32_t GetExitStatus(PP_Instance instance) { | |
| 571 nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance); | |
| 572 DCHECK(load_manager); | |
| 573 if (load_manager) | |
| 574 return load_manager->exit_status(); | |
| 575 return -1; | |
| 576 } | |
| 577 | |
| 578 void SetExitStatus(PP_Instance instance, int32_t exit_status) { | |
| 579 nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance); | |
| 580 DCHECK(load_manager); | |
| 581 if (load_manager) | |
| 582 return load_manager->set_exit_status(exit_status); | |
| 583 } | |
| 584 | |
| 578 const PPB_NaCl_Private nacl_interface = { | 585 const PPB_NaCl_Private nacl_interface = { |
| 579 &LaunchSelLdr, | 586 &LaunchSelLdr, |
| 580 &StartPpapiProxy, | 587 &StartPpapiProxy, |
| 581 &UrandomFD, | 588 &UrandomFD, |
| 582 &Are3DInterfacesDisabled, | 589 &Are3DInterfacesDisabled, |
| 583 &BrokerDuplicateHandle, | 590 &BrokerDuplicateHandle, |
| 584 &GetReadonlyPnaclFD, | 591 &GetReadonlyPnaclFD, |
| 585 &CreateTemporaryFile, | 592 &CreateTemporaryFile, |
| 586 &GetNumberOfProcessors, | 593 &GetNumberOfProcessors, |
| 587 &IsNonSFIModeEnabled, | 594 &IsNonSFIModeEnabled, |
| 588 &GetNexeFd, | 595 &GetNexeFd, |
| 589 &ReportTranslationFinished, | 596 &ReportTranslationFinished, |
| 590 &OpenNaClExecutable, | 597 &OpenNaClExecutable, |
| 591 &DispatchEvent, | 598 &DispatchEvent, |
| 592 &SetReadOnlyProperty, | |
|
dmichael (off chromium)
2014/04/02 19:01:41
Yay!
| |
| 593 &ReportLoadSuccess, | 599 &ReportLoadSuccess, |
| 594 &ReportLoadError, | 600 &ReportLoadError, |
| 595 &ReportLoadAbort, | 601 &ReportLoadAbort, |
| 596 &ReportDeadNexe, | 602 &ReportDeadNexe, |
| 597 &InstanceCreated, | 603 &InstanceCreated, |
| 598 &InstanceDestroyed, | 604 &InstanceDestroyed, |
| 599 &NaClDebugEnabledForURL, | 605 &NaClDebugEnabledForURL, |
| 600 &GetSandboxArch, | 606 &GetSandboxArch, |
| 601 &GetUrlScheme, | 607 &GetUrlScheme, |
| 602 &LogToConsole, | 608 &LogToConsole, |
| 603 &GetNexeErrorReported, | 609 &GetNexeErrorReported, |
| 604 &GetNaClReadyState, | 610 &GetNaClReadyState, |
| 605 &SetNaClReadyState, | 611 &SetNaClReadyState, |
| 606 &GetIsInstalled, | 612 &GetIsInstalled, |
| 607 &SetIsInstalled, | 613 &SetIsInstalled, |
| 608 &GetReadyTime, | 614 &GetReadyTime, |
| 609 &SetReadyTime | 615 &SetReadyTime, |
| 616 &GetExitStatus, | |
| 617 &SetExitStatus | |
| 610 }; | 618 }; |
| 611 | 619 |
| 612 } // namespace | 620 } // namespace |
| 613 | 621 |
| 614 namespace nacl { | 622 namespace nacl { |
| 615 | 623 |
| 616 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 624 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
| 617 return &nacl_interface; | 625 return &nacl_interface; |
| 618 } | 626 } |
| 619 | 627 |
| 620 } // namespace nacl | 628 } // namespace nacl |
| OLD | NEW |