| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | 88 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); |
| 89 UNUSED_PARAM(instanceTemplate); | 89 UNUSED_PARAM(instanceTemplate); |
| 90 UNUSED_PARAM(prototypeTemplate); | 90 UNUSED_PARAM(prototypeTemplate); |
| 91 static const V8DOMConfiguration::ConstantConfiguration V8TestDoNotCheckConst
antsInterfaceConstants[] = { | 91 static const V8DOMConfiguration::ConstantConfiguration V8TestDoNotCheckConst
antsInterfaceConstants[] = { |
| 92 {"CONST_VALUE_0", 0}, | 92 {"CONST_VALUE_0", 0}, |
| 93 {"CONST_JAVASCRIPT", 1}, | 93 {"CONST_JAVASCRIPT", 1}, |
| 94 }; | 94 }; |
| 95 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8
TestDoNotCheckConstantsInterfaceConstants, WTF_ARRAY_LENGTH(V8TestDoNotCheckCons
tantsInterfaceConstants), isolate); | 95 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8
TestDoNotCheckConstantsInterfaceConstants, WTF_ARRAY_LENGTH(V8TestDoNotCheckCons
tantsInterfaceConstants), isolate); |
| 96 | 96 |
| 97 // Custom toString template | 97 // Custom toString template |
| 98 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
urrent()->toStringTemplate()); | 98 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
| 99 return functionTemplate; | 99 return functionTemplate; |
| 100 } | 100 } |
| 101 | 101 |
| 102 v8::Handle<v8::FunctionTemplate> V8TestDoNotCheckConstantsInterface::GetTemplate
(v8::Isolate* isolate, WrapperWorldType currentWorldType) | 102 v8::Handle<v8::FunctionTemplate> V8TestDoNotCheckConstantsInterface::GetTemplate
(v8::Isolate* isolate, WrapperWorldType currentWorldType) |
| 103 { | 103 { |
| 104 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 104 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 105 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 105 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 106 if (result != data->templateMap(currentWorldType).end()) | 106 if (result != data->templateMap(currentWorldType).end()) |
| 107 return result->value.newLocal(isolate); | 107 return result->value.newLocal(isolate); |
| 108 | 108 |
| 109 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 109 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 110 v8::HandleScope handleScope(isolate); | 110 v8::EscapableHandleScope handleScope(isolate); |
| 111 v8::Handle<v8::FunctionTemplate> templ = | 111 v8::Local<v8::FunctionTemplate> templ = |
| 112 ConfigureV8TestDoNotCheckConstantsInterfaceTemplate(data->rawTemplate(&w
rapperTypeInfo, currentWorldType), isolate, currentWorldType); | 112 ConfigureV8TestDoNotCheckConstantsInterfaceTemplate(data->rawTemplate(&w
rapperTypeInfo, currentWorldType), isolate, currentWorldType); |
| 113 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 113 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 114 return handleScope.Close(templ); | 114 return handleScope.Escape(templ); |
| 115 } | 115 } |
| 116 | 116 |
| 117 bool V8TestDoNotCheckConstantsInterface::hasInstance(v8::Handle<v8::Value> jsVal
ue, v8::Isolate* isolate, WrapperWorldType currentWorldType) | 117 bool V8TestDoNotCheckConstantsInterface::hasInstance(v8::Handle<v8::Value> jsVal
ue, v8::Isolate* isolate, WrapperWorldType currentWorldType) |
| 118 { | 118 { |
| 119 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 119 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 120 } | 120 } |
| 121 | 121 |
| 122 bool V8TestDoNotCheckConstantsInterface::hasInstanceInAnyWorld(v8::Handle<v8::Va
lue> jsValue, v8::Isolate* isolate) | 122 bool V8TestDoNotCheckConstantsInterface::hasInstanceInAnyWorld(v8::Handle<v8::Va
lue> jsValue, v8::Isolate* isolate) |
| 123 { | 123 { |
| 124 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | 124 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 151 fromInternalPointer(object)->deref(); | 151 fromInternalPointer(object)->deref(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 template<> | 154 template<> |
| 155 v8::Handle<v8::Value> toV8NoInline(TestDoNotCheckConstantsInterface* impl, v8::H
andle<v8::Object> creationContext, v8::Isolate* isolate) | 155 v8::Handle<v8::Value> toV8NoInline(TestDoNotCheckConstantsInterface* impl, v8::H
andle<v8::Object> creationContext, v8::Isolate* isolate) |
| 156 { | 156 { |
| 157 return toV8(impl, creationContext, isolate); | 157 return toV8(impl, creationContext, isolate); |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace WebCore | 160 } // namespace WebCore |
| OLD | NEW |