OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 16 matching lines...) Expand all Loading... |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "bindings/v8/V8AdaptorFunction.h" | 32 #include "bindings/v8/V8AdaptorFunction.h" |
33 | 33 |
34 #include "bindings/v8/V8PerIsolateData.h" | 34 #include "bindings/v8/V8PerIsolateData.h" |
35 #include "wtf/Vector.h" | 35 #include "wtf/Vector.h" |
36 | 36 |
37 #if ENABLE(CUSTOM_ELEMENTS) | |
38 | |
39 namespace WebCore { | 37 namespace WebCore { |
40 | 38 |
41 WrapperTypeInfo V8AdaptorFunction::info = { V8AdaptorFunction::getTemplate, 0, 0
, 0, 0, 0, 0, WrapperTypeObjectPrototype }; | 39 WrapperTypeInfo V8AdaptorFunction::info = { V8AdaptorFunction::getTemplate, 0, 0
, 0, 0, 0, 0, WrapperTypeObjectPrototype }; |
42 | 40 |
43 v8::Persistent<v8::FunctionTemplate> V8AdaptorFunction::getTemplate(v8::Isolate*
isolate, WrapperWorldType worldType) | 41 v8::Persistent<v8::FunctionTemplate> V8AdaptorFunction::getTemplate(v8::Isolate*
isolate, WrapperWorldType worldType) |
44 { | 42 { |
45 ASSERT(isolate); | 43 ASSERT(isolate); |
46 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 44 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
47 V8PerIsolateData::TemplateMap::iterator result = data->rawTemplateMap(worldT
ype).find(&info); | 45 V8PerIsolateData::TemplateMap::iterator result = data->rawTemplateMap(worldT
ype).find(&info); |
48 if (result != data->rawTemplateMap(worldType).end()) | 46 if (result != data->rawTemplateMap(worldType).end()) |
(...skipping 30 matching lines...) Expand all Loading... |
79 v8::Handle<v8::Function> adaptor = v8::Handle<v8::Function>::Cast(getTemplat
e(isolate, worldType(isolate))->GetFunction()->Clone()); | 77 v8::Handle<v8::Function> adaptor = v8::Handle<v8::Function>::Cast(getTemplat
e(isolate, worldType(isolate))->GetFunction()->Clone()); |
80 if (adaptor.IsEmpty()) | 78 if (adaptor.IsEmpty()) |
81 return v8::Handle<v8::Function>(); | 79 return v8::Handle<v8::Function>(); |
82 adaptor->SetName(v8String(name.string(), isolate)); | 80 adaptor->SetName(v8String(name.string(), isolate)); |
83 adaptor->SetHiddenValue(V8HiddenPropertyName::adaptorFunctionPeer(), object)
; | 81 adaptor->SetHiddenValue(V8HiddenPropertyName::adaptorFunctionPeer(), object)
; |
84 object->SetHiddenValue(V8HiddenPropertyName::adaptorFunctionPeer(), adaptor)
; | 82 object->SetHiddenValue(V8HiddenPropertyName::adaptorFunctionPeer(), adaptor)
; |
85 return adaptor; | 83 return adaptor; |
86 } | 84 } |
87 | 85 |
88 } // namespace WebCore | 86 } // namespace WebCore |
89 | |
90 #endif // ENABLE(CUSTOM_ELEMENTS) | |
OLD | NEW |