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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 v8::Handle<v8::FunctionTemplate> V8DOMConfiguration::functionTemplateForMethod(v
8::Handle<v8::Signature> signature, const MethodConfiguration& callback, v8::Iso
late* isolate) | 110 v8::Handle<v8::FunctionTemplate> V8DOMConfiguration::functionTemplateForMethod(v
8::Handle<v8::Signature> signature, const MethodConfiguration& callback, v8::Iso
late* isolate) |
111 { | 111 { |
112 v8::FunctionCallback functionCallback = callback.callback; | 112 v8::FunctionCallback functionCallback = callback.callback; |
113 if (DOMWrapperWorld::current(isolate).isMainWorld() && callback.callbackForM
ainWorld) | 113 if (DOMWrapperWorld::current(isolate).isMainWorld() && callback.callbackForM
ainWorld) |
114 functionCallback = callback.callbackForMainWorld; | 114 functionCallback = callback.callbackForMainWorld; |
115 v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New
(isolate, functionCallback, v8Undefined(), signature, callback.length); | 115 v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New
(isolate, functionCallback, v8Undefined(), signature, callback.length); |
116 functionTemplate->RemovePrototype(); | 116 functionTemplate->RemovePrototype(); |
117 return functionTemplate; | 117 return functionTemplate; |
118 } | 118 } |
119 | 119 |
| 120 v8::Handle<v8::FunctionTemplate> V8DOMConfiguration::functionTemplateForMethod(v
8::Handle<v8::Signature> signature, const SymbolKeyedMethodConfiguration& callba
ck, v8::Isolate* isolate) |
| 121 { |
| 122 v8::FunctionCallback functionCallback = callback.callback; |
| 123 if (DOMWrapperWorld::current(isolate).isMainWorld() && callback.callbackForM
ainWorld) |
| 124 functionCallback = callback.callbackForMainWorld; |
| 125 v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New
(isolate, functionCallback, v8Undefined(), signature, callback.length); |
| 126 functionTemplate->RemovePrototype(); |
| 127 return functionTemplate; |
| 128 } |
| 129 |
120 v8::Local<v8::Signature> V8DOMConfiguration::installDOMClassTemplate(v8::Handle<
v8::FunctionTemplate> functionDescriptor, const char* interfaceName, v8::Handle<
v8::FunctionTemplate> parentClass, size_t fieldCount, | 130 v8::Local<v8::Signature> V8DOMConfiguration::installDOMClassTemplate(v8::Handle<
v8::FunctionTemplate> functionDescriptor, const char* interfaceName, v8::Handle<
v8::FunctionTemplate> parentClass, size_t fieldCount, |
121 const AttributeConfiguration* attributes, size_t attributeCount, | 131 const AttributeConfiguration* attributes, size_t attributeCount, |
122 const AccessorConfiguration* accessors, size_t accessorCount, | 132 const AccessorConfiguration* accessors, size_t accessorCount, |
123 const MethodConfiguration* callbacks, size_t callbackCount, | 133 const MethodConfiguration* callbacks, size_t callbackCount, |
124 v8::Isolate* isolate) | 134 v8::Isolate* isolate) |
125 { | 135 { |
126 functionDescriptor->SetClassName(v8AtomicString(isolate, interfaceName)); | 136 functionDescriptor->SetClassName(v8AtomicString(isolate, interfaceName)); |
127 v8::Local<v8::ObjectTemplate> instanceTemplate = functionDescriptor->Instanc
eTemplate(); | 137 v8::Local<v8::ObjectTemplate> instanceTemplate = functionDescriptor->Instanc
eTemplate(); |
128 instanceTemplate->SetInternalFieldCount(fieldCount); | 138 instanceTemplate->SetInternalFieldCount(fieldCount); |
129 if (!parentClass.IsEmpty()) { | 139 if (!parentClass.IsEmpty()) { |
(...skipping 23 matching lines...) Expand all Loading... |
153 return result; | 163 return result; |
154 | 164 |
155 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate"); | 165 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate"); |
156 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); | 166 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); |
157 configureDOMClassTemplate(result, isolate); | 167 configureDOMClassTemplate(result, isolate); |
158 data->setDOMTemplate(wrapperTypeInfo, result); | 168 data->setDOMTemplate(wrapperTypeInfo, result); |
159 return result; | 169 return result; |
160 } | 170 } |
161 | 171 |
162 } // namespace blink | 172 } // namespace blink |
OLD | NEW |