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

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

Issue 1318343004: Merge to XFA: CJS_Context::compile unused (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 delete pArray; 366 delete pArray;
367 isolate->SetData(1, NULL); 367 isolate->SetData(1, NULL);
368 isolate->SetData(g_embedderDataSlot, NULL); 368 isolate->SetData(g_embedderDataSlot, NULL);
369 // TODO(tsepez): Don't use more than one embedder data slot. 369 // TODO(tsepez): Don't use more than one embedder data slot.
370 isolate->SetData(2, NULL); 370 isolate->SetData(2, NULL);
371 } 371 }
372 372
373 void JS_Initial(unsigned int embedderDataSlot) { 373 void JS_Initial(unsigned int embedderDataSlot) {
374 g_embedderDataSlot = embedderDataSlot; 374 g_embedderDataSlot = embedderDataSlot;
375 } 375 }
376 void JS_Release() {}
377 int JS_Parse(IJS_Runtime* pJSRuntime,
378 IFXJS_Context* pJSContext,
379 const wchar_t* script,
380 long length,
381 FXJSErr* perror) {
382 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime;
383 v8::Isolate::Scope isolate_scope(isolate);
384 v8::TryCatch try_catch(isolate);
385 376
386 CFX_WideString wsScript(script); 377 void JS_Release() {
387 CFX_ByteString bsScript = wsScript.UTF8Encode();
388
389 v8::Local<v8::Context> context = isolate->GetCurrentContext();
390 v8::Local<v8::Script> compiled_script;
391 if (!v8::Script::Compile(context,
392 v8::String::NewFromUtf8(isolate, bsScript.c_str(),
393 v8::NewStringType::kNormal,
394 bsScript.GetLength())
395 .ToLocalChecked())
396 .ToLocal(&compiled_script)) {
397 v8::String::Utf8Value error(try_catch.Exception());
398 return -1;
399 }
400 return 0;
401 } 378 }
402 379
403 int JS_Execute(IJS_Runtime* pJSRuntime, 380 int JS_Execute(IJS_Runtime* pJSRuntime,
404 IFXJS_Context* pJSContext, 381 IFXJS_Context* pJSContext,
405 const wchar_t* script, 382 const wchar_t* script,
406 long length, 383 long length,
407 FXJSErr* perror) { 384 FXJSErr* perror) {
408 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; 385 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime;
409 v8::Isolate::Scope isolate_scope(isolate); 386 v8::Isolate::Scope isolate_scope(isolate);
410 v8::TryCatch try_catch(isolate); 387 v8::TryCatch try_catch(isolate);
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 1154
1178 bool JS_PortIsNan(double d) { 1155 bool JS_PortIsNan(double d) {
1179 return d != d; 1156 return d != d;
1180 } 1157 }
1181 1158
1182 double JS_LocalTime(double d) { 1159 double JS_LocalTime(double d) {
1183 return JS_GetDateTime() + _getDaylightSavingTA(d); 1160 return JS_GetDateTime() + _getDaylightSavingTA(d);
1184 } 1161 }
1185 1162
1186 // JavaScript time implement End. 1163 // 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