Change-Id: I80338abf1574e3560f400fde69a33787bfc9509a
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
void GarbageCollector::Register( BaseWrappedObject* object )
{
void GarbageCollector::Register( BaseWrappedObject* object )
{
- mObjectMap.insert( object );
+ mObjectMap.PushBack( object );
};
void GarbageCollector::UnRegister( BaseWrappedObject* object )
{
};
void GarbageCollector::UnRegister( BaseWrappedObject* object )
{
- mObjectMap.erase( object );
+ for( ObjectMap::Iterator iter = mObjectMap.Begin(); iter != mObjectMap.End(); ++iter )
+ {
+ if( *iter == object )
+ {
+ mObjectMap.Erase( iter );
+ return;
+ }
+ }
}
void GarbageCollector::GarbageCollect()
{
}
void GarbageCollector::GarbageCollect()
{
- for( ObjectMap::iterator iter = mObjectMap.begin(); iter != mObjectMap.end(); )
+ for( ObjectMap::Iterator iter = mObjectMap.Begin(); iter != mObjectMap.End(); ++iter )
{
BaseWrappedObject* object = *iter;
{
BaseWrappedObject* object = *iter;
- iter++; // iterator will be invalidated if we delete the object first.
delete object; // object will call GarbageCollector.UnRegister
}
delete object; // object will call GarbageCollector.UnRegister
}
#define __DALI_V8PLUGIN_GARBAGE_COLLECTOR_H__
/*
#define __DALI_V8PLUGIN_GARBAGE_COLLECTOR_H__
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/dali-vector.h>
// INTERNAL INCLUDES
#include <interfaces/garbage-collector-interface.h>
// INTERNAL INCLUDES
#include <interfaces/garbage-collector-interface.h>
-#include <dali/devel-api/common/set-wrapper.h>
-
*/
virtual void GarbageCollect();
*/
virtual void GarbageCollect();
private:
/**
* Map between dali wrapped object (void *)
*/
private:
/**
* Map between dali wrapped object (void *)
*/
- typedef std::set< BaseWrappedObject* > ObjectMap;
+ typedef Dali::Vector< BaseWrappedObject* > ObjectMap;
ObjectMap mObjectMap; ///< lookup
};
ObjectMap mObjectMap; ///< lookup
};