| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 0, 0, | 100 0, 0, |
| 101 0, 0, | 101 0, 0, |
| 102 isolate, currentWorldType); | 102 isolate, currentWorldType); |
| 103 UNUSED_PARAM(defaultSignature); | 103 UNUSED_PARAM(defaultSignature); |
| 104 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | 104 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); |
| 105 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | 105 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); |
| 106 UNUSED_PARAM(instanceTemplate); | 106 UNUSED_PARAM(instanceTemplate); |
| 107 UNUSED_PARAM(prototypeTemplate); | 107 UNUSED_PARAM(prototypeTemplate); |
| 108 | 108 |
| 109 // Custom toString template | 109 // Custom toString template |
| 110 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
urrent()->toStringTemplate()); | 110 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
| 111 return functionTemplate; | 111 return functionTemplate; |
| 112 } | 112 } |
| 113 | 113 |
| 114 v8::Handle<v8::FunctionTemplate> V8TestException::GetTemplate(v8::Isolate* isola
te, WrapperWorldType currentWorldType) | 114 v8::Handle<v8::FunctionTemplate> V8TestException::GetTemplate(v8::Isolate* isola
te, WrapperWorldType currentWorldType) |
| 115 { | 115 { |
| 116 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 116 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 117 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 117 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 118 if (result != data->templateMap(currentWorldType).end()) | 118 if (result != data->templateMap(currentWorldType).end()) |
| 119 return result->value.newLocal(isolate); | 119 return result->value.newLocal(isolate); |
| 120 | 120 |
| 121 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 121 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 122 v8::HandleScope handleScope(isolate); | 122 v8::EscapableHandleScope handleScope(isolate); |
| 123 v8::Handle<v8::FunctionTemplate> templ = | 123 v8::Local<v8::FunctionTemplate> templ = |
| 124 ConfigureV8TestExceptionTemplate(data->rawTemplate(&wrapperTypeInfo, cur
rentWorldType), isolate, currentWorldType); | 124 ConfigureV8TestExceptionTemplate(data->rawTemplate(&wrapperTypeInfo, cur
rentWorldType), isolate, currentWorldType); |
| 125 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 125 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 126 return handleScope.Close(templ); | 126 return handleScope.Escape(templ); |
| 127 } | 127 } |
| 128 | 128 |
| 129 bool V8TestException::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* is
olate, WrapperWorldType currentWorldType) | 129 bool V8TestException::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* is
olate, WrapperWorldType currentWorldType) |
| 130 { | 130 { |
| 131 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 131 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 132 } | 132 } |
| 133 | 133 |
| 134 bool V8TestException::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::I
solate* isolate) | 134 bool V8TestException::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::I
solate* isolate) |
| 135 { | 135 { |
| 136 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | 136 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 163 fromInternalPointer(object)->deref(); | 163 fromInternalPointer(object)->deref(); |
| 164 } | 164 } |
| 165 | 165 |
| 166 template<> | 166 template<> |
| 167 v8::Handle<v8::Value> toV8NoInline(TestException* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) | 167 v8::Handle<v8::Value> toV8NoInline(TestException* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) |
| 168 { | 168 { |
| 169 return toV8(impl, creationContext, isolate); | 169 return toV8(impl, creationContext, isolate); |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace WebCore | 172 } // namespace WebCore |
| OLD | NEW |