| 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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 void Plugin::AddPropertyGet(const nacl::string& prop_name, | 486 void Plugin::AddPropertyGet(const nacl::string& prop_name, |
| 487 Plugin::PropertyGetter getter) { | 487 Plugin::PropertyGetter getter) { |
| 488 PLUGIN_PRINTF(("Plugin::AddPropertyGet (prop_name='%s')\n", | 488 PLUGIN_PRINTF(("Plugin::AddPropertyGet (prop_name='%s')\n", |
| 489 prop_name.c_str())); | 489 prop_name.c_str())); |
| 490 property_getters_[nacl::string(prop_name)] = getter; | 490 property_getters_[nacl::string(prop_name)] = getter; |
| 491 } | 491 } |
| 492 | 492 |
| 493 bool Plugin::HasProperty(const nacl::string& prop_name) { | 493 bool Plugin::HasProperty(const nacl::string& prop_name) { |
| 494 PLUGIN_PRINTF(("Plugin::HasProperty (prop_name=%s)\n", | 494 PLUGIN_PRINTF(("Plugin::HasProperty (prop_name=%s)\n", |
| 495 prop_name.c_str())); | 495 prop_name.c_str())); |
| 496 return property_getters_[prop_name] != NULL; | 496 return property_getters_.find(prop_name) != property_getters_.end(); |
| 497 } | 497 } |
| 498 | 498 |
| 499 bool Plugin::GetProperty(const nacl::string& prop_name, | 499 bool Plugin::GetProperty(const nacl::string& prop_name, |
| 500 NaClSrpcArg* prop_value) { | 500 NaClSrpcArg* prop_value) { |
| 501 PLUGIN_PRINTF(("Plugin::GetProperty (prop_name=%s)\n", prop_name.c_str())); | 501 PLUGIN_PRINTF(("Plugin::GetProperty (prop_name=%s)\n", prop_name.c_str())); |
| 502 | 502 |
| 503 PropertyGetter getter = property_getters_[prop_name]; | 503 if (property_getters_.find(prop_name) == property_getters_.end()) { |
| 504 if (NULL == getter) { | |
| 505 return false; | 504 return false; |
| 506 } | 505 } |
| 506 |
| 507 PropertyGetter getter = property_getters_[prop_name]; |
| 507 (this->*getter)(prop_value); | 508 (this->*getter)(prop_value); |
| 508 return true; | 509 return true; |
| 509 } | 510 } |
| 510 | 511 |
| 511 void Plugin::GetExitStatus(NaClSrpcArg* prop_value) { | 512 void Plugin::GetExitStatus(NaClSrpcArg* prop_value) { |
| 512 PLUGIN_PRINTF(("GetExitStatus (this=%p)\n", reinterpret_cast<void*>(this))); | 513 PLUGIN_PRINTF(("GetExitStatus (this=%p)\n", reinterpret_cast<void*>(this))); |
| 513 prop_value->tag = NACL_SRPC_ARG_TYPE_INT; | 514 prop_value->tag = NACL_SRPC_ARG_TYPE_INT; |
| 514 prop_value->u.ival = exit_status(); | 515 prop_value->u.ival = exit_status(); |
| 515 } | 516 } |
| 516 | 517 |
| (...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1942 static_cast<uint32_t>(text.size())); | 1943 static_cast<uint32_t>(text.size())); |
| 1943 const PPB_Console_Dev* console_interface = | 1944 const PPB_Console_Dev* console_interface = |
| 1944 static_cast<const PPB_Console_Dev*>( | 1945 static_cast<const PPB_Console_Dev*>( |
| 1945 module->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE)); | 1946 module->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE)); |
| 1946 console_interface->LogWithSource(pp_instance(), PP_LOGLEVEL_LOG, prefix, str); | 1947 console_interface->LogWithSource(pp_instance(), PP_LOGLEVEL_LOG, prefix, str); |
| 1947 var_interface->Release(prefix); | 1948 var_interface->Release(prefix); |
| 1948 var_interface->Release(str); | 1949 var_interface->Release(str); |
| 1949 } | 1950 } |
| 1950 | 1951 |
| 1951 } // namespace plugin | 1952 } // namespace plugin |
| OLD | NEW |