| OLD | NEW |
| 1 {# http://www.chromium.org/blink/coding-style#TOC-License #} | 1 {# http://www.chromium.org/blink/coding-style#TOC-License #} |
| 2 /* | 2 /* |
| 3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 {% endfor %} | 41 {% endfor %} |
| 42 | 42 |
| 43 namespace WebCore { | 43 namespace WebCore { |
| 44 | 44 |
| 45 {% if has_event_constructor %} | 45 {% if has_event_constructor %} |
| 46 class Dictionary; | 46 class Dictionary; |
| 47 {% endif %} | 47 {% endif %} |
| 48 {% if named_constructor %} | 48 {% if named_constructor %} |
| 49 class {{v8_class}}Constructor { | 49 class {{v8_class}}Constructor { |
| 50 public: | 50 public: |
| 51 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*, WrapperWor
ldType); | 51 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*); |
| 52 static const WrapperTypeInfo wrapperTypeInfo; | 52 static const WrapperTypeInfo wrapperTypeInfo; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 {% endif %} | 55 {% endif %} |
| 56 class {{v8_class}} { | 56 class {{v8_class}} { |
| 57 public: | 57 public: |
| 58 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*); | 58 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*); |
| 59 static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Va
lue>, v8::Isolate*); | 59 static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Va
lue>, v8::Isolate*); |
| 60 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*, WrapperWor
ldType); | 60 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*); |
| 61 static {{cpp_class}}* toNative(v8::Handle<v8::Object> object) | 61 static {{cpp_class}}* toNative(v8::Handle<v8::Object> object) |
| 62 { | 62 { |
| 63 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8
DOMWrapperObjectIndex)); | 63 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8
DOMWrapperObjectIndex)); |
| 64 } | 64 } |
| 65 static {{cpp_class}}* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Val
ue>); | 65 static {{cpp_class}}* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Val
ue>); |
| 66 static const WrapperTypeInfo wrapperTypeInfo; | 66 static const WrapperTypeInfo wrapperTypeInfo; |
| 67 static void derefObject(void*); | 67 static void derefObject(void*); |
| 68 {% if has_visit_dom_wrapper %} | 68 {% if has_visit_dom_wrapper %} |
| 69 static void visitDOMWrapper(void*, const v8::Persistent<v8::Object>&, v8::Is
olate*); | 69 static void visitDOMWrapper(void*, const v8::Persistent<v8::Object>&, v8::Is
olate*); |
| 70 {% endif %} | 70 {% endif %} |
| 71 {% if is_active_dom_object %} | 71 {% if is_active_dom_object %} |
| 72 static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>); | 72 static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>); |
| 73 {% endif %} | 73 {% endif %} |
| 74 {% if is_event_target %} | 74 {% if is_event_target %} |
| 75 static EventTarget* toEventTarget(v8::Handle<v8::Object>); | 75 static EventTarget* toEventTarget(v8::Handle<v8::Object>); |
| 76 {% endif %} | 76 {% endif %} |
| 77 {% if interface_name == 'Window' %} | 77 {% if interface_name == 'Window' %} |
| 78 static v8::Handle<v8::ObjectTemplate> getShadowObjectTemplate(v8::Isolate*,
WrapperWorldType); | 78 static v8::Handle<v8::ObjectTemplate> getShadowObjectTemplate(v8::Isolate*); |
| 79 {% endif %} | 79 {% endif %} |
| 80 {% for method in methods if method.is_custom %} | 80 {% for method in methods if method.is_custom %} |
| 81 {% filter conditional(method.conditional_string) %} | 81 {% filter conditional(method.conditional_string) %} |
| 82 static void {{method.name}}MethodCustom(const v8::FunctionCallbackInfo<v8::V
alue>&); | 82 static void {{method.name}}MethodCustom(const v8::FunctionCallbackInfo<v8::V
alue>&); |
| 83 {% endfilter %} | 83 {% endfilter %} |
| 84 {% endfor %} | 84 {% endfor %} |
| 85 {% if constructors or has_custom_constructor or has_event_constructor %} | 85 {% if constructors or has_custom_constructor or has_event_constructor %} |
| 86 static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 86 static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 87 {% endif %} | 87 {% endif %} |
| 88 {% if has_custom_constructor %} | 88 {% if has_custom_constructor %} |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 } | 250 } |
| 251 if (DOMDataStore::setReturnValueFromWrapper<{{v8_class}}>(callbackInfo.GetRe
turnValue(), impl)) | 251 if (DOMDataStore::setReturnValueFromWrapper<{{v8_class}}>(callbackInfo.GetRe
turnValue(), impl)) |
| 252 return; | 252 return; |
| 253 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackI
nfo.GetIsolate()); | 253 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackI
nfo.GetIsolate()); |
| 254 v8SetReturnValue(callbackInfo, wrapper); | 254 v8SetReturnValue(callbackInfo, wrapper); |
| 255 } | 255 } |
| 256 | 256 |
| 257 template<typename CallbackInfo> | 257 template<typename CallbackInfo> |
| 258 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, {{cpp
_class}}* impl) | 258 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, {{cpp
_class}}* impl) |
| 259 { | 259 { |
| 260 ASSERT(worldType(callbackInfo.GetIsolate()) == MainWorld); | 260 ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate())->isMainWorld()); |
| 261 if (UNLIKELY(!impl)) { | 261 if (UNLIKELY(!impl)) { |
| 262 v8SetReturnValueNull(callbackInfo); | 262 v8SetReturnValueNull(callbackInfo); |
| 263 return; | 263 return; |
| 264 } | 264 } |
| 265 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<{{v8_class}}>(callba
ckInfo.GetReturnValue(), impl)) | 265 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<{{v8_class}}>(callba
ckInfo.GetReturnValue(), impl)) |
| 266 return; | 266 return; |
| 267 v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackIn
fo.GetIsolate()); | 267 v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackIn
fo.GetIsolate()); |
| 268 v8SetReturnValue(callbackInfo, wrapper); | 268 v8SetReturnValue(callbackInfo, wrapper); |
| 269 } | 269 } |
| 270 | 270 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); | 305 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); |
| 306 } | 306 } |
| 307 | 307 |
| 308 {% if has_event_constructor %} | 308 {% if has_event_constructor %} |
| 309 bool initialize{{cpp_class}}({{cpp_class}}Init&, const Dictionary&, ExceptionSta
te&, const v8::FunctionCallbackInfo<v8::Value>& info, const String& = ""); | 309 bool initialize{{cpp_class}}({{cpp_class}}Init&, const Dictionary&, ExceptionSta
te&, const v8::FunctionCallbackInfo<v8::Value>& info, const String& = ""); |
| 310 | 310 |
| 311 {% endif %} | 311 {% endif %} |
| 312 } | 312 } |
| 313 {% endfilter %} | 313 {% endfilter %} |
| 314 #endif // {{v8_class}}_h | 314 #endif // {{v8_class}}_h |
| OLD | NEW |