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

Side by Side Diff: fpdfsdk/src/javascript/JS_Value.cpp

Issue 1334833003: Merge to XFA: Remove some abstractions in fxjs_v8.h. (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_Runtime.cpp ('k') | fpdfsdk/src/javascript/app.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 "../../include/javascript/JavaScript.h" 7 #include "../../include/javascript/JavaScript.h"
8 #include "../../include/javascript/JS_Define.h" 8 #include "../../include/javascript/JS_Define.h"
9 #include "../../include/javascript/JS_Object.h" 9 #include "../../include/javascript/JS_Object.h"
10 #include "../../include/javascript/JS_Value.h" 10 #include "../../include/javascript/JS_Value.h"
(...skipping 21 matching lines...) Expand all
32 CJS_Value::CJS_Value(v8::Isolate* isolate, const float& fValue) 32 CJS_Value::CJS_Value(v8::Isolate* isolate, const float& fValue)
33 : m_isolate(isolate) { 33 : m_isolate(isolate) {
34 operator=(fValue); 34 operator=(fValue);
35 } 35 }
36 36
37 CJS_Value::CJS_Value(v8::Isolate* isolate, const double& dValue) 37 CJS_Value::CJS_Value(v8::Isolate* isolate, const double& dValue)
38 : m_isolate(isolate) { 38 : m_isolate(isolate) {
39 operator=(dValue); 39 operator=(dValue);
40 } 40 }
41 41
42 CJS_Value::CJS_Value(v8::Isolate* isolate, JSFXObject pJsObj) 42 CJS_Value::CJS_Value(v8::Isolate* isolate, v8::Local<v8::Object> pJsObj)
43 : m_isolate(isolate) { 43 : m_isolate(isolate) {
44 operator=(pJsObj); 44 operator=(pJsObj);
45 } 45 }
46 46
47 CJS_Value::CJS_Value(v8::Isolate* isolate, CJS_Object* pJsObj) 47 CJS_Value::CJS_Value(v8::Isolate* isolate, CJS_Object* pJsObj)
48 : m_isolate(isolate) { 48 : m_isolate(isolate) {
49 operator=(pJsObj); 49 operator=(pJsObj);
50 } 50 }
51 51
52 CJS_Value::CJS_Value(v8::Isolate* isolate, CJS_Document* pJsDoc) 52 CJS_Value::CJS_Value(v8::Isolate* isolate, CJS_Document* pJsDoc)
53 : m_isolate(isolate) { 53 : m_isolate(isolate) {
54 m_eType = VT_object; 54 m_eType = VT_object;
55 if (pJsDoc) 55 if (pJsDoc)
56 m_pValue = (JSFXObject)*pJsDoc; 56 m_pValue = (v8::Local<v8::Object>)*pJsDoc;
57 } 57 }
58 58
59 CJS_Value::CJS_Value(v8::Isolate* isolate, const FX_WCHAR* pWstr) 59 CJS_Value::CJS_Value(v8::Isolate* isolate, const FX_WCHAR* pWstr)
60 : m_isolate(isolate) { 60 : m_isolate(isolate) {
61 operator=(pWstr); 61 operator=(pWstr);
62 } 62 }
63 63
64 CJS_Value::CJS_Value(v8::Isolate* isolate, const FX_CHAR* pStr) 64 CJS_Value::CJS_Value(v8::Isolate* isolate, const FX_CHAR* pStr)
65 : m_isolate(isolate) { 65 : m_isolate(isolate) {
66 operator=(pStr); 66 operator=(pStr);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 161 }
162 162
163 void CJS_Value::operator=(v8::Local<v8::Object> pObj) { 163 void CJS_Value::operator=(v8::Local<v8::Object> pObj) {
164 m_pValue = JS_NewObject(m_isolate, pObj); 164 m_pValue = JS_NewObject(m_isolate, pObj);
165 165
166 m_eType = VT_fxobject; 166 m_eType = VT_fxobject;
167 } 167 }
168 168
169 void CJS_Value::operator=(CJS_Object* pObj) { 169 void CJS_Value::operator=(CJS_Object* pObj) {
170 if (pObj) 170 if (pObj)
171 operator=((JSFXObject)*pObj); 171 operator=((v8::Local<v8::Object>)*pObj);
172 } 172 }
173 173
174 void CJS_Value::operator=(CJS_Document* pJsDoc) { 174 void CJS_Value::operator=(CJS_Document* pJsDoc) {
175 m_eType = VT_object; 175 m_eType = VT_object;
176 if (pJsDoc) { 176 if (pJsDoc) {
177 m_pValue = static_cast<JSFXObject>(*pJsDoc); 177 m_pValue = static_cast<v8::Local<v8::Object>>(*pJsDoc);
178 } 178 }
179 } 179 }
180 180
181 void CJS_Value::operator=(const FX_WCHAR* pWstr) { 181 void CJS_Value::operator=(const FX_WCHAR* pWstr) {
182 m_pValue = JS_NewString(m_isolate, (wchar_t*)pWstr); 182 m_pValue = JS_NewString(m_isolate, (wchar_t*)pWstr);
183 183
184 m_eType = VT_string; 184 m_eType = VT_string;
185 } 185 }
186 186
187 void CJS_Value::SetNull() { 187 void CJS_Value::SetNull() {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 void CJS_PropValue::operator<<(CJS_Document* pJsDoc) { 334 void CJS_PropValue::operator<<(CJS_Document* pJsDoc) {
335 ASSERT(!m_bIsSetting); 335 ASSERT(!m_bIsSetting);
336 CJS_Value::operator=(pJsDoc); 336 CJS_Value::operator=(pJsDoc);
337 } 337 }
338 338
339 void CJS_PropValue::operator>>(CJS_Document*& ppJsDoc) const { 339 void CJS_PropValue::operator>>(CJS_Document*& ppJsDoc) const {
340 ASSERT(m_bIsSetting); 340 ASSERT(m_bIsSetting);
341 ppJsDoc = static_cast<CJS_Document*>(CJS_Value::ToCJSObject()); 341 ppJsDoc = static_cast<CJS_Document*>(CJS_Value::ToCJSObject());
342 } 342 }
343 343
344 void CJS_PropValue::operator<<(JSFXObject pObj) { 344 void CJS_PropValue::operator<<(v8::Local<v8::Object> pObj) {
345 ASSERT(!m_bIsSetting); 345 ASSERT(!m_bIsSetting);
346 CJS_Value::operator=(pObj); 346 CJS_Value::operator=(pObj);
347 } 347 }
348 348
349 void CJS_PropValue::operator>>(JSFXObject& ppObj) const { 349 void CJS_PropValue::operator>>(v8::Local<v8::Object>& ppObj) const {
350 ASSERT(m_bIsSetting); 350 ASSERT(m_bIsSetting);
351 ppObj = CJS_Value::ToV8Object(); 351 ppObj = CJS_Value::ToV8Object();
352 } 352 }
353 353
354 void CJS_PropValue::StartSetting() { 354 void CJS_PropValue::StartSetting() {
355 m_bIsSetting = 1; 355 m_bIsSetting = 1;
356 } 356 }
357 357
358 void CJS_PropValue::StartGetting() { 358 void CJS_PropValue::StartGetting() {
359 m_bIsSetting = 0; 359 m_bIsSetting = 0;
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 if (m_pDate.IsEmpty()) 579 if (m_pDate.IsEmpty())
580 return 0.0; 580 return 0.0;
581 return JS_ToNumber(m_isolate, m_pDate); 581 return JS_ToNumber(m_isolate, m_pDate);
582 } 582 }
583 583
584 CFX_WideString CJS_Date::ToString() const { 584 CFX_WideString CJS_Date::ToString() const {
585 if (m_pDate.IsEmpty()) 585 if (m_pDate.IsEmpty())
586 return L""; 586 return L"";
587 return JS_ToString(m_isolate, m_pDate); 587 return JS_ToString(m_isolate, m_pDate);
588 } 588 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/JS_Runtime.cpp ('k') | fpdfsdk/src/javascript/app.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698