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 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 #ifndef V8AdaptorFunction_h | 31 #ifndef V8AdaptorFunction_h |
32 #define V8AdaptorFunction_h | 32 #define V8AdaptorFunction_h |
33 | 33 |
34 #include "bindings/v8/V8Binding.h" | 34 #include "bindings/v8/V8Binding.h" |
35 #include "bindings/v8/V8HiddenPropertyName.h" | 35 #include "bindings/v8/V8HiddenPropertyName.h" |
36 #include "bindings/v8/WrapperTypeInfo.h" | 36 #include "bindings/v8/WrapperTypeInfo.h" |
37 #include "wtf/PassRefPtr.h" | 37 #include "wtf/PassRefPtr.h" |
38 | 38 |
39 #if ENABLE(CUSTOM_ELEMENTS) | |
40 | |
41 namespace WebCore { | 39 namespace WebCore { |
42 | 40 |
43 // | 41 // |
44 // FIXME(https://bugs.webkit.org/show_bug.cgi?id=108138): | 42 // FIXME(https://bugs.webkit.org/show_bug.cgi?id=108138): |
45 // V8AdaptorFunction class and V8WrapAsFunction IDL attribute are needed for two
reasons: | 43 // V8AdaptorFunction class and V8WrapAsFunction IDL attribute are needed for two
reasons: |
46 // - 1) V8 doesn't allow expanding the internal field of function objects. https
://code.google.com/p/v8/issues/detail?id=837 | 44 // - 1) V8 doesn't allow expanding the internal field of function objects. https
://code.google.com/p/v8/issues/detail?id=837 |
47 // WebKit need it to associate each wrapper to its backing C++ object. We s
tore it in a hidden property of the wrapped object. | 45 // WebKit need it to associate each wrapper to its backing C++ object. We s
tore it in a hidden property of the wrapped object. |
48 // - 2) Binding codebase assumes every wrapper object is created through ObjectT
emplate::NewInstance(), not FunctionTemplate::GetFunction(). | 46 // - 2) Binding codebase assumes every wrapper object is created through ObjectT
emplate::NewInstance(), not FunctionTemplate::GetFunction(). |
49 // Once 1) is addresssed, we could attack 2) with it. | 47 // Once 1) is addresssed, we could attack 2) with it. |
50 // | 48 // |
(...skipping 20 matching lines...) Expand all Loading... |
71 inline v8::Handle<v8::Function> V8AdaptorFunction::get(v8::Handle<v8::Object> ob
ject) | 69 inline v8::Handle<v8::Function> V8AdaptorFunction::get(v8::Handle<v8::Object> ob
ject) |
72 { | 70 { |
73 v8::Handle<v8::Value> adaptorFunction = object->GetHiddenValue(V8HiddenPrope
rtyName::adaptorFunctionPeer()); | 71 v8::Handle<v8::Value> adaptorFunction = object->GetHiddenValue(V8HiddenPrope
rtyName::adaptorFunctionPeer()); |
74 ASSERT(!adaptorFunction.IsEmpty()); | 72 ASSERT(!adaptorFunction.IsEmpty()); |
75 ASSERT(adaptorFunction->IsFunction()); | 73 ASSERT(adaptorFunction->IsFunction()); |
76 return v8::Handle<v8::Function>::Cast(adaptorFunction); | 74 return v8::Handle<v8::Function>::Cast(adaptorFunction); |
77 } | 75 } |
78 | 76 |
79 } // namespace WebCore | 77 } // namespace WebCore |
80 | 78 |
81 #endif // ENABLE(CUSTOM_ELEMENTS) | |
82 #endif // V8AdaptorFunction_h | 79 #endif // V8AdaptorFunction_h |
OLD | NEW |