00001 /* 00002 * Sun Public License Notice 00003 * 00004 * The contents of this file are subject to the Sun Public License 00005 * Version 1.0 (the "License"); you may not use this file except 00006 * in compliance with the License. A copy of the License is available 00007 * at http://www.sun.com/ 00008 * 00009 * The Original Code is the Java Profiler module. The Initial Developers 00010 * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, 00011 * Lukas Petru and Marek Przeczek. 00012 * 00013 * Portions created by Jan Stola are Copyright (C) 2000-2001. 00014 * All Rights Reserved. 00015 * 00016 * Portions created by Pavel Vacha are Copyright (C) 2000-2001. 00017 * All Rights Reserved. 00018 * 00019 * Portions created by Michal Pise are Copyright (C) 2000-2001. 00020 * All Rights Reserved. 00021 * 00022 * Portions created by Petr Luner are Copyright (C) 2000-2001. 00023 * All Rights Reserved. 00024 * 00025 * Portions created by Lukas Petru are Copyright (C) 2000-2001. 00026 * All Rights Reserved. 00027 * 00028 * Portions created by Marek Przeczek are Copyright (C) 2000-2001. 00029 * All Rights Reserved. 00030 * 00031 * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, 00032 * Lukas Petru and Marek Przeczek. 00033 */ 00034 00035 #ifndef _ALLOC_THREAD_OBJECT_H_ 00036 #define _ALLOC_THREAD_OBJECT_H_ 00037 00038 #include "../main/includes.h" 00039 #include "../list/listItem.h" 00040 #include "../alloc/allocAbstractStatThreadObject.h" 00041 #include "../commun2/idObject.h" 00042 #include "../list/list.h" 00043 #include "../alloc/allocThreadObjectMethod.h" 00044 #include "../alloc/allocThreadObjectKey.h" 00045 #include "../allocator/allocator.h" 00046 00057 class AllocThreadObject: public LI1, 00058 public LI2, 00059 public LI3, 00060 public AllocAbstractStatThreadObject, 00061 public IdObject { 00062 public: 00063 00065 Thread* thread; 00066 00068 AllocObject* object; 00069 00071 List<AllocThreadObjectMethod,LI1> threadObjectMethods; 00072 00073 public: 00074 00076 AllocThreadObject() : 00077 00078 thread( NULL), 00079 object( NULL) 00080 00081 {} 00082 00084 virtual ~AllocThreadObject() {} 00085 00094 virtual void addMemoryStat( jint size); 00095 00104 virtual void subMemoryStat( jint size); 00105 00109 virtual void clearFlag(); 00110 00119 const AllocThreadObjectKey& getKey(AllocThreadObjectKey& key); 00120 00130 int operator==(const AllocThreadObjectKey& key); 00131 00138 static int hashKey(const AllocThreadObjectKey& key); 00139 00142 void deactivate(); 00143 00144 #ifdef USE_ALLOCATOR 00145 private: 00146 00148 static Allocator _allocator; 00149 00150 public: 00151 00154 void* operator new( size_t sz) { return _allocator.get( sz);} 00155 00158 void operator delete( void* unit) { _allocator.put( unit);} 00159 #endif 00160 00161 public: 00162 00167 virtual eClassIdent getClassIdent() { return ALLOC_THREAD_OBJECT;} 00168 00175 virtual int isActive(); 00176 00182 virtual int isChanged() { return (activeChanged() || dataChanged());} // order dependent ! 00183 00186 virtual void setUnchanged(); 00187 }; 00188 00189 #endif // _ALLOC_THREAD_OBJECT_H_