Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "bin/dartutils.h" | 5 #include "bin/dartutils.h" |
| 6 | 6 |
| 7 const char* DartUtils::kBuiltinLibURL = "./dart:builtin-lib"; | 7 const char* DartUtils::kBuiltinLibURL = "dart:builtin-lib"; |
|
Ivan Posva
2011/11/16 19:19:53
Please drop the -lib as well.
siva
2011/11/17 00:04:28
Done.
| |
| 8 const char* DartUtils::kCoreLibURL = "dart:core"; | |
| 9 const char* DartUtils::kCoreImplLibURL = "dart:coreimpl"; | |
| 10 const char* DartUtils::kCoreNativeFieldsLibURL = "dart:core-native-fields"; | |
|
Ivan Posva
2011/11/16 19:19:53
How about "dart:nativewrappers"?
siva
2011/11/17 00:04:28
Done.
| |
| 8 const char* DartUtils::kBuiltinLibSpec = "library { }"; | 11 const char* DartUtils::kBuiltinLibSpec = "library { }"; |
|
Ivan Posva
2011/11/16 19:19:53
Do we still need the kBuiltinLibSpec?
siva
2011/11/17 00:04:28
Removed.
On 2011/11/16 19:19:53, Ivan Posva wrote
| |
| 9 const char* DartUtils::kIdFieldName = "_id"; | 12 const char* DartUtils::kIdFieldName = "_id"; |
| 10 | 13 |
|
Ivan Posva
2011/11/16 19:19:53
Two lines?
siva
2011/11/17 00:04:28
Done.
| |
| 11 | |
| 12 int64_t DartUtils::GetIntegerValue(Dart_Handle value_obj) { | 14 int64_t DartUtils::GetIntegerValue(Dart_Handle value_obj) { |
| 13 ASSERT(Dart_IsInteger(value_obj)); | 15 ASSERT(Dart_IsInteger(value_obj)); |
| 14 int64_t value = 0; | 16 int64_t value = 0; |
| 15 Dart_Handle result = Dart_IntegerValue(value_obj, &value); | 17 Dart_Handle result = Dart_IntegerValue(value_obj, &value); |
| 16 ASSERT(!Dart_IsError(result)); | 18 ASSERT(!Dart_IsError(result)); |
| 17 return value; | 19 return value; |
| 18 } | 20 } |
| 19 | 21 |
|
Ivan Posva
2011/11/16 19:19:53
Two lines.
siva
2011/11/17 00:04:28
Done.
| |
| 20 const char* DartUtils::GetStringValue(Dart_Handle str_obj) { | 22 const char* DartUtils::GetStringValue(Dart_Handle str_obj) { |
| 21 const char* cstring = NULL; | 23 const char* cstring = NULL; |
| 22 Dart_Handle result = Dart_StringToCString(str_obj, &cstring); | 24 Dart_Handle result = Dart_StringToCString(str_obj, &cstring); |
| 23 ASSERT(!Dart_IsError(result)); | 25 ASSERT(!Dart_IsError(result)); |
| 24 return cstring; | 26 return cstring; |
| 25 } | 27 } |
| 26 | 28 |
| 27 | 29 |
| 28 bool DartUtils::GetBooleanValue(Dart_Handle bool_obj) { | 30 bool DartUtils::GetBooleanValue(Dart_Handle bool_obj) { |
| 29 bool value = false; | 31 bool value = false; |
| 30 Dart_Handle result = Dart_BooleanValue(bool_obj, &value); | 32 Dart_Handle result = Dart_BooleanValue(bool_obj, &value); |
| 31 ASSERT(!Dart_IsError(result)); | 33 ASSERT(!Dart_IsError(result)); |
| 32 return value; | 34 return value; |
| 33 } | 35 } |
| 34 | 36 |
|
Ivan Posva
2011/11/16 19:19:53
ditto.
siva
2011/11/17 00:04:28
Done.
| |
| 35 void DartUtils::SetIntegerInstanceField(Dart_Handle handle, | 37 void DartUtils::SetIntegerInstanceField(Dart_Handle handle, |
| 36 const char* name, | 38 const char* name, |
| 37 intptr_t val) { | 39 intptr_t val) { |
| 38 Dart_Handle result = Dart_SetInstanceField(handle, | 40 Dart_Handle result = Dart_SetInstanceField(handle, |
| 39 Dart_NewString(name), | 41 Dart_NewString(name), |
| 40 Dart_NewInteger(val)); | 42 Dart_NewInteger(val)); |
| 41 ASSERT(!Dart_IsError(result)); | 43 ASSERT(!Dart_IsError(result)); |
| 42 } | 44 } |
| 43 | 45 |
|
Ivan Posva
2011/11/16 19:19:53
ditto.
siva
2011/11/17 00:04:28
Done.
| |
| 44 intptr_t DartUtils::GetIntegerInstanceField(Dart_Handle handle, | 46 intptr_t DartUtils::GetIntegerInstanceField(Dart_Handle handle, |
| 45 const char* name) { | 47 const char* name) { |
| 46 Dart_Handle result = | 48 Dart_Handle result = |
| 47 Dart_GetInstanceField(handle, Dart_NewString(name)); | 49 Dart_GetInstanceField(handle, Dart_NewString(name)); |
| 48 ASSERT(!Dart_IsError(result)); | 50 ASSERT(!Dart_IsError(result)); |
| 49 intptr_t value = DartUtils::GetIntegerValue(result); | 51 intptr_t value = DartUtils::GetIntegerValue(result); |
| 50 return value; | 52 return value; |
| 51 } | 53 } |
| 52 | 54 |
|
Ivan Posva
2011/11/16 19:19:53
ditto.
siva
2011/11/17 00:04:28
Done.
| |
| 53 void DartUtils::SetStringInstanceField(Dart_Handle handle, | 55 void DartUtils::SetStringInstanceField(Dart_Handle handle, |
| 54 const char* name, | 56 const char* name, |
| 55 const char* val) { | 57 const char* val) { |
| 56 Dart_Handle result = Dart_SetInstanceField(handle, | 58 Dart_Handle result = Dart_SetInstanceField(handle, |
| 57 Dart_NewString(name), | 59 Dart_NewString(name), |
| 58 Dart_NewString(val)); | 60 Dart_NewString(val)); |
| 59 ASSERT(!Dart_IsError(result)); | 61 ASSERT(!Dart_IsError(result)); |
| 60 } | 62 } |
| OLD | NEW |