WebCore/generated/JSMemoryInfo.cpp
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     1 /*
       
     2     This file is part of the WebKit open source project.
       
     3     This file has been generated by generate-bindings.pl. DO NOT MODIFY!
       
     4 
       
     5     This library is free software; you can redistribute it and/or
       
     6     modify it under the terms of the GNU Library General Public
       
     7     License as published by the Free Software Foundation; either
       
     8     version 2 of the License, or (at your option) any later version.
       
     9 
       
    10     This library is distributed in the hope that it will be useful,
       
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    13     Library General Public License for more details.
       
    14 
       
    15     You should have received a copy of the GNU Library General Public License
       
    16     along with this library; see the file COPYING.LIB.  If not, write to
       
    17     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
       
    18     Boston, MA 02110-1301, USA.
       
    19 */
       
    20 
       
    21 #include "config.h"
       
    22 #include "JSMemoryInfo.h"
       
    23 
       
    24 #include "MemoryInfo.h"
       
    25 #include <runtime/JSNumberCell.h>
       
    26 #include <wtf/GetPtr.h>
       
    27 
       
    28 using namespace JSC;
       
    29 
       
    30 namespace WebCore {
       
    31 
       
    32 ASSERT_CLASS_FITS_IN_CELL(JSMemoryInfo);
       
    33 
       
    34 /* Hash table */
       
    35 #if ENABLE(JIT)
       
    36 #define THUNK_GENERATOR(generator) , generator
       
    37 #else
       
    38 #define THUNK_GENERATOR(generator)
       
    39 #endif
       
    40 
       
    41 static const HashTableValue JSMemoryInfoTableValues[3] =
       
    42 {
       
    43     { "totalJSHeapSize", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMemoryInfoTotalJSHeapSize), (intptr_t)0 THUNK_GENERATOR(0) },
       
    44     { "usedJSHeapSize", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMemoryInfoUsedJSHeapSize), (intptr_t)0 THUNK_GENERATOR(0) },
       
    45     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    46 };
       
    47 
       
    48 #undef THUNK_GENERATOR
       
    49 static JSC_CONST_HASHTABLE HashTable JSMemoryInfoTable = { 4, 3, JSMemoryInfoTableValues, 0 };
       
    50 /* Hash table for prototype */
       
    51 #if ENABLE(JIT)
       
    52 #define THUNK_GENERATOR(generator) , generator
       
    53 #else
       
    54 #define THUNK_GENERATOR(generator)
       
    55 #endif
       
    56 
       
    57 static const HashTableValue JSMemoryInfoPrototypeTableValues[1] =
       
    58 {
       
    59     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    60 };
       
    61 
       
    62 #undef THUNK_GENERATOR
       
    63 static JSC_CONST_HASHTABLE HashTable JSMemoryInfoPrototypeTable = { 1, 0, JSMemoryInfoPrototypeTableValues, 0 };
       
    64 const ClassInfo JSMemoryInfoPrototype::s_info = { "MemoryInfoPrototype", 0, &JSMemoryInfoPrototypeTable, 0 };
       
    65 
       
    66 JSObject* JSMemoryInfoPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
       
    67 {
       
    68     return getDOMPrototype<JSMemoryInfo>(exec, globalObject);
       
    69 }
       
    70 
       
    71 const ClassInfo JSMemoryInfo::s_info = { "MemoryInfo", 0, &JSMemoryInfoTable, 0 };
       
    72 
       
    73 JSMemoryInfo::JSMemoryInfo(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<MemoryInfo> impl)
       
    74     : DOMObjectWithGlobalPointer(structure, globalObject)
       
    75     , m_impl(impl)
       
    76 {
       
    77 }
       
    78 
       
    79 JSMemoryInfo::~JSMemoryInfo()
       
    80 {
       
    81     forgetDOMObject(this, impl());
       
    82 }
       
    83 
       
    84 JSObject* JSMemoryInfo::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
       
    85 {
       
    86     return new (exec) JSMemoryInfoPrototype(globalObject, JSMemoryInfoPrototype::createStructure(globalObject->objectPrototype()));
       
    87 }
       
    88 
       
    89 bool JSMemoryInfo::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    90 {
       
    91     return getStaticValueSlot<JSMemoryInfo, Base>(exec, &JSMemoryInfoTable, this, propertyName, slot);
       
    92 }
       
    93 
       
    94 bool JSMemoryInfo::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
    95 {
       
    96     return getStaticValueDescriptor<JSMemoryInfo, Base>(exec, &JSMemoryInfoTable, this, propertyName, descriptor);
       
    97 }
       
    98 
       
    99 JSValue jsMemoryInfoTotalJSHeapSize(ExecState* exec, JSValue slotBase, const Identifier&)
       
   100 {
       
   101     JSMemoryInfo* castedThis = static_cast<JSMemoryInfo*>(asObject(slotBase));
       
   102     UNUSED_PARAM(exec);
       
   103     MemoryInfo* imp = static_cast<MemoryInfo*>(castedThis->impl());
       
   104     JSValue result = jsNumber(exec, imp->totalJSHeapSize());
       
   105     return result;
       
   106 }
       
   107 
       
   108 JSValue jsMemoryInfoUsedJSHeapSize(ExecState* exec, JSValue slotBase, const Identifier&)
       
   109 {
       
   110     JSMemoryInfo* castedThis = static_cast<JSMemoryInfo*>(asObject(slotBase));
       
   111     UNUSED_PARAM(exec);
       
   112     MemoryInfo* imp = static_cast<MemoryInfo*>(castedThis->impl());
       
   113     JSValue result = jsNumber(exec, imp->usedJSHeapSize());
       
   114     return result;
       
   115 }
       
   116 
       
   117 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, MemoryInfo* object)
       
   118 {
       
   119     return getDOMObjectWrapper<JSMemoryInfo>(exec, globalObject, object);
       
   120 }
       
   121 MemoryInfo* toMemoryInfo(JSC::JSValue value)
       
   122 {
       
   123     return value.inherits(&JSMemoryInfo::s_info) ? static_cast<JSMemoryInfo*>(asObject(value))->impl() : 0;
       
   124 }
       
   125 
       
   126 }