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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 100 } |
101 } | 101 } |
102 } | 102 } |
103 | 103 |
104 void V8DOMConfiguration::installMethods(v8::Handle<v8::ObjectTemplate> prototype
, v8::Handle<v8::Signature> signature, v8::PropertyAttribute attributes, const M
ethodConfiguration* callbacks, size_t callbackCount, v8::Isolate* isolate) | 104 void V8DOMConfiguration::installMethods(v8::Handle<v8::ObjectTemplate> prototype
, v8::Handle<v8::Signature> signature, v8::PropertyAttribute attributes, const M
ethodConfiguration* callbacks, size_t callbackCount, v8::Isolate* isolate) |
105 { | 105 { |
106 for (size_t i = 0; i < callbackCount; ++i) | 106 for (size_t i = 0; i < callbackCount; ++i) |
107 installMethod(prototype, signature, attributes, callbacks[i], isolate); | 107 installMethod(prototype, signature, attributes, callbacks[i], isolate); |
108 } | 108 } |
109 | 109 |
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::functionTemplateForCallback
(v8::Handle<v8::Signature> signature, v8::FunctionCallback callback, int length,
v8::Isolate* isolate) |
111 { | 111 { |
112 v8::FunctionCallback functionCallback = callback.callback; | 112 v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New
(isolate, callback, v8Undefined(), signature, length); |
113 if (DOMWrapperWorld::current(isolate).isMainWorld() && callback.callbackForM
ainWorld) | |
114 functionCallback = callback.callbackForMainWorld; | |
115 v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New
(isolate, functionCallback, v8Undefined(), signature, callback.length); | |
116 functionTemplate->RemovePrototype(); | 113 functionTemplate->RemovePrototype(); |
117 return functionTemplate; | 114 return functionTemplate; |
118 } | 115 } |
119 | 116 |
120 v8::Local<v8::Signature> V8DOMConfiguration::installDOMClassTemplate(v8::Handle<
v8::FunctionTemplate> functionDescriptor, const char* interfaceName, v8::Handle<
v8::FunctionTemplate> parentClass, size_t fieldCount, | 117 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, | 118 const AttributeConfiguration* attributes, size_t attributeCount, |
122 const AccessorConfiguration* accessors, size_t accessorCount, | 119 const AccessorConfiguration* accessors, size_t accessorCount, |
123 const MethodConfiguration* callbacks, size_t callbackCount, | 120 const MethodConfiguration* callbacks, size_t callbackCount, |
124 v8::Isolate* isolate) | 121 v8::Isolate* isolate) |
125 { | 122 { |
(...skipping 27 matching lines...) Expand all Loading... |
153 return result; | 150 return result; |
154 | 151 |
155 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate"); | 152 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate"); |
156 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); | 153 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); |
157 configureDOMClassTemplate(result, isolate); | 154 configureDOMClassTemplate(result, isolate); |
158 data->setDOMTemplate(wrapperTypeInfo, result); | 155 data->setDOMTemplate(wrapperTypeInfo, result); |
159 return result; | 156 return result; |
160 } | 157 } |
161 | 158 |
162 } // namespace blink | 159 } // namespace blink |
OLD | NEW |