| 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 <numeric> | 7 #include <numeric> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 } | 583 } |
| 584 | 584 |
| 585 if (transit_fd == IPC::InvalidPlatformFileForTransit()) { | 585 if (transit_fd == IPC::InvalidPlatformFileForTransit()) { |
| 586 return PP_kInvalidFileHandle; | 586 return PP_kInvalidFileHandle; |
| 587 } | 587 } |
| 588 | 588 |
| 589 return IPC::PlatformFileForTransitToPlatformFile(transit_fd); | 589 return IPC::PlatformFileForTransitToPlatformFile(transit_fd); |
| 590 } | 590 } |
| 591 | 591 |
| 592 int32_t GetNumberOfProcessors() { | 592 int32_t GetNumberOfProcessors() { |
| 593 int32_t num_processors; | |
| 594 IPC::Sender* sender = content::RenderThread::Get(); | 593 IPC::Sender* sender = content::RenderThread::Get(); |
| 595 DCHECK(sender); | 594 DCHECK(sender); |
| 596 if(!sender->Send(new NaClHostMsg_NaClGetNumProcessors(&num_processors))) { | 595 int32_t num_processors = 1; |
| 597 return 1; | 596 return sender->Send(new NaClHostMsg_NaClGetNumProcessors(&num_processors)) ? |
| 598 } | 597 num_processors : 1; |
| 599 return num_processors; | |
| 600 } | 598 } |
| 601 | 599 |
| 602 PP_Bool PPIsNonSFIModeEnabled() { | 600 PP_Bool PPIsNonSFIModeEnabled() { |
| 603 return PP_FromBool(IsNonSFIModeEnabled()); | 601 return PP_FromBool(IsNonSFIModeEnabled()); |
| 604 } | 602 } |
| 605 | 603 |
| 606 void GetNexeFd(PP_Instance instance, | 604 void GetNexeFd(PP_Instance instance, |
| 607 const std::string& pexe_url, | 605 const std::string& pexe_url, |
| 608 uint32_t opt_level, | 606 uint32_t opt_level, |
| 609 const base::Time& last_modified_time, | 607 const base::Time& last_modified_time, |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 // the NexeLoadManager (e.g., by calling ReportLoadError). Passing out the | 778 // the NexeLoadManager (e.g., by calling ReportLoadError). Passing out the |
| 781 // NexeLoadManager to a local scoped_ptr just ensures that its entry is gone | 779 // NexeLoadManager to a local scoped_ptr just ensures that its entry is gone |
| 782 // from the map prior to the destructor being invoked. | 780 // from the map prior to the destructor being invoked. |
| 783 scoped_ptr<NexeLoadManager> temp(map.take(instance)); | 781 scoped_ptr<NexeLoadManager> temp(map.take(instance)); |
| 784 map.erase(instance); | 782 map.erase(instance); |
| 785 } | 783 } |
| 786 | 784 |
| 787 PP_Bool NaClDebugEnabledForURL(const char* alleged_nmf_url) { | 785 PP_Bool NaClDebugEnabledForURL(const char* alleged_nmf_url) { |
| 788 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableNaClDebug)) | 786 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableNaClDebug)) |
| 789 return PP_FALSE; | 787 return PP_FALSE; |
| 790 bool should_debug; | |
| 791 IPC::Sender* sender = content::RenderThread::Get(); | 788 IPC::Sender* sender = content::RenderThread::Get(); |
| 792 DCHECK(sender); | 789 DCHECK(sender); |
| 793 if(!sender->Send(new NaClHostMsg_NaClDebugEnabledForURL( | 790 bool should_debug = false; |
| 794 GURL(alleged_nmf_url), | 791 return PP_FromBool( |
| 795 &should_debug))) { | 792 sender->Send(new NaClHostMsg_NaClDebugEnabledForURL(GURL(alleged_nmf_url), |
| 796 return PP_FALSE; | 793 &should_debug)) && |
| 797 } | 794 should_debug); |
| 798 return PP_FromBool(should_debug); | |
| 799 } | 795 } |
| 800 | 796 |
| 801 void LogToConsole(PP_Instance instance, const char* message) { | 797 void LogToConsole(PP_Instance instance, const char* message) { |
| 802 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 798 NexeLoadManager* load_manager = GetNexeLoadManager(instance); |
| 803 DCHECK(load_manager); | 799 DCHECK(load_manager); |
| 804 if (load_manager) | 800 if (load_manager) |
| 805 load_manager->LogToConsole(std::string(message)); | 801 load_manager->LogToConsole(std::string(message)); |
| 806 } | 802 } |
| 807 | 803 |
| 808 PP_NaClReadyState GetNaClReadyState(PP_Instance instance) { | 804 PP_NaClReadyState GetNaClReadyState(PP_Instance instance) { |
| (...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1736 &StreamPexe | 1732 &StreamPexe |
| 1737 }; | 1733 }; |
| 1738 | 1734 |
| 1739 } // namespace | 1735 } // namespace |
| 1740 | 1736 |
| 1741 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1737 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
| 1742 return &nacl_interface; | 1738 return &nacl_interface; |
| 1743 } | 1739 } |
| 1744 | 1740 |
| 1745 } // namespace nacl | 1741 } // namespace nacl |
| OLD | NEW |