Changeset 73223 in webkit for trunk/JavaScriptCore/runtime
- Timestamp:
- Dec 2, 2010, 5:16:11 PM (14 years ago)
- Location:
- trunk/JavaScriptCore/runtime
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/Collector.cpp
r72360 r73223 1233 1233 } 1234 1234 1235 GCActivityCallback* Heap::activityCallback() 1236 { 1237 return m_activityCallback.get(); 1238 } 1239 1235 1240 } // namespace JSC -
trunk/JavaScriptCore/runtime/Collector.h
r68893 r73223 99 99 bool isBusy(); // true if an allocation or collection is in progress 100 100 void collectAllGarbage(); 101 102 GCActivityCallback* activityCallback(); 101 103 void setActivityCallback(PassOwnPtr<GCActivityCallback>); 102 104 -
trunk/JavaScriptCore/runtime/GCActivityCallback.h
r64585 r73223 41 41 virtual ~GCActivityCallback() {} 42 42 virtual void operator()() {} 43 virtual void synchronize() {} 43 44 44 45 protected: … … 56 57 57 58 void operator()(); 59 void synchronize(); 58 60 59 61 private: -
trunk/JavaScriptCore/runtime/GCActivityCallbackCF.cpp
r67683 r73223 48 48 49 49 RetainPtr<CFRunLoopTimerRef> timer; 50 RetainPtr<CFRunLoopRef> runLoop; 50 51 CFRunLoopTimerContext context; 51 52 }; 52 53 53 54 const CFTimeInterval decade = 60 * 60 * 24 * 365 * 10; 55 const CFTimeInterval triggerInterval = 2; // seconds 54 56 55 57 void DefaultGCActivityCallbackPlatformData::trigger(CFRunLoopTimerRef, void *info) … … 66 68 memset(&d->context, '\0', sizeof(CFRunLoopTimerContext)); 67 69 d->context.info = heap; 70 d->runLoop = CFRunLoopGetCurrent(); 68 71 d->timer.adoptCF(CFRunLoopTimerCreate(0, decade, decade, 0, 0, DefaultGCActivityCallbackPlatformData::trigger, &d->context)); 69 CFRunLoopAddTimer( CFRunLoopGetCurrent(), d->timer.get(), kCFRunLoopCommonModes);72 CFRunLoopAddTimer(d->runLoop.get(), d->timer.get(), kCFRunLoopCommonModes); 70 73 } 71 74 72 75 DefaultGCActivityCallback::~DefaultGCActivityCallback() 73 76 { 74 CFRunLoopRemoveTimer( CFRunLoopGetCurrent(), d->timer.get(), kCFRunLoopCommonModes);77 CFRunLoopRemoveTimer(d->runLoop.get(), d->timer.get(), kCFRunLoopCommonModes); 75 78 CFRunLoopTimerInvalidate(d->timer.get()); 76 79 d->context.info = 0; 80 d->runLoop = 0; 77 81 d->timer = 0; 78 82 } … … 80 84 void DefaultGCActivityCallback::operator()() 81 85 { 82 CFRunLoopTimerSetNextFireDate(d->timer.get(), CFAbsoluteTimeGetCurrent() + 2); 86 CFRunLoopTimerSetNextFireDate(d->timer.get(), CFAbsoluteTimeGetCurrent() + triggerInterval); 87 } 88 89 void DefaultGCActivityCallback::synchronize() 90 { 91 if (CFRunLoopGetCurrent() == d->runLoop.get()) 92 return; 93 CFRunLoopRemoveTimer(d->runLoop.get(), d->timer.get(), kCFRunLoopCommonModes); 94 d->runLoop = CFRunLoopGetCurrent(); 95 CFRunLoopAddTimer(d->runLoop.get(), d->timer.get(), kCFRunLoopCommonModes); 83 96 } 84 97
Note:
See TracChangeset
for help on using the changeset viewer.