Ignore:
Timestamp:
Apr 5, 2010, 9:18:18 PM (15 years ago)
Author:
[email protected]
Message:

2010-04-05 Oliver Hunt <[email protected]>

Reviewed by Gavin Barraclough.

Support weak maps in JSC
https://bugs.webkit.org/show_bug.cgi?id=37132

Expose an API to allow creation of a map for storing
weak JS references.

  • API/JSWeakObjectMapRefInternal.h: Added. (OpaqueJSWeakObjectMap::create): (OpaqueJSWeakObjectMap::map): (OpaqueJSWeakObjectMap::~OpaqueJSWeakObjectMap): (OpaqueJSWeakObjectMap::OpaqueJSWeakObjectMap):
  • API/JSWeakObjectMapRefPrivate.cpp: Added.
  • API/JSWeakObjectMapRefPrivate.h: Added.
  • JavaScriptCore.exp:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • runtime/JSGlobalObject.h: (JSC::JSGlobalObject::registerWeakMap): (JSC::JSGlobalObject::deregisterWeakMap):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSGlobalObject.h

    r54022 r57120  
    2626#include "JSGlobalData.h"
    2727#include "JSVariableObject.h"
     28#include "JSWeakObjectMapRefInternal.h"
    2829#include "NativeFunctionWrapper.h"
    2930#include "NumberPrototype.h"
     
    5758    protected:
    5859        using JSVariableObject::JSVariableObjectData;
     60        typedef HashSet<RefPtr<OpaqueJSWeakObjectMap> > WeakMapSet;
    5961
    6062        struct JSGlobalObjectData : public JSVariableObjectData {
     
    154156
    155157            HashSet<GlobalCodeBlock*> codeBlocks;
     158            WeakMapSet weakMaps;
    156159        };
    157160
     
    271274        }
    272275
     276        void registerWeakMap(OpaqueJSWeakObjectMap* map)
     277        {
     278            d()->weakMaps.add(map);
     279        }
     280
     281        void deregisterWeakMap(OpaqueJSWeakObjectMap* map)
     282        {
     283            d()->weakMaps.remove(map);
     284        }
     285
    273286    protected:
    274287
Note: See TracChangeset for help on using the changeset viewer.