Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: fpdfsdk/javascript/cjs_runtime.cpp

Issue 1857713003: Rename GetCStr and GetPtr to match CFX_ByteString (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp ('k') | xfa/fde/css/fde_csscache.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "fpdfsdk/javascript/cjs_runtime.h" 7 #include "fpdfsdk/javascript/cjs_runtime.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 256
257 #ifdef PDF_ENABLE_XFA 257 #ifdef PDF_ENABLE_XFA
258 CFX_WideString ChangeObjName(const CFX_WideString& str) { 258 CFX_WideString ChangeObjName(const CFX_WideString& str) {
259 CFX_WideString sRet = str; 259 CFX_WideString sRet = str;
260 sRet.Replace(L"_", L"."); 260 sRet.Replace(L"_", L".");
261 return sRet; 261 return sRet;
262 } 262 }
263 FX_BOOL CJS_Runtime::GetHValueByName(const CFX_ByteStringC& utf8Name, 263 FX_BOOL CJS_Runtime::GetHValueByName(const CFX_ByteStringC& utf8Name,
264 FXJSE_HVALUE hValue) { 264 FXJSE_HVALUE hValue) {
265 #ifdef PDF_ENABLE_XFA 265 #ifdef PDF_ENABLE_XFA
266 const FX_CHAR* name = utf8Name.GetCStr(); 266 const FX_CHAR* name = utf8Name.c_str();
267 267
268 v8::Locker lock(GetIsolate()); 268 v8::Locker lock(GetIsolate());
269 v8::Isolate::Scope isolate_scope(GetIsolate()); 269 v8::Isolate::Scope isolate_scope(GetIsolate());
270 v8::HandleScope handle_scope(GetIsolate()); 270 v8::HandleScope handle_scope(GetIsolate());
271 v8::Local<v8::Context> old_context = GetIsolate()->GetCurrentContext(); 271 v8::Local<v8::Context> old_context = GetIsolate()->GetCurrentContext();
272 v8::Local<v8::Context> context = 272 v8::Local<v8::Context> context =
273 v8::Local<v8::Context>::New(GetIsolate(), m_context); 273 v8::Local<v8::Context>::New(GetIsolate(), m_context);
274 v8::Context::Scope context_scope(context); 274 v8::Context::Scope context_scope(context);
275 275
276 // Caution: We're about to hand to XFA an object that in order to invoke 276 // Caution: We're about to hand to XFA an object that in order to invoke
(...skipping 16 matching lines...) Expand all
293 ((CFXJSE_Value*)hValue)->ForceSetValue(propvalue); 293 ((CFXJSE_Value*)hValue)->ForceSetValue(propvalue);
294 #endif 294 #endif
295 295
296 return TRUE; 296 return TRUE;
297 } 297 }
298 FX_BOOL CJS_Runtime::SetHValueByName(const CFX_ByteStringC& utf8Name, 298 FX_BOOL CJS_Runtime::SetHValueByName(const CFX_ByteStringC& utf8Name,
299 FXJSE_HVALUE hValue) { 299 FXJSE_HVALUE hValue) {
300 #ifdef PDF_ENABLE_XFA 300 #ifdef PDF_ENABLE_XFA
301 if (utf8Name.IsEmpty() || hValue == NULL) 301 if (utf8Name.IsEmpty() || hValue == NULL)
302 return FALSE; 302 return FALSE;
303 const FX_CHAR* name = utf8Name.GetCStr(); 303 const FX_CHAR* name = utf8Name.c_str();
304 v8::Isolate* pIsolate = GetIsolate(); 304 v8::Isolate* pIsolate = GetIsolate();
305 v8::Locker lock(pIsolate); 305 v8::Locker lock(pIsolate);
306 v8::Isolate::Scope isolate_scope(pIsolate); 306 v8::Isolate::Scope isolate_scope(pIsolate);
307 v8::HandleScope handle_scope(pIsolate); 307 v8::HandleScope handle_scope(pIsolate);
308 v8::Local<v8::Context> context = 308 v8::Local<v8::Context> context =
309 v8::Local<v8::Context>::New(pIsolate, m_context); 309 v8::Local<v8::Context>::New(pIsolate, m_context);
310 v8::Context::Scope context_scope(context); 310 v8::Context::Scope context_scope(context);
311 311
312 // v8::Local<v8::Context> tmpCotext = 312 // v8::Local<v8::Context> tmpCotext =
313 // v8::Local<v8::Context>::New(GetIsolate(), m_context); 313 // v8::Local<v8::Context>::New(GetIsolate(), m_context);
(...skipping 10 matching lines...) Expand all
324 #endif 324 #endif
325 void CJS_Runtime::AddObserver(Observer* observer) { 325 void CJS_Runtime::AddObserver(Observer* observer) {
326 ASSERT(!pdfium::ContainsKey(m_observers, observer)); 326 ASSERT(!pdfium::ContainsKey(m_observers, observer));
327 m_observers.insert(observer); 327 m_observers.insert(observer);
328 } 328 }
329 329
330 void CJS_Runtime::RemoveObserver(Observer* observer) { 330 void CJS_Runtime::RemoveObserver(Observer* observer) {
331 ASSERT(pdfium::ContainsKey(m_observers, observer)); 331 ASSERT(pdfium::ContainsKey(m_observers, observer));
332 m_observers.erase(observer); 332 m_observers.erase(observer);
333 } 333 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp ('k') | xfa/fde/css/fde_csscache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698