| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 COMPILE_ASSERT(0x1abc == TestConstants::CONST_VALUE_14, TheValueOfTestConsta
nts_CONST_VALUE_14DoesntMatchWithImplementation); | 125 COMPILE_ASSERT(0x1abc == TestConstants::CONST_VALUE_14, TheValueOfTestConsta
nts_CONST_VALUE_14DoesntMatchWithImplementation); |
| 126 COMPILE_ASSERT(010 == TestConstants::CONST_VALUE_15, TheValueOfTestConstants
_CONST_VALUE_15DoesntMatchWithImplementation); | 126 COMPILE_ASSERT(010 == TestConstants::CONST_VALUE_15, TheValueOfTestConstants
_CONST_VALUE_15DoesntMatchWithImplementation); |
| 127 COMPILE_ASSERT(-010 == TestConstants::CONST_VALUE_16, TheValueOfTestConstant
s_CONST_VALUE_16DoesntMatchWithImplementation); | 127 COMPILE_ASSERT(-010 == TestConstants::CONST_VALUE_16, TheValueOfTestConstant
s_CONST_VALUE_16DoesntMatchWithImplementation); |
| 128 COMPILE_ASSERT(-0x1A == TestConstants::CONST_VALUE_16, TheValueOfTestConstan
ts_CONST_VALUE_16DoesntMatchWithImplementation); | 128 COMPILE_ASSERT(-0x1A == TestConstants::CONST_VALUE_16, TheValueOfTestConstan
ts_CONST_VALUE_16DoesntMatchWithImplementation); |
| 129 COMPILE_ASSERT(-0X1a == TestConstants::CONST_VALUE_17, TheValueOfTestConstan
ts_CONST_VALUE_17DoesntMatchWithImplementation); | 129 COMPILE_ASSERT(-0X1a == TestConstants::CONST_VALUE_17, TheValueOfTestConstan
ts_CONST_VALUE_17DoesntMatchWithImplementation); |
| 130 COMPILE_ASSERT(1 == TestConstants::DEPRECATED_CONSTANT, TheValueOfTestConsta
nts_DEPRECATED_CONSTANTDoesntMatchWithImplementation); | 130 COMPILE_ASSERT(1 == TestConstants::DEPRECATED_CONSTANT, TheValueOfTestConsta
nts_DEPRECATED_CONSTANTDoesntMatchWithImplementation); |
| 131 COMPILE_ASSERT(1 == TestConstants::FEATURE_ENABLED_CONST, TheValueOfTestCons
tants_FEATURE_ENABLED_CONSTDoesntMatchWithImplementation); | 131 COMPILE_ASSERT(1 == TestConstants::FEATURE_ENABLED_CONST, TheValueOfTestCons
tants_FEATURE_ENABLED_CONSTDoesntMatchWithImplementation); |
| 132 COMPILE_ASSERT(1 == TestConstants::CONST_IMPL, TheValueOfTestConstants_CONST
_IMPLDoesntMatchWithImplementation); | 132 COMPILE_ASSERT(1 == TestConstants::CONST_IMPL, TheValueOfTestConstants_CONST
_IMPLDoesntMatchWithImplementation); |
| 133 | 133 |
| 134 // Custom toString template | 134 // Custom toString template |
| 135 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
urrent()->toStringTemplate()); | 135 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
| 136 return functionTemplate; | 136 return functionTemplate; |
| 137 } | 137 } |
| 138 | 138 |
| 139 v8::Handle<v8::FunctionTemplate> V8TestConstants::GetTemplate(v8::Isolate* isola
te, WrapperWorldType currentWorldType) | 139 v8::Handle<v8::FunctionTemplate> V8TestConstants::GetTemplate(v8::Isolate* isola
te, WrapperWorldType currentWorldType) |
| 140 { | 140 { |
| 141 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 141 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 142 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 142 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 143 if (result != data->templateMap(currentWorldType).end()) | 143 if (result != data->templateMap(currentWorldType).end()) |
| 144 return result->value.newLocal(isolate); | 144 return result->value.newLocal(isolate); |
| 145 | 145 |
| 146 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 146 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 147 v8::HandleScope handleScope(isolate); | 147 v8::EscapableHandleScope handleScope(isolate); |
| 148 v8::Handle<v8::FunctionTemplate> templ = | 148 v8::Local<v8::FunctionTemplate> templ = |
| 149 ConfigureV8TestConstantsTemplate(data->rawTemplate(&wrapperTypeInfo, cur
rentWorldType), isolate, currentWorldType); | 149 ConfigureV8TestConstantsTemplate(data->rawTemplate(&wrapperTypeInfo, cur
rentWorldType), isolate, currentWorldType); |
| 150 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 150 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 151 return handleScope.Close(templ); | 151 return handleScope.Escape(templ); |
| 152 } | 152 } |
| 153 | 153 |
| 154 bool V8TestConstants::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* is
olate, WrapperWorldType currentWorldType) | 154 bool V8TestConstants::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* is
olate, WrapperWorldType currentWorldType) |
| 155 { | 155 { |
| 156 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 156 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 157 } | 157 } |
| 158 | 158 |
| 159 bool V8TestConstants::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::I
solate* isolate) | 159 bool V8TestConstants::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::I
solate* isolate) |
| 160 { | 160 { |
| 161 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | 161 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 188 fromInternalPointer(object)->deref(); | 188 fromInternalPointer(object)->deref(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 template<> | 191 template<> |
| 192 v8::Handle<v8::Value> toV8NoInline(TestConstants* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) | 192 v8::Handle<v8::Value> toV8NoInline(TestConstants* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) |
| 193 { | 193 { |
| 194 return toV8(impl, creationContext, isolate); | 194 return toV8(impl, creationContext, isolate); |
| 195 } | 195 } |
| 196 | 196 |
| 197 } // namespace WebCore | 197 } // namespace WebCore |
| OLD | NEW |