| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifdef _MSC_VER | 5 #ifdef _MSC_VER |
| 6 // Do not warn about use of std::copy with raw pointers. | 6 // Do not warn about use of std::copy with raw pointers. |
| 7 #pragma warning(disable : 4996) | 7 #pragma warning(disable : 4996) |
| 8 #endif | 8 #endif |
| 9 | 9 |
| 10 #include "native_client/src/trusted/plugin/plugin.h" | 10 #include "native_client/src/trusted/plugin/plugin.h" |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 void Plugin::AddPropertyGet(const nacl::string& prop_name, | 434 void Plugin::AddPropertyGet(const nacl::string& prop_name, |
| 435 Plugin::PropertyGetter getter) { | 435 Plugin::PropertyGetter getter) { |
| 436 PLUGIN_PRINTF(("Plugin::AddPropertyGet (prop_name='%s')\n", | 436 PLUGIN_PRINTF(("Plugin::AddPropertyGet (prop_name='%s')\n", |
| 437 prop_name.c_str())); | 437 prop_name.c_str())); |
| 438 property_getters_[nacl::string(prop_name)] = getter; | 438 property_getters_[nacl::string(prop_name)] = getter; |
| 439 } | 439 } |
| 440 | 440 |
| 441 bool Plugin::HasProperty(const nacl::string& prop_name) { | 441 bool Plugin::HasProperty(const nacl::string& prop_name) { |
| 442 PLUGIN_PRINTF(("Plugin::HasProperty (prop_name=%s)\n", | 442 PLUGIN_PRINTF(("Plugin::HasProperty (prop_name=%s)\n", |
| 443 prop_name.c_str())); | 443 prop_name.c_str())); |
| 444 return property_getters_[prop_name] != NULL; | 444 return property_getters_.find(prop_name) != property_getters_.end(); |
| 445 } | 445 } |
| 446 | 446 |
| 447 bool Plugin::GetProperty(const nacl::string& prop_name, | 447 bool Plugin::GetProperty(const nacl::string& prop_name, |
| 448 NaClSrpcArg* prop_value) { | 448 NaClSrpcArg* prop_value) { |
| 449 PLUGIN_PRINTF(("Plugin::GetProperty (prop_name=%s)\n", prop_name.c_str())); | 449 PLUGIN_PRINTF(("Plugin::GetProperty (prop_name=%s)\n", prop_name.c_str())); |
| 450 | 450 |
| 451 PropertyGetter getter = property_getters_[prop_name]; | 451 if (property_getters_.find(prop_name) == property_getters_.end()) { |
| 452 if (NULL == getter) { | |
| 453 return false; | 452 return false; |
| 454 } | 453 } |
| 454 PropertyGetter getter = property_getters_[prop_name]; |
| 455 (this->*getter)(prop_value); | 455 (this->*getter)(prop_value); |
| 456 return true; | 456 return true; |
| 457 } | 457 } |
| 458 | 458 |
| 459 void Plugin::GetExitStatus(NaClSrpcArg* prop_value) { | 459 void Plugin::GetExitStatus(NaClSrpcArg* prop_value) { |
| 460 PLUGIN_PRINTF(("GetExitStatus (this=%p)\n", reinterpret_cast<void*>(this))); | 460 PLUGIN_PRINTF(("GetExitStatus (this=%p)\n", reinterpret_cast<void*>(this))); |
| 461 prop_value->tag = NACL_SRPC_ARG_TYPE_INT; | 461 prop_value->tag = NACL_SRPC_ARG_TYPE_INT; |
| 462 prop_value->u.ival = exit_status(); | 462 prop_value->u.ival = exit_status(); |
| 463 } | 463 } |
| 464 | 464 |
| (...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1885 static_cast<uint32_t>(text.size())); | 1885 static_cast<uint32_t>(text.size())); |
| 1886 const PPB_Console_Dev* console_interface = | 1886 const PPB_Console_Dev* console_interface = |
| 1887 static_cast<const PPB_Console_Dev*>( | 1887 static_cast<const PPB_Console_Dev*>( |
| 1888 module->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE)); | 1888 module->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE)); |
| 1889 console_interface->LogWithSource(pp_instance(), PP_LOGLEVEL_LOG, prefix, str); | 1889 console_interface->LogWithSource(pp_instance(), PP_LOGLEVEL_LOG, prefix, str); |
| 1890 var_interface->Release(prefix); | 1890 var_interface->Release(prefix); |
| 1891 var_interface->Release(str); | 1891 var_interface->Release(str); |
| 1892 } | 1892 } |
| 1893 | 1893 |
| 1894 } // namespace plugin | 1894 } // namespace plugin |
| OLD | NEW |