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

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

Issue 1357243002: Merge to XFA:More tidy of CJS_Object, kill implicit cast operator (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_Object.cpp ('k') | fpdfsdk/src/javascript/global.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 <time.h> 7 #include <time.h>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 CJS_Value::CJS_Value(v8::Isolate* isolate, CJS_Object* pJsObj) 55 CJS_Value::CJS_Value(v8::Isolate* isolate, CJS_Object* pJsObj)
56 : m_isolate(isolate) { 56 : m_isolate(isolate) {
57 operator=(pJsObj); 57 operator=(pJsObj);
58 } 58 }
59 59
60 CJS_Value::CJS_Value(v8::Isolate* isolate, CJS_Document* pJsDoc) 60 CJS_Value::CJS_Value(v8::Isolate* isolate, CJS_Document* pJsDoc)
61 : m_isolate(isolate) { 61 : m_isolate(isolate) {
62 m_eType = VT_object; 62 m_eType = VT_object;
63 if (pJsDoc) 63 if (pJsDoc)
64 m_pValue = (v8::Local<v8::Object>)*pJsDoc; 64 m_pValue = pJsDoc->ToV8Object();
65 } 65 }
66 66
67 CJS_Value::CJS_Value(v8::Isolate* isolate, const FX_WCHAR* pWstr) 67 CJS_Value::CJS_Value(v8::Isolate* isolate, const FX_WCHAR* pWstr)
68 : m_isolate(isolate) { 68 : m_isolate(isolate) {
69 operator=(pWstr); 69 operator=(pWstr);
70 } 70 }
71 71
72 CJS_Value::CJS_Value(v8::Isolate* isolate, const FX_CHAR* pStr) 72 CJS_Value::CJS_Value(v8::Isolate* isolate, const FX_CHAR* pStr)
73 : m_isolate(isolate) { 73 : m_isolate(isolate) {
74 operator=(pStr); 74 operator=(pStr);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 m_eType = VT_number; 165 m_eType = VT_number;
166 } 166 }
167 167
168 void CJS_Value::operator=(v8::Local<v8::Object> pObj) { 168 void CJS_Value::operator=(v8::Local<v8::Object> pObj) {
169 m_pValue = FXJS_NewObject(m_isolate, pObj); 169 m_pValue = FXJS_NewObject(m_isolate, pObj);
170 m_eType = VT_fxobject; 170 m_eType = VT_fxobject;
171 } 171 }
172 172
173 void CJS_Value::operator=(CJS_Object* pObj) { 173 void CJS_Value::operator=(CJS_Object* pObj) {
174 if (pObj) 174 if (pObj)
175 operator=((v8::Local<v8::Object>)*pObj); 175 operator=(pObj->ToV8Object());
176 } 176 }
177 177
178 void CJS_Value::operator=(CJS_Document* pJsDoc) { 178 void CJS_Value::operator=(CJS_Document* pJsDoc) {
179 m_eType = VT_object; 179 m_eType = VT_object;
180 if (pJsDoc) { 180 if (pJsDoc) {
181 m_pValue = static_cast<v8::Local<v8::Object>>(*pJsDoc); 181 m_pValue = pJsDoc->ToV8Object();
182 } 182 }
183 } 183 }
184 184
185 void CJS_Value::operator=(const FX_WCHAR* pWstr) { 185 void CJS_Value::operator=(const FX_WCHAR* pWstr) {
186 m_pValue = FXJS_NewString(m_isolate, (wchar_t*)pWstr); 186 m_pValue = FXJS_NewString(m_isolate, (wchar_t*)pWstr);
187 m_eType = VT_string; 187 m_eType = VT_string;
188 } 188 }
189 189
190 void CJS_Value::SetNull() { 190 void CJS_Value::SetNull() {
191 m_pValue = FXJS_NewNull(); 191 m_pValue = FXJS_NewNull();
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 return day * 86400000 + time; 857 return day * 86400000 + time;
858 } 858 }
859 859
860 bool JS_PortIsNan(double d) { 860 bool JS_PortIsNan(double d) {
861 return d != d; 861 return d != d;
862 } 862 }
863 863
864 double JS_LocalTime(double d) { 864 double JS_LocalTime(double d) {
865 return JS_GetDateTime() + _getDaylightSavingTA(d); 865 return JS_GetDateTime() + _getDaylightSavingTA(d);
866 } 866 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/JS_Object.cpp ('k') | fpdfsdk/src/javascript/global.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698