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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 struct 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(module->pp_module(), | 52 var_interface->VarFromUtf8(prefix_string.c_str(), |
53 prefix_string.c_str(), | |
54 static_cast<uint32_t>(prefix_string.size())); | 53 static_cast<uint32_t>(prefix_string.size())); |
55 PP_Var str = var_interface->VarFromUtf8(module->pp_module(), | 54 PP_Var str = var_interface->VarFromUtf8(text.c_str(), |
56 text.c_str(), | |
57 static_cast<uint32_t>(text.size())); | 55 static_cast<uint32_t>(text.size())); |
58 const PPB_Console_Dev* console_interface = | 56 const PPB_Console_Dev* console_interface = |
59 static_cast<const struct PPB_Console_Dev*>( | 57 static_cast<const struct PPB_Console_Dev*>( |
60 module->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE)); | 58 module->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE)); |
61 console_interface->LogWithSource(instance->pp_instance(), | 59 console_interface->LogWithSource(instance->pp_instance(), |
62 PP_LOGLEVEL_LOG, | 60 PP_LOGLEVEL_LOG, |
63 prefix, | 61 prefix, |
64 str); | 62 str); |
65 var_interface->Release(prefix); | 63 var_interface->Release(prefix); |
66 var_interface->Release(str); | 64 var_interface->Release(str); |
67 } | 65 } |
68 | 66 |
69 } // namespace plugin | 67 } // namespace plugin |
OLD | NEW |