summaryrefslogtreecommitdiff
path: root/fxjs/fxjs_v8.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-02-21 13:57:13 -0800
committerChromium commit bot <commit-bot@chromium.org>2017-02-21 22:43:48 +0000
commit892d7510db7015b1835d8e057a716518881f126d (patch)
treef57ce39c39e1fd4b20312819c6a9cd795c7e96df /fxjs/fxjs_v8.cpp
parentd476adcab3b1b79b921c0003f8d8caad1bb1d00b (diff)
downloadpdfium-892d7510db7015b1835d8e057a716518881f126d.tar.xz
Avoid some widestring to bytestring conversions in fxjs.
None of the names have non-ascii characters. Change-Id: I83a52d6276edf2f442fca33221f38f6a53c3ffe3 Reviewed-on: https://pdfium-review.googlesource.com/2816 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs/fxjs_v8.cpp')
-rw-r--r--fxjs/fxjs_v8.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/fxjs/fxjs_v8.cpp b/fxjs/fxjs_v8.cpp
index 667d63be02..a5eba1bbc1 100644
--- a/fxjs/fxjs_v8.cpp
+++ b/fxjs/fxjs_v8.cpp
@@ -42,7 +42,7 @@ class CFXJS_ObjDefinition {
}
CFXJS_ObjDefinition(v8::Isolate* isolate,
- const wchar_t* sObjName,
+ const char* sObjName,
FXJSOBJTYPE eObjType,
CFXJS_Engine::Constructor pConstructor,
CFXJS_Engine::Destructor pDestructor)
@@ -86,7 +86,7 @@ class CFXJS_ObjDefinition {
return scope.Escape(m_Signature.Get(m_pIsolate));
}
- const wchar_t* const m_ObjName;
+ const char* const m_ObjName;
const FXJSOBJTYPE m_ObjType;
const CFXJS_Engine::Constructor m_pConstructor;
const CFXJS_Engine::Destructor m_pDestructor;
@@ -257,7 +257,7 @@ void CFXJS_Engine::FreeObjectPrivate(v8::Local<v8::Object> pObj) {
pObj->SetAlignedPointerInInternalField(0, nullptr);
}
-int CFXJS_Engine::DefineObj(const wchar_t* sObjName,
+int CFXJS_Engine::DefineObj(const char* sObjName,
FXJSOBJTYPE eObjType,
CFXJS_Engine::Constructor pConstructor,
CFXJS_Engine::Destructor pDestructor) {
@@ -392,14 +392,14 @@ void CFXJS_Engine::InitializeEngine() {
->ToObject(v8Context)
.ToLocalChecked());
} else if (pObjDef->m_ObjType == FXJSOBJTYPE_STATIC) {
- CFX_ByteString bs = FX_UTF8Encode(CFX_WideStringC(pObjDef->m_ObjName));
- v8::Local<v8::String> m_ObjName =
- v8::String::NewFromUtf8(m_isolate, bs.c_str(),
- v8::NewStringType::kNormal, bs.GetLength())
+ v8::Local<v8::String> pObjName =
+ v8::String::NewFromUtf8(m_isolate, pObjDef->m_ObjName,
+ v8::NewStringType::kNormal,
+ strlen(pObjDef->m_ObjName))
.ToLocalChecked();
v8::Local<v8::Object> obj = NewFxDynamicObj(i, true);
- v8Context->Global()->Set(v8Context, m_ObjName, obj).FromJust();
+ v8Context->Global()->Set(v8Context, pObjName, obj).FromJust();
m_StaticObjects[i] = new v8::Global<v8::Object>(m_isolate, obj);
}
}