summaryrefslogtreecommitdiff
path: root/fxjs
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-02-13 10:26:01 -0800
committerChromium commit bot <commit-bot@chromium.org>2017-02-13 19:00:17 +0000
commitf0b65545313f065790de7f91c02e5dd160753abd (patch)
tree747c55722c6b45a979d5c2894a259396a3189ed7 /fxjs
parent5fb0ad8adac5fcbf8c8f1965164f41d11c0af669 (diff)
downloadpdfium-f0b65545313f065790de7f91c02e5dd160753abd.tar.xz
Simplify FX_UTF8Encode variants.chromium/3012
Doing so reveals places where there are needless copies and conversions. Change-Id: I24a868d40aa63836f4167eaf4541964049df7916 Reviewed-on: https://pdfium-review.googlesource.com/2555 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs')
-rw-r--r--fxjs/fxjs_v8.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/fxjs/fxjs_v8.cpp b/fxjs/fxjs_v8.cpp
index c96cc1f0e0..667d63be02 100644
--- a/fxjs/fxjs_v8.cpp
+++ b/fxjs/fxjs_v8.cpp
@@ -274,7 +274,7 @@ void CFXJS_Engine::DefineObjMethod(int nObjDefnID,
v8::FunctionCallback pMethodCall) {
v8::Isolate::Scope isolate_scope(m_isolate);
v8::HandleScope handle_scope(m_isolate);
- CFX_ByteString bsMethodName = CFX_WideString(sMethodName).UTF8Encode();
+ 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(
@@ -293,7 +293,7 @@ void CFXJS_Engine::DefineObjProperty(int nObjDefnID,
v8::AccessorSetterCallback pPropPut) {
v8::Isolate::Scope isolate_scope(m_isolate);
v8::HandleScope handle_scope(m_isolate);
- CFX_ByteString bsPropertyName = CFX_WideString(sPropName).UTF8Encode();
+ CFX_ByteString bsPropertyName = FX_UTF8Encode(CFX_WideStringC(sPropName));
CFXJS_ObjDefinition* pObjDef =
CFXJS_ObjDefinition::ForID(m_isolate, nObjDefnID);
pObjDef->GetInstanceTemplate()->SetAccessor(
@@ -322,7 +322,7 @@ void CFXJS_Engine::DefineObjConst(int nObjDefnID,
v8::Local<v8::Value> pDefault) {
v8::Isolate::Scope isolate_scope(m_isolate);
v8::HandleScope handle_scope(m_isolate);
- CFX_ByteString bsConstName = CFX_WideString(sConstName).UTF8Encode();
+ CFX_ByteString bsConstName = FX_UTF8Encode(CFX_WideStringC(sConstName));
CFXJS_ObjDefinition* pObjDef =
CFXJS_ObjDefinition::ForID(m_isolate, nObjDefnID);
pObjDef->GetInstanceTemplate()->Set(m_isolate, bsConstName.c_str(), pDefault);
@@ -332,7 +332,7 @@ void CFXJS_Engine::DefineGlobalMethod(const wchar_t* sMethodName,
v8::FunctionCallback pMethodCall) {
v8::Isolate::Scope isolate_scope(m_isolate);
v8::HandleScope handle_scope(m_isolate);
- CFX_ByteString bsMethodName = CFX_WideString(sMethodName).UTF8Encode();
+ CFX_ByteString bsMethodName = FX_UTF8Encode(CFX_WideStringC(sMethodName));
v8::Local<v8::FunctionTemplate> fun =
v8::FunctionTemplate::New(m_isolate, pMethodCall);
fun->RemovePrototype();
@@ -347,7 +347,7 @@ void CFXJS_Engine::DefineGlobalConst(const wchar_t* sConstName,
v8::FunctionCallback pConstGetter) {
v8::Isolate::Scope isolate_scope(m_isolate);
v8::HandleScope handle_scope(m_isolate);
- CFX_ByteString bsConst = CFX_WideString(sConstName).UTF8Encode();
+ CFX_ByteString bsConst = FX_UTF8Encode(CFX_WideStringC(sConstName));
v8::Local<v8::FunctionTemplate> fun =
v8::FunctionTemplate::New(m_isolate, pConstGetter);
fun->RemovePrototype();
@@ -392,7 +392,7 @@ void CFXJS_Engine::InitializeEngine() {
->ToObject(v8Context)
.ToLocalChecked());
} else if (pObjDef->m_ObjType == FXJSOBJTYPE_STATIC) {
- CFX_ByteString bs = CFX_WideString(pObjDef->m_ObjName).UTF8Encode();
+ 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())