| 1 | /* |
| 2 | * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * 1. Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * 2. Redistributions in binary form must reproduce the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer in the |
| 11 | * documentation and/or other materials provided with the distribution. |
| 12 | * |
| 13 | * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | */ |
| 25 | |
| 26 | #ifndef JSClassRef_h |
| 27 | #define JSClassRef_hcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/API/JSClassRef.h:27:9`! |
| 28 | |
| 29 | #include "JSObjectRef.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.h`/ |
| 30 | |
| 31 | #include <runtime/JSObject.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSObject.h`/ |
| 32 | #include <runtime/Protect.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Protect.h`/ |
| 33 | #include <runtime/UString.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/UString.h`/ |
| 34 | #include <runtime/WeakGCPtr.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/WeakGCPtr.h`/ |
| 35 | #include <wtf/HashMap.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashMap.h`/ |
| 36 | #include <wtf/RefCounted.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/RefCounted.h`/ |
| 37 | |
| 38 | struct StaticValueEntrycxx . . $ StaticValueEntry# : FastAllocBasecxx . . $ FastAllocBase# { |
| 39 | StaticValueEntrycxx . . $ StaticValueEntry#StaticValueEntry(69751b1c07f0a0bd).(JSObjectGetPropertyCallback _getProperty, JSObjectSetPropertyCallback _setProperty, JSPropertyAttributes _attributes) |
| 40 | : getPropertycxx . . $ StaticValueEntry#getProperty.(_getProperty), setPropertycxx . . $ StaticValueEntry#setProperty.(_setProperty), attributescxx . . $ StaticValueEntry#attributes.(_attributes) |
| 41 | { |
| 42 | } |
| 43 | |
| 44 | JSObjectGetPropertyCallback getPropertycxx . . $ StaticValueEntry#getProperty.; |
| 45 | JSObjectSetPropertyCallback setPropertycxx . . $ StaticValueEntry#setProperty.; |
| 46 | JSPropertyAttributes attributescxx . . $ StaticValueEntry#attributes.; |
| 47 | }; |
| 48 | |
| 49 | struct StaticFunctionEntrycxx . . $ StaticFunctionEntry# : FastAllocBasecxx . . $ FastAllocBase# { |
| 50 | StaticFunctionEntrycxx . . $ StaticFunctionEntry#StaticFunctionEntry(ea9883a277130908).(JSObjectCallAsFunctionCallback _callAsFunction, JSPropertyAttributes _attributes) |
| 51 | : callAsFunctioncxx . . $ StaticFunctionEntry#callAsFunction.(_callAsFunction), attributescxx . . $ StaticFunctionEntry#attributes.(_attributes) |
| 52 | { |
| 53 | } |
| 54 | |
| 55 | JSObjectCallAsFunctionCallback callAsFunctioncxx . . $ StaticFunctionEntry#callAsFunction.; |
| 56 | JSPropertyAttributes attributescxx . . $ StaticFunctionEntry#attributes.; |
| 57 | }; |
| 58 | |
| 59 | typedef HashMap<RefPtr<JSCcxx . . $ `<built-in>:463:9`!::UString::Rep>, StaticValueEntry*> OpaqueJSClassStaticValuesTablecxx . . $ OpaqueJSClassStaticValuesTable#; |
| 60 | typedef HashMap<RefPtr<JSCcxx . . $ `<built-in>:463:9`!::UString::Rep>, StaticFunctionEntry*> OpaqueJSClassStaticFunctionsTablecxx . . $ OpaqueJSClassStaticFunctionsTable#; |
| 61 | |
| 62 | struct OpaqueJSClasscxx . . $ OpaqueJSClass#; |
| 63 | |
| 64 | // An OpaqueJSClass (JSClass) is created without a context, so it can be used with any context, even across context groups. |
| 65 | // This structure holds data members that vary across context groups. |
| 66 | struct OpaqueJSClassContextDatacxx . . $ OpaqueJSClassContextData# : Noncopyablecxx . . $ Noncopyable# { |
| 67 | OpaqueJSClassContextDatacxx . . $ OpaqueJSClassContextData#OpaqueJSClassContextData(159998762f31489b).(OpaqueJSClasscxx . . $ OpaqueJSClass#*); |
| 68 | ~cxx . . $ OpaqueJSClassContextData#`~OpaqueJSClassContextData`(49f6e7a06ebc5aa8).OpaqueJSClassContextDatacxx . . $ OpaqueJSClassContextData#(); |
| 69 | |
| 70 | // It is necessary to keep OpaqueJSClass alive because of the following rare scenario: |
| 71 | // 1. A class is created and used, so its context data is stored in JSGlobalData hash map. |
| 72 | // 2. The class is released, and when all JS objects that use it are collected, OpaqueJSClass |
| 73 | // is deleted (that's the part prevented by this RefPtr). |
| 74 | // 3. Another class is created at the same address. |
| 75 | // 4. When it is used, the old context data is found in JSGlobalData and used. |
| 76 | RefPtrcxx . . $ RefPtr#<OpaqueJSClasscxx . . $ OpaqueJSClass#> m_classcxx . . $ OpaqueJSClassContextData#m_class.; |
| 77 | |
| 78 | OpaqueJSClassStaticValuesTablecxx . . $ OpaqueJSClassStaticValuesTable#* staticValuescxx . . $ OpaqueJSClassContextData#staticValues.; |
| 79 | OpaqueJSClassStaticFunctionsTablecxx . . $ OpaqueJSClassStaticFunctionsTable#* staticFunctionscxx . . $ OpaqueJSClassContextData#staticFunctions.; |
| 80 | JSCcxx . . $ `<built-in>:463:9`!::WeakGCPtrcxx . . $ QTJSC/WeakGCPtr#<JSCcxx . . $ `<built-in>:463:9`!::JSObjectcxx . . $ QTJSC/JSObject#> cachedPrototypecxx . . $ OpaqueJSClassContextData#cachedPrototype.; |
| 81 | }; |
| 82 | |
| 83 | struct OpaqueJSClasscxx . . $ OpaqueJSClass# : public ThreadSafeShared<OpaqueJSClass> { |
| 84 | static PassRefPtrcxx . . $ PassRefPtr#<OpaqueJSClasscxx . . $ OpaqueJSClass#> createcxx . . $ OpaqueJSClass#create(bd14c5ac80c68ccd).(const JSClassDefinition*); |
| 85 | static PassRefPtrcxx . . $ PassRefPtr#<OpaqueJSClasscxx . . $ OpaqueJSClass#> createNoAutomaticPrototypecxx . . $ OpaqueJSClass#createNoAutomaticPrototype(bd14c5ac80c68ccd).(const JSClassDefinition*); |
| 86 | ~cxx . . $ OpaqueJSClass#`~OpaqueJSClass`(49f6e7a06ebc5aa8).OpaqueJSClasscxx . . $ OpaqueJSClass#(); |
| 87 | |
| 88 | JSCcxx . . $ QTJSC/::UStringcxx . . $ QTJSC/UString# classNamecxx . . $ OpaqueJSClass#className(efe381e3afb22e2c).(); |
| 89 | OpaqueJSClassStaticValuesTablecxx . . $ OpaqueJSClassStaticValuesTable#* staticValuescxx . . $ OpaqueJSClass#staticValues(7d16391faedb28a0).(JSCcxx . . $ `<built-in>:463:9`!::ExecStatecxx . . $ QTJSC/ExecState#*); |
| 90 | OpaqueJSClassStaticFunctionsTablecxx . . $ OpaqueJSClassStaticFunctionsTable#* staticFunctionscxx . . $ OpaqueJSClass#staticFunctions(7d16391faedb28a0).(JSCcxx . . $ `<built-in>:463:9`!::ExecStatecxx . . $ QTJSC/ExecState#*); |
| 91 | JSCcxx . . $ QTJSC/::JSObjectcxx . . $ QTJSC/JSObject#* prototypecxx . . $ OpaqueJSClass#prototype(dc025d143f56633c).(JSCcxx . . $ QTJSC/::ExecStatecxx . . $ QTJSC/ExecState#*); |
| 92 | |
| 93 | OpaqueJSClasscxx . . $ OpaqueJSClass#* parentClasscxx . . $ OpaqueJSClass#parentClass.; |
| 94 | OpaqueJSClasscxx . . $ OpaqueJSClass#* prototypeClasscxx . . $ OpaqueJSClass#prototypeClass.; |
| 95 | |
| 96 | JSObjectInitializeCallback initializecxx . . $ OpaqueJSClass#initialize.; |
| 97 | JSObjectFinalizeCallback finalizecxx . . $ OpaqueJSClass#finalize.; |
| 98 | JSObjectHasPropertyCallback hasPropertycxx . . $ OpaqueJSClass#hasProperty.; |
| 99 | JSObjectGetPropertyCallback getPropertycxx . . $ OpaqueJSClass#getProperty.; |
| 100 | JSObjectSetPropertyCallback setPropertycxx . . $ OpaqueJSClass#setProperty.; |
| 101 | JSObjectDeletePropertyCallback deletePropertycxx . . $ OpaqueJSClass#deleteProperty.; |
| 102 | JSObjectGetPropertyNamesCallback getPropertyNamescxx . . $ OpaqueJSClass#getPropertyNames.; |
| 103 | JSObjectCallAsFunctionCallback callAsFunctioncxx . . $ OpaqueJSClass#callAsFunction.; |
| 104 | JSObjectCallAsConstructorCallback callAsConstructorcxx . . $ OpaqueJSClass#callAsConstructor.; |
| 105 | JSObjectHasInstanceCallback hasInstancecxx . . $ OpaqueJSClass#hasInstance.; |
| 106 | JSObjectConvertToTypeCallback convertToTypecxx . . $ OpaqueJSClass#convertToType.; |
| 107 | |
| 108 | private: |
| 109 | friend struct OpaqueJSClassContextData; |
| 110 | |
| 111 | OpaqueJSClasscxx . . $ OpaqueJSClass#OpaqueJSClass(49f6e7a06ebc5aa8).(); |
| 112 | OpaqueJSClasscxx . . $ OpaqueJSClass#OpaqueJSClass(1ba43973ff9383c8).(const OpaqueJSClasscxx . . $ OpaqueJSClass#&); |
| 113 | OpaqueJSClasscxx . . $ OpaqueJSClass#OpaqueJSClass(f031348405501082).(const JSClassDefinition*, OpaqueJSClasscxx . . $ OpaqueJSClass#* protoClass); |
| 114 | |
| 115 | OpaqueJSClassContextDatacxx . . $ OpaqueJSClassContextData#& contextDatacxx . . $ OpaqueJSClass#contextData(f87e7ed45c1bfa41).(JSCcxx . . $ `<built-in>:463:9`!::ExecStatecxx . . $ QTJSC/ExecState#*); |
| 116 | |
| 117 | // UStrings in these data members should not be put into any IdentifierTable. |
| 118 | JSCcxx . . $ `<built-in>:463:9`!::UStringcxx . . $ QTJSC/UString# m_classNamecxx . . $ OpaqueJSClass#m_className.; |
| 119 | OpaqueJSClassStaticValuesTablecxx . . $ OpaqueJSClassStaticValuesTable#* m_staticValuescxx . . $ OpaqueJSClass#m_staticValues.; |
| 120 | OpaqueJSClassStaticFunctionsTablecxx . . $ OpaqueJSClassStaticFunctionsTable#* m_staticFunctionscxx . . $ OpaqueJSClass#m_staticFunctions.; |
| 121 | }; |
| 122 | |
| 123 | #endif // JSClassRef_h |