diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-04-17 21:23:58 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-17 21:23:58 +0000 |
commit | 35939f83e45b67de4ccc8c3e70e5e00be40326b6 (patch) | |
tree | 9f9745d8f9202be75498690968391b39c04da9a6 /fxjs | |
parent | aed62531a9b08deb236cc423dc27dbe0810d6d1a (diff) | |
download | pdfium-35939f83e45b67de4ccc8c3e70e5e00be40326b6.tar.xz |
Avoid some string -> ptr -> string duplicate allocations in FF Environment
Change-Id: I4bd89b64cd77a4e2fe0ffc2dcc415cc8fe34667a
Reviewed-on: https://pdfium-review.googlesource.com/30871
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs')
-rw-r--r-- | fxjs/cjs_app.cpp | 12 | ||||
-rw-r--r-- | fxjs/cjs_document.cpp | 8 | ||||
-rw-r--r-- | fxjs/cjs_publicmethods.cpp | 2 |
3 files changed, 9 insertions, 13 deletions
diff --git a/fxjs/cjs_app.cpp b/fxjs/cjs_app.cpp index 5bd41e8bc0..35bdc32dc1 100644 --- a/fxjs/cjs_app.cpp +++ b/fxjs/cjs_app.cpp @@ -263,9 +263,8 @@ CJS_Return CJS_App::alert(CJS_Runtime* pRuntime, pRuntime->BeginBlock(); pFormFillEnv->KillFocusAnnot(0); - v8::Local<v8::Value> ret = pRuntime->NewNumber( - pFormFillEnv->JS_appAlert(swMsg.c_str(), swTitle.c_str(), iType, iIcon)); + pFormFillEnv->JS_appAlert(swMsg, swTitle, iType, iIcon)); pRuntime->EndBlock(); return CJS_Return(ret); @@ -466,9 +465,8 @@ CJS_Return CJS_App::mailMsg(CJS_Runtime* pRuntime, cMsg = pRuntime->ToWideString(newParams[5]); pRuntime->BeginBlock(); - pRuntime->GetFormFillEnv()->JS_docmailForm(nullptr, 0, bUI, cTo.c_str(), - cSubject.c_str(), cCc.c_str(), - cBcc.c_str(), cMsg.c_str()); + pRuntime->GetFormFillEnv()->JS_docmailForm(nullptr, 0, bUI, cTo, cSubject, + cCc, cBcc, cMsg); pRuntime->EndBlock(); return CJS_Return(true); } @@ -558,8 +556,8 @@ CJS_Return CJS_App::response(CJS_Runtime* pRuntime, const int MAX_INPUT_BYTES = 2048; std::vector<uint8_t> pBuff(MAX_INPUT_BYTES + 2); int nLengthBytes = pRuntime->GetFormFillEnv()->JS_appResponse( - swQuestion.c_str(), swTitle.c_str(), swDefault.c_str(), swLabel.c_str(), - bPassword, pBuff.data(), MAX_INPUT_BYTES); + swQuestion, swTitle, swDefault, swLabel, bPassword, pBuff.data(), + MAX_INPUT_BYTES); if (nLengthBytes < 0 || nLengthBytes > MAX_INPUT_BYTES) return CJS_Return(JSGetStringFromID(JSMessage::kParamTooLongError)); diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp index 2a36b61a4a..248116b69a 100644 --- a/fxjs/cjs_document.cpp +++ b/fxjs/cjs_document.cpp @@ -338,9 +338,8 @@ CJS_Return CJS_Document::mailForm( pRuntime->BeginBlock(); CPDFSDK_FormFillEnvironment* pFormFillEnv = pRuntime->GetFormFillEnv(); - pFormFillEnv->JS_docmailForm(pMutableBuf, nBufSize, bUI, cTo.c_str(), - cSubject.c_str(), cCc.c_str(), cBcc.c_str(), - cMsg.c_str()); + pFormFillEnv->JS_docmailForm(pMutableBuf, nBufSize, bUI, cTo, cSubject, cCc, + cBcc, cMsg); pRuntime->EndBlock(); FX_Free(pMutableBuf); return CJS_Return(true); @@ -639,8 +638,7 @@ CJS_Return CJS_Document::mailDoc( pRuntime->BeginBlock(); CPDFSDK_FormFillEnvironment* pFormFillEnv = pRuntime->GetFormFillEnv(); - pFormFillEnv->JS_docmailForm(nullptr, 0, bUI, cTo.c_str(), cSubject.c_str(), - cCc.c_str(), cBcc.c_str(), cMsg.c_str()); + pFormFillEnv->JS_docmailForm(nullptr, 0, bUI, cTo, cSubject, cCc, cBcc, cMsg); pRuntime->EndBlock(); return CJS_Return(true); } diff --git a/fxjs/cjs_publicmethods.cpp b/fxjs/cjs_publicmethods.cpp index 8dc69c4a00..6f49940494 100644 --- a/fxjs/cjs_publicmethods.cpp +++ b/fxjs/cjs_publicmethods.cpp @@ -81,7 +81,7 @@ T StrTrim(const T& str) { void AlertIfPossible(CJS_EventContext* pContext, const wchar_t* swMsg) { CPDFSDK_FormFillEnvironment* pFormFillEnv = pContext->GetFormFillEnv(); if (pFormFillEnv) - pFormFillEnv->JS_appAlert(swMsg, nullptr, 0, 3); + pFormFillEnv->JS_appAlert(swMsg, WideString(), 0, 3); } #if _FX_OS_ != _FX_OS_ANDROID_ |