| OLD | NEW | 
|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <assert.h> | 5 #include <assert.h> | 
| 6 | 6 | 
| 7 #include "native_client/src/trusted/plugin/browser_interface.h" | 7 #include "native_client/src/trusted/plugin/browser_interface.h" | 
| 8 | 8 | 
| 9 #include "native_client/src/include/checked_cast.h" | 9 #include "native_client/src/include/checked_cast.h" | 
| 10 #include "native_client/src/include/elf.h" | 10 #include "native_client/src/include/elf.h" | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
| 38   assert(identifier_to_string_map_.find(ident) != | 38   assert(identifier_to_string_map_.find(ident) != | 
| 39          identifier_to_string_map_.end()); | 39          identifier_to_string_map_.end()); | 
| 40   return identifier_to_string_map_[ident]; | 40   return identifier_to_string_map_[ident]; | 
| 41 } | 41 } | 
| 42 | 42 | 
| 43 | 43 | 
| 44 void BrowserInterface::AddToConsole(pp::InstancePrivate* instance, | 44 void BrowserInterface::AddToConsole(pp::InstancePrivate* instance, | 
| 45                                     const nacl::string& text) { | 45                                     const nacl::string& text) { | 
| 46   pp::Module* module = pp::Module::Get(); | 46   pp::Module* module = pp::Module::Get(); | 
| 47   const PPB_Var* var_interface = | 47   const PPB_Var* var_interface = | 
| 48       static_cast<const struct PPB_Var*>( | 48       static_cast<const PPB_Var*>( | 
| 49           module->GetBrowserInterface(PPB_VAR_INTERFACE)); | 49           module->GetBrowserInterface(PPB_VAR_INTERFACE)); | 
| 50   nacl::string prefix_string("NativeClient"); | 50   nacl::string prefix_string("NativeClient"); | 
| 51   PP_Var prefix = | 51   PP_Var prefix = | 
| 52       var_interface->VarFromUtf8(prefix_string.c_str(), | 52       var_interface->VarFromUtf8(prefix_string.c_str(), | 
| 53                                  static_cast<uint32_t>(prefix_string.size())); | 53                                  static_cast<uint32_t>(prefix_string.size())); | 
| 54   PP_Var str = var_interface->VarFromUtf8(text.c_str(), | 54   PP_Var str = var_interface->VarFromUtf8(text.c_str(), | 
| 55                                           static_cast<uint32_t>(text.size())); | 55                                           static_cast<uint32_t>(text.size())); | 
| 56   const PPB_Console_Dev* console_interface = | 56   const PPB_Console_Dev* console_interface = | 
| 57       static_cast<const struct PPB_Console_Dev*>( | 57       static_cast<const PPB_Console_Dev*>( | 
| 58           module->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE)); | 58           module->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE)); | 
| 59   console_interface->LogWithSource(instance->pp_instance(), | 59   console_interface->LogWithSource(instance->pp_instance(), | 
| 60                                    PP_LOGLEVEL_LOG, | 60                                    PP_LOGLEVEL_LOG, | 
| 61                                    prefix, | 61                                    prefix, | 
| 62                                    str); | 62                                    str); | 
| 63   var_interface->Release(prefix); | 63   var_interface->Release(prefix); | 
| 64   var_interface->Release(str); | 64   var_interface->Release(str); | 
| 65 } | 65 } | 
| 66 | 66 | 
| 67 }  // namespace plugin | 67 }  // namespace plugin | 
| OLD | NEW | 
|---|