| 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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 DLOG_IF(ERROR, map.count(instance) != 0) << "Instance count should be 0"; | 463 DLOG_IF(ERROR, map.count(instance) != 0) << "Instance count should be 0"; |
| 464 map.add(instance, new_load_manager.Pass()); | 464 map.add(instance, new_load_manager.Pass()); |
| 465 } | 465 } |
| 466 | 466 |
| 467 void InstanceDestroyed(PP_Instance instance) { | 467 void InstanceDestroyed(PP_Instance instance) { |
| 468 NexeLoadManagerMap& map = g_load_manager_map.Get(); | 468 NexeLoadManagerMap& map = g_load_manager_map.Get(); |
| 469 DLOG_IF(ERROR, map.count(instance) == 0) << "Could not find instance ID"; | 469 DLOG_IF(ERROR, map.count(instance) == 0) << "Could not find instance ID"; |
| 470 map.erase(instance); | 470 map.erase(instance); |
| 471 } | 471 } |
| 472 | 472 |
| 473 PP_Bool NaClDebugStubEnabled() { | 473 PP_Bool NaClDebugEnabledForURL(const char* alleged_nmf_url) { |
| 474 return PP_FromBool(CommandLine::ForCurrentProcess()->HasSwitch( | 474 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableNaClDebug)) |
| 475 switches::kEnableNaClDebug)); | 475 return PP_FALSE; |
| 476 bool should_debug; |
| 477 IPC::Sender* sender = content::RenderThread::Get(); |
| 478 DCHECK(sender); |
| 479 if(!sender->Send(new NaClHostMsg_NaClDebugEnabledForURL( |
| 480 GURL(alleged_nmf_url), |
| 481 &should_debug))) { |
| 482 return PP_FALSE; |
| 483 } |
| 484 return PP_FromBool(should_debug); |
| 476 } | 485 } |
| 477 | 486 |
| 478 const char* GetSandboxArch() { | 487 const char* GetSandboxArch() { |
| 479 return nacl::GetSandboxArch(); | 488 return nacl::GetSandboxArch(); |
| 480 } | 489 } |
| 481 | 490 |
| 482 PP_UrlSchemeType GetUrlScheme(PP_Var url) { | 491 PP_UrlSchemeType GetUrlScheme(PP_Var url) { |
| 483 scoped_refptr<ppapi::StringVar> url_string = ppapi::StringVar::FromPPVar(url); | 492 scoped_refptr<ppapi::StringVar> url_string = ppapi::StringVar::FromPPVar(url); |
| 484 if (!url_string) | 493 if (!url_string) |
| 485 return PP_SCHEME_OTHER; | 494 return PP_SCHEME_OTHER; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 511 &GetNumberOfProcessors, | 520 &GetNumberOfProcessors, |
| 512 &IsNonSFIModeEnabled, | 521 &IsNonSFIModeEnabled, |
| 513 &GetNexeFd, | 522 &GetNexeFd, |
| 514 &ReportTranslationFinished, | 523 &ReportTranslationFinished, |
| 515 &OpenNaClExecutable, | 524 &OpenNaClExecutable, |
| 516 &DispatchEvent, | 525 &DispatchEvent, |
| 517 &SetReadOnlyProperty, | 526 &SetReadOnlyProperty, |
| 518 &ReportLoadError, | 527 &ReportLoadError, |
| 519 &InstanceCreated, | 528 &InstanceCreated, |
| 520 &InstanceDestroyed, | 529 &InstanceDestroyed, |
| 521 &NaClDebugStubEnabled, | 530 &NaClDebugEnabledForURL, |
| 522 &GetSandboxArch, | 531 &GetSandboxArch, |
| 523 &GetUrlScheme, | 532 &GetUrlScheme, |
| 524 &LogToConsole | 533 &LogToConsole |
| 525 }; | 534 }; |
| 526 | 535 |
| 527 } // namespace | 536 } // namespace |
| 528 | 537 |
| 529 namespace nacl { | 538 namespace nacl { |
| 530 | 539 |
| 531 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 540 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
| 532 return &nacl_interface; | 541 return &nacl_interface; |
| 533 } | 542 } |
| 534 | 543 |
| 535 } // namespace nacl | 544 } // namespace nacl |
| OLD | NEW |