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

Side by Side Diff: fpdfsdk/src/jsapi/fxjs_v8.cpp

Issue 1318543012: CJS_Context::compile unused (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Remove pointless asserts. Created 5 years, 3 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/src/javascript/JS_Context.cpp ('k') | no next file » | 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 "../../../core/include/fxcrt/fx_basic.h" 7 #include "../../../core/include/fxcrt/fx_basic.h"
8 #include "../../../core/include/fxcrt/fx_ext.h" 8 #include "../../../core/include/fxcrt/fx_ext.h"
9 #include "../../include/jsapi/fxjs_v8.h" 9 #include "../../include/jsapi/fxjs_v8.h"
10 #include "../../include/fsdk_define.h" 10 #include "../../include/fsdk_define.h"
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 } 361 }
362 delete pObjDef; 362 delete pObjDef;
363 } 363 }
364 delete pArray; 364 delete pArray;
365 isolate->SetData(g_embedderDataSlot, NULL); 365 isolate->SetData(g_embedderDataSlot, NULL);
366 } 366 }
367 367
368 void JS_Initial(unsigned int embedderDataSlot) { 368 void JS_Initial(unsigned int embedderDataSlot) {
369 g_embedderDataSlot = embedderDataSlot; 369 g_embedderDataSlot = embedderDataSlot;
370 } 370 }
371 void JS_Release() {}
372 int JS_Parse(IJS_Runtime* pJSRuntime,
373 IFXJS_Context* pJSContext,
374 const wchar_t* script,
375 long length,
376 FXJSErr* perror) {
377 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime;
378 v8::Isolate::Scope isolate_scope(isolate);
379 v8::TryCatch try_catch(isolate);
380 371
381 CFX_WideString wsScript(script); 372 void JS_Release() {
382 CFX_ByteString bsScript = wsScript.UTF8Encode();
383
384 v8::Local<v8::Context> context = isolate->GetCurrentContext();
385 v8::Local<v8::Script> compiled_script;
386 if (!v8::Script::Compile(context,
387 v8::String::NewFromUtf8(isolate, bsScript.c_str(),
388 v8::NewStringType::kNormal,
389 bsScript.GetLength())
390 .ToLocalChecked())
391 .ToLocal(&compiled_script)) {
392 v8::String::Utf8Value error(try_catch.Exception());
393 return -1;
394 }
395 return 0;
396 } 373 }
397 374
398 int JS_Execute(IJS_Runtime* pJSRuntime, 375 int JS_Execute(IJS_Runtime* pJSRuntime,
399 IFXJS_Context* pJSContext, 376 IFXJS_Context* pJSContext,
400 const wchar_t* script, 377 const wchar_t* script,
401 long length, 378 long length,
402 FXJSErr* perror) { 379 FXJSErr* perror) {
403 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; 380 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime;
404 v8::Isolate::Scope isolate_scope(isolate); 381 v8::Isolate::Scope isolate_scope(isolate);
405 v8::TryCatch try_catch(isolate); 382 v8::TryCatch try_catch(isolate);
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 1149
1173 bool JS_PortIsNan(double d) { 1150 bool JS_PortIsNan(double d) {
1174 return d != d; 1151 return d != d;
1175 } 1152 }
1176 1153
1177 double JS_LocalTime(double d) { 1154 double JS_LocalTime(double d) {
1178 return JS_GetDateTime() + _getDaylightSavingTA(d); 1155 return JS_GetDateTime() + _getDaylightSavingTA(d);
1179 } 1156 }
1180 1157
1181 // JavaScript time implement End. 1158 // JavaScript time implement End.
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/JS_Context.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698