| 14 | } |
| 15 | |
| 16 | GObject* GObjectPool::getObject(const std::string & url) |
| 17 | { |
| 18 | std::string url2 = UIPackage::normalizeURL(url); |
| 19 | if (url2.length() == 0) |
| 20 | return nullptr; |
| 21 | |
| 22 | GObject* ret; |
| 23 | Vector<GObject*>& arr = _pool[url2]; |
| 24 | if (!arr.empty()) |
| 25 | { |
| 26 | ret = arr.back(); |
| 27 | ret->retain(); |
| 28 | arr.popBack(); |
| 29 | ret->autorelease(); |
| 30 | } |
| 31 | else |
| 32 | ret = UIPackage::createObjectFromURL(url2); |
| 33 | return ret; |
| 34 | } |
| 35 | |
| 36 | void GObjectPool::returnObject(GObject* obj) |
| 37 | { |
no test coverage detected