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

Side by Side Diff: fxjs/cfxjse_arguments.cpp

Issue 2471353002: Remove FX_BOOL entirely. (Closed)
Patch Set: Fix nits now rather than later Created 4 years, 1 month 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 | « fxjs/cfxjse_arguments.h ('k') | fxjs/cfxjse_class.h » ('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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 "fxjs/cfxjse_arguments.h" 7 #include "fxjs/cfxjse_arguments.h"
8 8
9 #include "fxjs/cfxjse_context.h" 9 #include "fxjs/cfxjse_context.h"
10 #include "fxjs/cfxjse_value.h" 10 #include "fxjs/cfxjse_value.h"
11 11
12 v8::Isolate* CFXJSE_Arguments::GetRuntime() const { 12 v8::Isolate* CFXJSE_Arguments::GetRuntime() const {
13 return m_pRetValue->GetIsolate(); 13 return m_pRetValue->GetIsolate();
14 } 14 }
15 15
16 int32_t CFXJSE_Arguments::GetLength() const { 16 int32_t CFXJSE_Arguments::GetLength() const {
17 return m_pInfo->Length(); 17 return m_pInfo->Length();
18 } 18 }
19 19
20 std::unique_ptr<CFXJSE_Value> CFXJSE_Arguments::GetValue(int32_t index) const { 20 std::unique_ptr<CFXJSE_Value> CFXJSE_Arguments::GetValue(int32_t index) const {
21 std::unique_ptr<CFXJSE_Value> lpArgValue( 21 std::unique_ptr<CFXJSE_Value> lpArgValue(
22 new CFXJSE_Value(v8::Isolate::GetCurrent())); 22 new CFXJSE_Value(v8::Isolate::GetCurrent()));
23 lpArgValue->ForceSetValue((*m_pInfo)[index]); 23 lpArgValue->ForceSetValue((*m_pInfo)[index]);
24 return lpArgValue; 24 return lpArgValue;
25 } 25 }
26 26
27 FX_BOOL CFXJSE_Arguments::GetBoolean(int32_t index) const { 27 bool CFXJSE_Arguments::GetBoolean(int32_t index) const {
28 return (*m_pInfo)[index]->BooleanValue(); 28 return (*m_pInfo)[index]->BooleanValue();
29 } 29 }
30 30
31 int32_t CFXJSE_Arguments::GetInt32(int32_t index) const { 31 int32_t CFXJSE_Arguments::GetInt32(int32_t index) const {
32 return static_cast<int32_t>((*m_pInfo)[index]->NumberValue()); 32 return static_cast<int32_t>((*m_pInfo)[index]->NumberValue());
33 } 33 }
34 34
35 FX_FLOAT CFXJSE_Arguments::GetFloat(int32_t index) const { 35 FX_FLOAT CFXJSE_Arguments::GetFloat(int32_t index) const {
36 return static_cast<FX_FLOAT>((*m_pInfo)[index]->NumberValue()); 36 return static_cast<FX_FLOAT>((*m_pInfo)[index]->NumberValue());
37 } 37 }
38 38
39 CFX_ByteString CFXJSE_Arguments::GetUTF8String(int32_t index) const { 39 CFX_ByteString CFXJSE_Arguments::GetUTF8String(int32_t index) const {
40 v8::Local<v8::String> hString = (*m_pInfo)[index]->ToString(); 40 v8::Local<v8::String> hString = (*m_pInfo)[index]->ToString();
41 v8::String::Utf8Value szStringVal(hString); 41 v8::String::Utf8Value szStringVal(hString);
42 return CFX_ByteString(*szStringVal); 42 return CFX_ByteString(*szStringVal);
43 } 43 }
44 44
45 CFXJSE_HostObject* CFXJSE_Arguments::GetObject(int32_t index, 45 CFXJSE_HostObject* CFXJSE_Arguments::GetObject(int32_t index,
46 CFXJSE_Class* pClass) const { 46 CFXJSE_Class* pClass) const {
47 v8::Local<v8::Value> hValue = (*m_pInfo)[index]; 47 v8::Local<v8::Value> hValue = (*m_pInfo)[index];
48 ASSERT(!hValue.IsEmpty()); 48 ASSERT(!hValue.IsEmpty());
49 if (!hValue->IsObject()) 49 if (!hValue->IsObject())
50 return nullptr; 50 return nullptr;
51 return FXJSE_RetrieveObjectBinding(hValue.As<v8::Object>(), pClass); 51 return FXJSE_RetrieveObjectBinding(hValue.As<v8::Object>(), pClass);
52 } 52 }
53 53
54 CFXJSE_Value* CFXJSE_Arguments::GetReturnValue() { 54 CFXJSE_Value* CFXJSE_Arguments::GetReturnValue() {
55 return m_pRetValue; 55 return m_pRetValue;
56 } 56 }
OLDNEW
« no previous file with comments | « fxjs/cfxjse_arguments.h ('k') | fxjs/cfxjse_class.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698