⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jsglobalobject.h

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻 H
📖 第 1 页 / 共 2 页
字号:
/* *  Copyright (C) 2007 Eric Seidel <eric@webkit.org> *  Copyright (C) 2007, 2008 Apple Inc. All rights reserved. * *  This library is free software; you can redistribute it and/or *  modify it under the terms of the GNU Library General Public *  License as published by the Free Software Foundation; either *  version 2 of the License, or (at your option) any later version. * *  This library is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU *  Library General Public License for more details. * *  You should have received a copy of the GNU Library General Public License *  along with this library; see the file COPYING.LIB.  If not, write to *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *  Boston, MA 02110-1301, USA. * */#ifndef JSGlobalObject_h#define JSGlobalObject_h#include "JSGlobalData.h"#include "JSVariableObject.h"#include "NumberPrototype.h"#include "StringPrototype.h"#include <wtf/HashSet.h>#include <wtf/OwnPtr.h>namespace JSC {    class ArrayPrototype;    class BooleanPrototype;    class DatePrototype;    class Debugger;    class ErrorConstructor;    class FunctionPrototype;    class GlobalEvalFunction;    class NativeErrorConstructor;    class ProgramCodeBlock;    class RegExpConstructor;    class RegExpPrototype;    class RegisterFile;    struct ActivationStackNode;    struct HashTable;    typedef Vector<ExecState*, 16> ExecStateStack;    class JSGlobalObject : public JSVariableObject {    protected:        using JSVariableObject::JSVariableObjectData;        struct JSGlobalObjectData : public JSVariableObjectData {            JSGlobalObjectData()                : JSVariableObjectData(&symbolTable, 0)                , registerArraySize(0)                , globalScopeChain(NoScopeChain())                , regExpConstructor(0)                , errorConstructor(0)                , evalErrorConstructor(0)                , rangeErrorConstructor(0)                , referenceErrorConstructor(0)                , syntaxErrorConstructor(0)                , typeErrorConstructor(0)                , URIErrorConstructor(0)                , evalFunction(0)                , objectPrototype(0)                , functionPrototype(0)                , arrayPrototype(0)                , booleanPrototype(0)                , stringPrototype(0)                , numberPrototype(0)                , datePrototype(0)                , regExpPrototype(0)            {            }                        virtual ~JSGlobalObjectData()            {            }            size_t registerArraySize;            JSGlobalObject* next;            JSGlobalObject* prev;            Debugger* debugger;                        ScopeChain globalScopeChain;            Register globalCallFrame[RegisterFile::CallFrameHeaderSize];            int recursion;            RegExpConstructor* regExpConstructor;            ErrorConstructor* errorConstructor;            NativeErrorConstructor* evalErrorConstructor;            NativeErrorConstructor* rangeErrorConstructor;            NativeErrorConstructor* referenceErrorConstructor;            NativeErrorConstructor* syntaxErrorConstructor;            NativeErrorConstructor* typeErrorConstructor;            NativeErrorConstructor* URIErrorConstructor;            GlobalEvalFunction* evalFunction;            ObjectPrototype* objectPrototype;            FunctionPrototype* functionPrototype;            ArrayPrototype* arrayPrototype;            BooleanPrototype* booleanPrototype;            StringPrototype* stringPrototype;            NumberPrototype* numberPrototype;            DatePrototype* datePrototype;            RegExpPrototype* regExpPrototype;            RefPtr<Structure> argumentsStructure;            RefPtr<Structure> arrayStructure;            RefPtr<Structure> booleanObjectStructure;            RefPtr<Structure> callbackConstructorStructure;            RefPtr<Structure> callbackFunctionStructure;            RefPtr<Structure> callbackObjectStructure;            RefPtr<Structure> dateStructure;            RefPtr<Structure> emptyObjectStructure;            RefPtr<Structure> errorStructure;            RefPtr<Structure> functionStructure;            RefPtr<Structure> numberObjectStructure;            RefPtr<Structure> prototypeFunctionStructure;            RefPtr<Structure> regExpMatchesArrayStructure;            RefPtr<Structure> regExpStructure;            RefPtr<Structure> stringObjectStructure;            SymbolTable symbolTable;            unsigned profileGroup;            RefPtr<JSGlobalData> globalData;            HashSet<ProgramCodeBlock*> codeBlocks;        };    public:        void* operator new(size_t, JSGlobalData*);        explicit JSGlobalObject()            : JSVariableObject(JSGlobalObject::createStructure(jsNull()), new JSGlobalObjectData)        {            init(this);        }    protected:        JSGlobalObject(PassRefPtr<Structure> structure, JSGlobalObjectData* data, JSObject* thisValue)            : JSVariableObject(structure, data)        {            init(thisValue);        }    public:        virtual ~JSGlobalObject();        virtual void mark();        virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);        virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&, bool& slotIsWriteable);        virtual void put(ExecState*, const Identifier&, JSValuePtr, PutPropertySlot&);        virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValuePtr value, unsigned attributes);        virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunc);        virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunc);        // Linked list of all global objects that use the same JSGlobalData.        JSGlobalObject*& head() { return d()->globalData->head; }        JSGlobalObject* next() { return d()->next; }        // The following accessors return pristine values, even if a script         // replaces the global object's associated property.        RegExpConstructor* regExpConstructor() const { return d()->regExpConstructor; }        ErrorConstructor* errorConstructor() const { return d()->errorConstructor; }        NativeErrorConstructor* evalErrorConstructor() const { return d()->evalErrorConstructor; }        NativeErrorConstructor* rangeErrorConstructor() const { return d()->rangeErrorConstructor; }        NativeErrorConstructor* referenceErrorConstructor() const { return d()->referenceErrorConstructor; }        NativeErrorConstructor* syntaxErrorConstructor() const { return d()->syntaxErrorConstructor; }        NativeErrorConstructor* typeErrorConstructor() const { return d()->typeErrorConstructor; }        NativeErrorConstructor* URIErrorConstructor() const { return d()->URIErrorConstructor; }        GlobalEvalFunction* evalFunction() const { return d()->evalFunction; }        ObjectPrototype* objectPrototype() const { return d()->objectPrototype; }        FunctionPrototype* functionPrototype() const { return d()->functionPrototype; }        ArrayPrototype* arrayPrototype() const { return d()->arrayPrototype; }        BooleanPrototype* booleanPrototype() const { return d()->booleanPrototype; }        StringPrototype* stringPrototype() const { return d()->stringPrototype; }        NumberPrototype* numberPrototype() const { return d()->numberPrototype; }        DatePrototype* datePrototype() const { return d()->datePrototype; }        RegExpPrototype* regExpPrototype() const { return d()->regExpPrototype; }        Structure* argumentsStructure() const { return d()->argumentsStructure.get(); }        Structure* arrayStructure() const { return d()->arrayStructure.get(); }        Structure* booleanObjectStructure() const { return d()->booleanObjectStructure.get(); }        Structure* callbackConstructorStructure() const { return d()->callbackConstructorStructure.get(); }        Structure* callbackFunctionStructure() const { return d()->callbackFunctionStructure.get(); }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -