dde-dock/frame/util/singleton.h
Fan PengCheng 1e3d90f62b refactor: 去除对后端Display服务的依赖
后端服务数据变化有快有慢,可能导致任务栏不正确时间进行响应,从而导致显示异常,对应的单元测试代码已添加

Log: 重构显示逻辑,保障任务栏显示正常
Change-Id: I62f06c133945a625c2c2ec2b2e21809be27543b6
2021-04-12 16:53:09 +08:00

32 lines
666 B
C++

/**
* Copyright (C) 2016 Deepin Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
**/
#pragma once
#include <memory>
using namespace std;
template <class T>
class Singleton
{
public:
static inline T *instance() {
static T* _instance = new T;
return _instance;
}
protected:
Singleton(void) {}
~Singleton(void) {}
Singleton(const Singleton &) {}
Singleton &operator= (const Singleton &) {}
};