Changeset 181010 in webkit for trunk/Source/JavaScriptCore/API/JSWrapperMap.mm
- Timestamp:
- Mar 4, 2015, 12:00:00 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSWrapperMap.mm
r180467 r181010 38 38 #import "ObjcRuntimeExtras.h" 39 39 #import "WeakGCMap.h" 40 #import "WeakGCMapInlines.h" 40 41 #import <wtf/HashSet.h> 41 42 #import <wtf/TCSpinLock.h> … … 547 548 JSContext *m_context; 548 549 NSMutableDictionary *m_classMap; 549 JSC::WeakGCMap<id, JSC::JSObject> m_cachedJSWrappers;550 std::unique_ptr<JSC::WeakGCMap<id, JSC::JSObject>> m_cachedJSWrappers; 550 551 NSMapTable *m_cachedObjCWrappers; 551 552 } … … 560 561 NSPointerFunctionsOptions valueOptions = NSPointerFunctionsWeakMemory | NSPointerFunctionsObjectPersonality; 561 562 m_cachedObjCWrappers = [[NSMapTable alloc] initWithKeyOptions:keyOptions valueOptions:valueOptions capacity:0]; 562 563 564 m_cachedJSWrappers = std::make_unique<JSC::WeakGCMap<id, JSC::JSObject>>(toJS([context JSGlobalContextRef])->vm()); 565 563 566 m_context = context; 564 567 m_classMap = [[NSMutableDictionary alloc] init]; … … 591 594 - (JSValue *)jsWrapperForObject:(id)object 592 595 { 593 JSC::JSObject* jsWrapper = m_cachedJSWrappers .get(object);596 JSC::JSObject* jsWrapper = m_cachedJSWrappers->get(object); 594 597 if (jsWrapper) 595 598 return [JSValue valueWithJSValueRef:toRef(jsWrapper) inContext:m_context]; … … 607 610 // (2) A long lived object may rack up many JSValues. When the contexts are released these will unprotect the associated JavaScript objects, 608 611 // but still, would probably nicer if we made it so that only one associated object was required, broadcasting object dealloc. 609 m_cachedJSWrappers .set(object, jsWrapper);612 m_cachedJSWrappers->set(object, jsWrapper); 610 613 return [JSValue valueWithJSValueRef:toRef(jsWrapper) inContext:m_context]; 611 614 }
Note:
See TracChangeset
for help on using the changeset viewer.