Changeset 28527 in webkit for trunk/JavaScriptCore/kjs/JSGlobalObject.h
- Timestamp:
- Dec 7, 2007, 2:05:55 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/JSGlobalObject.h
r28468 r28527 24 24 #define KJS_GlobalObject_h 25 25 26 #include " object.h"26 #include "JSVariableObject.h" 27 27 28 28 namespace KJS { … … 68 68 enum CompatMode { NativeMode, IECompat, NetscapeCompat }; 69 69 70 class JSGlobalObject : public JS Object {70 class JSGlobalObject : public JSVariableObject { 71 71 protected: 72 struct JSGlobalObjectData { 72 using JSVariableObject::JSVariableObjectData; 73 74 struct JSGlobalObjectData : public JSVariableObjectData { 73 75 JSGlobalObjectData(JSGlobalObject* globalObject) 74 : globalExec(globalObject, globalObject, 0) 76 : JSVariableObjectData(&inlineSymbolTable) 77 , globalExec(globalObject, globalObject, 0) 75 78 { 76 79 } … … 81 84 Debugger* debugger; 82 85 CompatMode compatMode; 83 86 84 87 ExecState globalExec; 85 88 ExecState* currentExec; … … 124 127 NativeErrorPrototype* typeErrorPrototype; 125 128 NativeErrorPrototype* URIErrorPrototype; 129 130 SymbolTable inlineSymbolTable; 126 131 }; 127 132 128 133 public: 129 134 JSGlobalObject() 135 : JSVariableObject(new JSGlobalObjectData(this)) 130 136 { 131 137 init(); … … 134 140 protected: 135 141 JSGlobalObject(JSValue* proto) 136 : JS Object(proto)142 : JSVariableObject(proto, new JSGlobalObjectData(this)) 137 143 { 138 144 init(); … … 144 150 // Linked list of all global objects. 145 151 static JSGlobalObject* head() { return s_head; } 146 JSGlobalObject* next() { return d ->next; }152 JSGlobalObject* next() { return d()->next; } 147 153 148 154 // Resets the global object to contain only built-in properties, sets … … 155 161 // replaces the global object's associated property. 156 162 157 ObjectObjectImp* objectConstructor() const { return d ->objectConstructor; }158 FunctionObjectImp* functionConstructor() const { return d ->functionConstructor; }159 ArrayObjectImp* arrayConstructor() const { return d ->arrayConstructor; }160 BooleanObjectImp* booleanConstructor() const { return d ->booleanConstructor; }161 StringObjectImp* stringConstructor() const{ return d ->stringConstructor; }162 NumberObjectImp* numberConstructor() const{ return d ->numberConstructor; }163 DateObjectImp* dateConstructor() const{ return d ->dateConstructor; }164 RegExpObjectImp* regExpConstructor() const { return d ->regExpConstructor; }165 ErrorObjectImp* errorConstructor() const { return d ->errorConstructor; }166 NativeErrorImp* evalErrorConstructor() const { return d ->evalErrorConstructor; }167 NativeErrorImp* rangeErrorConstructor() const { return d ->rangeErrorConstructor; }168 NativeErrorImp* referenceErrorConstructor() const { return d ->referenceErrorConstructor; }169 NativeErrorImp* syntaxErrorConstructor() const { return d ->syntaxErrorConstructor; }170 NativeErrorImp* typeErrorConstructor() const { return d ->typeErrorConstructor; }171 NativeErrorImp* URIErrorConstructor() const { return d ->URIErrorConstructor; }172 173 ObjectPrototype* objectPrototype() const { return d ->objectPrototype; }174 FunctionPrototype* functionPrototype() const { return d ->functionPrototype; }175 ArrayPrototype* arrayPrototype() const { return d ->arrayPrototype; }176 BooleanPrototype* booleanPrototype() const { return d ->booleanPrototype; }177 StringPrototype* stringPrototype() const { return d ->stringPrototype; }178 NumberPrototype* numberPrototype() const { return d ->numberPrototype; }179 DatePrototype* datePrototype() const { return d ->datePrototype; }180 RegExpPrototype* regExpPrototype() const { return d ->regExpPrototype; }181 ErrorPrototype* errorPrototype() const { return d ->errorPrototype; }182 NativeErrorPrototype* evalErrorPrototype() const { return d ->evalErrorPrototype; }183 NativeErrorPrototype* rangeErrorPrototype() const { return d ->rangeErrorPrototype; }184 NativeErrorPrototype* referenceErrorPrototype() const { return d ->referenceErrorPrototype; }185 NativeErrorPrototype* syntaxErrorPrototype() const { return d ->syntaxErrorPrototype; }186 NativeErrorPrototype* typeErrorPrototype() const { return d ->typeErrorPrototype; }187 NativeErrorPrototype* URIErrorPrototype() const { return d ->URIErrorPrototype; }163 ObjectObjectImp* objectConstructor() const { return d()->objectConstructor; } 164 FunctionObjectImp* functionConstructor() const { return d()->functionConstructor; } 165 ArrayObjectImp* arrayConstructor() const { return d()->arrayConstructor; } 166 BooleanObjectImp* booleanConstructor() const { return d()->booleanConstructor; } 167 StringObjectImp* stringConstructor() const{ return d()->stringConstructor; } 168 NumberObjectImp* numberConstructor() const{ return d()->numberConstructor; } 169 DateObjectImp* dateConstructor() const{ return d()->dateConstructor; } 170 RegExpObjectImp* regExpConstructor() const { return d()->regExpConstructor; } 171 ErrorObjectImp* errorConstructor() const { return d()->errorConstructor; } 172 NativeErrorImp* evalErrorConstructor() const { return d()->evalErrorConstructor; } 173 NativeErrorImp* rangeErrorConstructor() const { return d()->rangeErrorConstructor; } 174 NativeErrorImp* referenceErrorConstructor() const { return d()->referenceErrorConstructor; } 175 NativeErrorImp* syntaxErrorConstructor() const { return d()->syntaxErrorConstructor; } 176 NativeErrorImp* typeErrorConstructor() const { return d()->typeErrorConstructor; } 177 NativeErrorImp* URIErrorConstructor() const { return d()->URIErrorConstructor; } 178 179 ObjectPrototype* objectPrototype() const { return d()->objectPrototype; } 180 FunctionPrototype* functionPrototype() const { return d()->functionPrototype; } 181 ArrayPrototype* arrayPrototype() const { return d()->arrayPrototype; } 182 BooleanPrototype* booleanPrototype() const { return d()->booleanPrototype; } 183 StringPrototype* stringPrototype() const { return d()->stringPrototype; } 184 NumberPrototype* numberPrototype() const { return d()->numberPrototype; } 185 DatePrototype* datePrototype() const { return d()->datePrototype; } 186 RegExpPrototype* regExpPrototype() const { return d()->regExpPrototype; } 187 ErrorPrototype* errorPrototype() const { return d()->errorPrototype; } 188 NativeErrorPrototype* evalErrorPrototype() const { return d()->evalErrorPrototype; } 189 NativeErrorPrototype* rangeErrorPrototype() const { return d()->rangeErrorPrototype; } 190 NativeErrorPrototype* referenceErrorPrototype() const { return d()->referenceErrorPrototype; } 191 NativeErrorPrototype* syntaxErrorPrototype() const { return d()->syntaxErrorPrototype; } 192 NativeErrorPrototype* typeErrorPrototype() const { return d()->typeErrorPrototype; } 193 NativeErrorPrototype* URIErrorPrototype() const { return d()->URIErrorPrototype; } 188 194 189 195 void saveBuiltins(SavedBuiltins&) const; 190 196 void restoreBuiltins(const SavedBuiltins&); 191 197 192 void setTimeoutTime(unsigned timeoutTime) { d ->timeoutTime = timeoutTime; }198 void setTimeoutTime(unsigned timeoutTime) { d()->timeoutTime = timeoutTime; } 193 199 void startTimeoutCheck(); 194 200 void stopTimeoutCheck(); 195 201 bool timedOut(); 196 202 197 Debugger* debugger() const { return d ->debugger; }198 void setDebugger(Debugger* debugger) { d ->debugger = debugger; }199 200 void setCurrentExec(ExecState* exec) { d ->currentExec = exec; }201 ExecState* currentExec() const { return d ->currentExec; }203 Debugger* debugger() const { return d()->debugger; } 204 void setDebugger(Debugger* debugger) { d()->debugger = debugger; } 205 206 void setCurrentExec(ExecState* exec) { d()->currentExec = exec; } 207 ExecState* currentExec() const { return d()->currentExec; } 202 208 203 209 // FIXME: Let's just pick one compatible behavior and go with it. 204 void setCompatMode(CompatMode mode) { d ->compatMode = mode; }205 CompatMode compatMode() const { return d ->compatMode; }210 void setCompatMode(CompatMode mode) { d()->compatMode = mode; } 211 CompatMode compatMode() const { return d()->compatMode; } 206 212 207 int recursion() { return d ->recursion; }208 void incRecursion() { ++d ->recursion; }209 void decRecursion() { --d ->recursion; }213 int recursion() { return d()->recursion; } 214 void incRecursion() { ++d()->recursion; } 215 void decRecursion() { --d()->recursion; } 210 216 211 217 virtual void mark(); … … 218 224 219 225 virtual bool isSafeScript(const JSGlobalObject*) const { return true; } 220 221 protected:222 std::auto_ptr<JSGlobalObjectData> d;223 226 224 227 private: 225 228 void init(); 229 230 JSGlobalObjectData* d() const { return static_cast<JSGlobalObjectData*>(JSVariableObject::d); } 226 231 227 232 bool checkTimeout(); … … 233 238 inline bool JSGlobalObject::timedOut() 234 239 { 235 d ->tickCount++;236 237 if (d ->tickCount != d->ticksUntilNextTimeoutCheck)240 d()->tickCount++; 241 242 if (d()->tickCount != d()->ticksUntilNextTimeoutCheck) 238 243 return false; 239 244
Note:
See TracChangeset
for help on using the changeset viewer.