Remove the CJS_Value To* methods.

This CL removes all of the To* methods on the CJS classes except for
ToV8Value.

Change-Id: If01263c8cfa557ef7b00f573ddbf68b591d5ae9a
Reviewed-on: https://pdfium-review.googlesource.com/16614
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
diff --git a/fpdfsdk/javascript/JS_Value.cpp b/fpdfsdk/javascript/JS_Value.cpp
index fcf913a..35a5b1c 100644
--- a/fpdfsdk/javascript/JS_Value.cpp
+++ b/fpdfsdk/javascript/JS_Value.cpp
@@ -190,66 +190,15 @@
   m_pValue = pValue;
 }
 
-int CJS_Value::ToInt(CJS_Runtime* pRuntime) const {
-  return pRuntime->ToInt32(m_pValue);
-}
-
-bool CJS_Value::ToBool(CJS_Runtime* pRuntime) const {
-  return pRuntime->ToBoolean(m_pValue);
-}
-
-double CJS_Value::ToDouble(CJS_Runtime* pRuntime) const {
-  return pRuntime->ToDouble(m_pValue);
-}
-
-float CJS_Value::ToFloat(CJS_Runtime* pRuntime) const {
-  return static_cast<float>(ToDouble(pRuntime));
-}
-
-CJS_Object* CJS_Value::ToObject(CJS_Runtime* pRuntime) const {
-  v8::Local<v8::Object> pObj = pRuntime->ToObject(m_pValue);
-  return static_cast<CJS_Object*>(pRuntime->GetObjectPrivate(pObj));
-}
-
-CJS_Document* CJS_Value::ToDocument(CJS_Runtime* pRuntime) const {
-  return static_cast<CJS_Document*>(ToObject(pRuntime));
-}
-
-CJS_Array CJS_Value::ToArray(CJS_Runtime* pRuntime) const {
-  ASSERT(IsArrayObject());
-  return CJS_Array(pRuntime->ToArray(m_pValue));
-}
-
-CJS_Date CJS_Value::ToDate() const {
-  ASSERT(IsDateObject());
-  v8::Local<v8::Value> mutable_value = m_pValue;
-  return CJS_Date(mutable_value.As<v8::Date>());
-}
-
-v8::Local<v8::Object> CJS_Value::ToV8Object(CJS_Runtime* pRuntime) const {
-  return pRuntime->ToObject(m_pValue);
-}
-
-WideString CJS_Value::ToWideString(CJS_Runtime* pRuntime) const {
-  return pRuntime->ToWideString(m_pValue);
-}
-
-ByteString CJS_Value::ToByteString(CJS_Runtime* pRuntime) const {
-  return ByteString::FromUnicode(ToWideString(pRuntime));
-}
-
 v8::Local<v8::Value> CJS_Value::ToV8Value() const {
   return m_pValue;
 }
 
-v8::Local<v8::Array> CJS_Value::ToV8Array(CJS_Runtime* pRuntime) const {
-  return pRuntime->ToArray(m_pValue);
-}
-
 void CJS_Value::MaybeCoerceToNumber(CJS_Runtime* pRuntime) {
   bool bAllowNaN = false;
   if (GetType() == VT_string) {
-    ByteString bstr = ToByteString(pRuntime);
+    ByteString bstr =
+        ByteString::FromUnicode(pRuntime->ToWideString(ToV8Value()));
     if (bstr.GetLength() == 0)
       return;
     if (bstr == "NaN")
@@ -326,13 +275,6 @@
   return pRuntime->GetArrayLength(m_pArray);
 }
 
-v8::Local<v8::Array> CJS_Array::ToV8Array(CJS_Runtime* pRuntime) const {
-  if (m_pArray.IsEmpty())
-    m_pArray = pRuntime->NewArray();
-
-  return m_pArray;
-}
-
 CJS_Date::CJS_Date() {}
 
 CJS_Date::CJS_Date(v8::Local<v8::Date> pDate) : m_pDate(pDate) {}
@@ -398,10 +340,6 @@
   return JS_GetSecFromTime(JS_LocalTime(pRuntime->ToDouble(m_pDate)));
 }
 
-v8::Local<v8::Date> CJS_Date::ToV8Date() const {
-  return m_pDate;
-}
-
 double JS_GetDateTime() {
   if (!FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS))
     return 0;
@@ -522,7 +460,7 @@
       originals[0].IsArrayObject()) {
     return result;
   }
-  v8::Local<v8::Object> pObj = originals[0].ToV8Object(pRuntime);
+  v8::Local<v8::Object> pObj = pRuntime->ToObject(originals[0].ToV8Value());
   result[0] = CJS_Value();  // Make unknown.
 
   va_list ap;