1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

GC: Eliminate unused code. v5.0.84

This commit is contained in:
winlin 2022-10-30 12:42:37 +08:00
parent 7d9dc69ae1
commit ef0aefd546
8 changed files with 20 additions and 43 deletions

View file

@ -125,11 +125,11 @@ private:
};
// A simple lazy-sweep GC, just wait for a long time to delete the disposable resources.
class SrsSweepGc : public ISrsLazyGc
class SrsLazySweepGc : public ISrsLazyGc
{
public:
SrsSweepGc();
virtual ~SrsSweepGc();
SrsLazySweepGc();
virtual ~SrsLazySweepGc();
public:
virtual srs_error_t start();
virtual void remove(SrsLazyObject* c);
@ -144,21 +144,19 @@ class SrsLazyObjectWrapper : public ISrsResource
{
private:
T* resource_;
ISrsResource* wrapper_;
bool is_root_;
public:
SrsLazyObjectWrapper(T* resource = NULL, ISrsResource* wrapper = NULL) {
wrapper_ = wrapper ? wrapper : this;
resource_ = resource ? resource : new T();
resource_->gc_use(wrapper_);
resource_->gc_use();
is_root_ = !resource;
if (!resource) {
resource_->gc_set_creator_wrapper(wrapper_);
resource_->gc_set_creator_wrapper(wrapper ? wrapper : this);
}
}
virtual ~SrsLazyObjectWrapper() {
resource_->gc_dispose(wrapper_);
resource_->gc_dispose();
if (is_root_) {
resource_->gc_set_creator_wrapper(NULL);