summaryrefslogtreecommitdiff
path: root/fxjs/fxjs_v8.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-02-21 15:05:57 -0800
committerChromium commit bot <commit-bot@chromium.org>2017-02-22 01:08:38 +0000
commit9b99b63fa5e56bd820aecdc0fd2decd22a3d075a (patch)
treeb1eb5be25aef41f2f4f70a985e822af004f007a5 /fxjs/fxjs_v8.cpp
parentc54c07eac0531b6d9fcd591c3e44c5e27817d076 (diff)
downloadpdfium-9b99b63fa5e56bd820aecdc0fd2decd22a3d075a.tar.xz
Convert native method names to single-byte.
There are no non-ascii characters, so save space. Change-Id: Ib9efb9386b6fc83bf3bb1810c791aadeeeebc259 Reviewed-on: https://pdfium-review.googlesource.com/2817 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs/fxjs_v8.cpp')
-rw-r--r--fxjs/fxjs_v8.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/fxjs/fxjs_v8.cpp b/fxjs/fxjs_v8.cpp
index a5eba1bbc1..dc2071a88f 100644
--- a/fxjs/fxjs_v8.cpp
+++ b/fxjs/fxjs_v8.cpp
@@ -270,18 +270,17 @@ int CFXJS_Engine::DefineObj(const char* sObjName,
}
void CFXJS_Engine::DefineObjMethod(int nObjDefnID,
- const wchar_t* sMethodName,
+ const char* sMethodName,
v8::FunctionCallback pMethodCall) {
v8::Isolate::Scope isolate_scope(m_isolate);
v8::HandleScope handle_scope(m_isolate);
- CFX_ByteString bsMethodName = FX_UTF8Encode(CFX_WideStringC(sMethodName));
CFXJS_ObjDefinition* pObjDef =
CFXJS_ObjDefinition::ForID(m_isolate, nObjDefnID);
v8::Local<v8::FunctionTemplate> fun = v8::FunctionTemplate::New(
m_isolate, pMethodCall, v8::Local<v8::Value>(), pObjDef->GetSignature());
fun->RemovePrototype();
pObjDef->GetInstanceTemplate()->Set(
- v8::String::NewFromUtf8(m_isolate, bsMethodName.c_str(),
+ v8::String::NewFromUtf8(m_isolate, sMethodName,
v8::NewStringType::kNormal)
.ToLocalChecked(),
fun, v8::ReadOnly);
@@ -328,16 +327,15 @@ void CFXJS_Engine::DefineObjConst(int nObjDefnID,
pObjDef->GetInstanceTemplate()->Set(m_isolate, bsConstName.c_str(), pDefault);
}
-void CFXJS_Engine::DefineGlobalMethod(const wchar_t* sMethodName,
+void CFXJS_Engine::DefineGlobalMethod(const char* sMethodName,
v8::FunctionCallback pMethodCall) {
v8::Isolate::Scope isolate_scope(m_isolate);
v8::HandleScope handle_scope(m_isolate);
- CFX_ByteString bsMethodName = FX_UTF8Encode(CFX_WideStringC(sMethodName));
v8::Local<v8::FunctionTemplate> fun =
v8::FunctionTemplate::New(m_isolate, pMethodCall);
fun->RemovePrototype();
GetGlobalObjectTemplate(m_isolate)->Set(
- v8::String::NewFromUtf8(m_isolate, bsMethodName.c_str(),
+ v8::String::NewFromUtf8(m_isolate, sMethodName,
v8::NewStringType::kNormal)
.ToLocalChecked(),
fun, v8::ReadOnly);