2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-05 00:55:12 +00:00

Replace gsl::not_null<T*> with just not_null<T*>.

This commit is contained in:
John Preston
2017-08-17 11:31:24 +03:00
parent cc4023d26a
commit b3da99c302
148 changed files with 966 additions and 963 deletions

View File

@@ -33,7 +33,7 @@ constexpr auto kSpecialRequestTimeoutMs = 6000; // 4 seconds timeout for it to w
} // namespace
ConfigLoader::ConfigLoader(gsl::not_null<Instance*> instance, RPCDoneHandlerPtr onDone, RPCFailHandlerPtr onFail) : _instance(instance)
ConfigLoader::ConfigLoader(not_null<Instance*> instance, RPCDoneHandlerPtr onDone, RPCFailHandlerPtr onFail) : _instance(instance)
, _doneHandler(onDone)
, _failHandler(onFail) {
_enumDCTimer.setCallback([this] { enumerate(); });

View File

@@ -33,7 +33,7 @@ namespace internal {
class ConfigLoader : public base::enable_weak_from_this {
public:
ConfigLoader(gsl::not_null<Instance*> instance, RPCDoneHandlerPtr onDone, RPCFailHandlerPtr onFail);
ConfigLoader(not_null<Instance*> instance, RPCDoneHandlerPtr onDone, RPCFailHandlerPtr onFail);
~ConfigLoader();
void load();
@@ -49,7 +49,7 @@ private:
void terminateRequest();
void terminateSpecialRequest();
gsl::not_null<Instance*> _instance;
not_null<Instance*> _instance;
base::Timer _enumDCTimer;
DcId _enumCurrent = 0;
mtpRequestId _enumRequest = 0;

View File

@@ -33,7 +33,7 @@ public:
}
private:
gsl::not_null<DcOptions*> _that;
not_null<DcOptions*> _that;
QWriteLocker _lock;
};

View File

@@ -36,7 +36,7 @@ constexpr auto kSpecialRequestTimeoutMs = 6000; // 4 seconds timeout for it to w
} // namespace
Dcenter::Dcenter(gsl::not_null<Instance*> instance, DcId dcId, AuthKeyPtr &&key)
Dcenter::Dcenter(not_null<Instance*> instance, DcId dcId, AuthKeyPtr &&key)
: _instance(instance)
, _id(dcId)
, _key(std::move(key)) {

View File

@@ -32,7 +32,7 @@ class Dcenter : public QObject {
Q_OBJECT
public:
Dcenter(gsl::not_null<Instance*> instance, DcId dcId, AuthKeyPtr &&key);
Dcenter(not_null<Instance*> instance, DcId dcId, AuthKeyPtr &&key);
QReadWriteLock *keyMutex() const;
const AuthKeyPtr &getKey() const;
@@ -59,7 +59,7 @@ private slots:
private:
mutable QReadWriteLock keyLock;
mutable QMutex initLock;
gsl::not_null<Instance*> _instance;
not_null<Instance*> _instance;
DcId _id = 0;
AuthKeyPtr _key;
bool _connectionInited = false;

View File

@@ -38,7 +38,7 @@ namespace MTP {
class Instance::Private : private Sender {
public:
Private(gsl::not_null<Instance*> instance, gsl::not_null<DcOptions*> options, Instance::Mode mode);
Private(not_null<Instance*> instance, not_null<DcOptions*> options, Instance::Mode mode);
void start(Config &&config);
@@ -50,7 +50,7 @@ public:
AuthKeysList getKeysForWrite() const;
void addKeysForDestroy(AuthKeysList &&keys);
gsl::not_null<DcOptions*> dcOptions();
not_null<DcOptions*> dcOptions();
void requestConfig();
void requestCDNConfig();
@@ -137,8 +137,8 @@ private:
void checkDelayedRequests();
gsl::not_null<Instance*> _instance;
gsl::not_null<DcOptions*> _dcOptions;
not_null<Instance*> _instance;
not_null<DcOptions*> _dcOptions;
Instance::Mode _mode = Instance::Mode::Normal;
DcId _mainDcId = Config::kDefaultMainDc;
@@ -194,7 +194,7 @@ private:
};
Instance::Private::Private(gsl::not_null<Instance*> instance, gsl::not_null<DcOptions*> options, Instance::Mode mode) : Sender()
Instance::Private::Private(not_null<Instance*> instance, not_null<DcOptions*> options, Instance::Mode mode) : Sender()
, _instance(instance)
, _dcOptions(options)
, _mode(mode) {
@@ -556,7 +556,7 @@ void Instance::Private::addKeysForDestroy(AuthKeysList &&keys) {
}
}
gsl::not_null<DcOptions*> Instance::Private::dcOptions() {
not_null<DcOptions*> Instance::Private::dcOptions() {
return _dcOptions;
}
@@ -1272,7 +1272,7 @@ void Instance::Private::prepareToDestroy() {
MustNotCreateSessions = true;
}
Instance::Instance(gsl::not_null<DcOptions*> options, Mode mode, Config &&config) : QObject()
Instance::Instance(not_null<DcOptions*> options, Mode mode, Config &&config) : QObject()
, _private(std::make_unique<Private>(this, options, mode)) {
_private->start(std::move(config));
}
@@ -1369,7 +1369,7 @@ void Instance::addKeysForDestroy(AuthKeysList &&keys) {
_private->addKeysForDestroy(std::move(keys));
}
gsl::not_null<DcOptions*> Instance::dcOptions() {
not_null<DcOptions*> Instance::dcOptions() {
return _private->dcOptions();
}

View File

@@ -52,7 +52,7 @@ public:
SpecialConfigRequester,
KeysDestroyer,
};
Instance(gsl::not_null<DcOptions*> options, Mode mode, Config &&config);
Instance(not_null<DcOptions*> options, Mode mode, Config &&config);
Instance(const Instance &other) = delete;
Instance &operator=(const Instance &other) = delete;
@@ -67,7 +67,7 @@ public:
AuthKeysList getKeysForWrite() const;
void addKeysForDestroy(AuthKeysList &&keys);
gsl::not_null<DcOptions*> dcOptions();
not_null<DcOptions*> dcOptions();
template <typename TRequest>
mtpRequestId send(const TRequest &request, RPCResponseHandler callbacks = RPCResponseHandler(), ShiftedDcId dcId = 0, TimeMs msCanWait = 0, mtpRequestId after = 0) {

View File

@@ -64,7 +64,7 @@ class Sender {
using Callback = typename Policy::Callback;
public:
DoneHandler(gsl::not_null<Sender*> sender, Callback handler) : _sender(sender), _handler(std::move(handler)) {
DoneHandler(not_null<Sender*> sender, Callback handler) : _sender(sender), _handler(std::move(handler)) {
}
void operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override {
@@ -79,7 +79,7 @@ class Sender {
}
private:
gsl::not_null<Sender*> _sender;
not_null<Sender*> _sender;
Callback _handler;
};
@@ -103,7 +103,7 @@ class Sender {
using Callback = typename Policy::Callback;
public:
FailHandler(gsl::not_null<Sender*> sender, Callback handler, FailSkipPolicy skipPolicy)
FailHandler(not_null<Sender*> sender, Callback handler, FailSkipPolicy skipPolicy)
: _sender(sender)
, _handler(std::move(handler))
, _skipPolicy(skipPolicy) {
@@ -130,13 +130,13 @@ class Sender {
}
private:
gsl::not_null<Sender*> _sender;
not_null<Sender*> _sender;
Callback _handler;
FailSkipPolicy _skipPolicy = FailSkipPolicy::Simple;
};
explicit RequestBuilder(gsl::not_null<Sender*> sender) noexcept : _sender(sender) {
explicit RequestBuilder(not_null<Sender*> sender) noexcept : _sender(sender) {
}
RequestBuilder(RequestBuilder &&other) = default;
@@ -183,7 +183,7 @@ class Sender {
return _afterRequestId;
}
gsl::not_null<Sender*> sender() const noexcept {
not_null<Sender*> sender() const noexcept {
return _sender;
}
void registerRequest(mtpRequestId requestId) {
@@ -191,7 +191,7 @@ class Sender {
}
private:
gsl::not_null<Sender*> _sender;
not_null<Sender*> _sender;
ShiftedDcId _dcId = 0;
TimeMs _canWait = 0;
RPCDoneHandlerPtr _done;
@@ -209,7 +209,7 @@ public:
class SpecificRequestBuilder : public RequestBuilder {
private:
friend class Sender;
SpecificRequestBuilder(gsl::not_null<Sender*> sender, Request &&request) noexcept : RequestBuilder(sender), _request(std::move(request)) {
SpecificRequestBuilder(not_null<Sender*> sender, Request &&request) noexcept : RequestBuilder(sender), _request(std::move(request)) {
}
SpecificRequestBuilder(SpecificRequestBuilder &&other) = default;
@@ -265,7 +265,7 @@ public:
class SentRequestWrap {
private:
friend class Sender;
SentRequestWrap(gsl::not_null<Sender*> sender, mtpRequestId requestId) : _sender(sender), _requestId(requestId) {
SentRequestWrap(not_null<Sender*> sender, mtpRequestId requestId) : _sender(sender), _requestId(requestId) {
}
public:
@@ -274,7 +274,7 @@ public:
}
private:
gsl::not_null<Sender*> _sender;
not_null<Sender*> _sender;
mtpRequestId _requestId = 0;
};
@@ -298,7 +298,7 @@ public:
request.handled();
}
}
gsl::not_null<Instance*> requestMTP() const {
not_null<Instance*> requestMTP() const {
return MainInstance();
}

View File

@@ -86,7 +86,7 @@ void SessionData::clear(Instance *instance) {
instance->clearCallbacksDelayed(clearCallbacks);
}
Session::Session(gsl::not_null<Instance*> instance, ShiftedDcId shiftedDcId) : QObject()
Session::Session(not_null<Instance*> instance, ShiftedDcId shiftedDcId) : QObject()
, _instance(instance)
, data(this)
, dcWithShift(shiftedDcId) {

View File

@@ -101,7 +101,7 @@ inline bool ResponseNeedsAck(const SerializedMessage &response) {
class Session;
class SessionData {
public:
SessionData(gsl::not_null<Session*> creator) : _owner(creator) {
SessionData(not_null<Session*> creator) : _owner(creator) {
}
void setSession(uint64 session) {
@@ -166,27 +166,27 @@ public:
_keyChecked = checked;
}
gsl::not_null<QReadWriteLock*> keyMutex() const;
not_null<QReadWriteLock*> keyMutex() const;
gsl::not_null<QReadWriteLock*> toSendMutex() const {
not_null<QReadWriteLock*> toSendMutex() const {
return &_toSendLock;
}
gsl::not_null<QReadWriteLock*> haveSentMutex() const {
not_null<QReadWriteLock*> haveSentMutex() const {
return &_haveSentLock;
}
gsl::not_null<QReadWriteLock*> toResendMutex() const {
not_null<QReadWriteLock*> toResendMutex() const {
return &_toResendLock;
}
gsl::not_null<QReadWriteLock*> wereAckedMutex() const {
not_null<QReadWriteLock*> wereAckedMutex() const {
return &_wereAckedLock;
}
gsl::not_null<QReadWriteLock*> receivedIdsMutex() const {
not_null<QReadWriteLock*> receivedIdsMutex() const {
return &_receivedIdsLock;
}
gsl::not_null<QReadWriteLock*> haveReceivedMutex() const {
not_null<QReadWriteLock*> haveReceivedMutex() const {
return &_haveReceivedLock;
}
gsl::not_null<QReadWriteLock*> stateRequestMutex() const {
not_null<QReadWriteLock*> stateRequestMutex() const {
return &_stateRequestLock;
}
@@ -239,10 +239,10 @@ public:
return _stateRequest;
}
gsl::not_null<Session*> owner() {
not_null<Session*> owner() {
return _owner;
}
gsl::not_null<const Session*> owner() const {
not_null<const Session*> owner() const {
return _owner;
}
@@ -261,7 +261,7 @@ private:
uint32 _messagesSent = 0;
gsl::not_null<Session*> _owner;
not_null<Session*> _owner;
AuthKeyPtr _authKey;
bool _keyChecked = false;
@@ -295,7 +295,7 @@ class Session : public QObject {
Q_OBJECT
public:
Session(gsl::not_null<Instance*> instance, ShiftedDcId shiftedDcId);
Session(not_null<Instance*> instance, ShiftedDcId shiftedDcId);
void start();
void restart();
@@ -357,7 +357,7 @@ private:
mtpRequest getRequest(mtpRequestId requestId);
bool rpcErrorOccured(mtpRequestId requestId, const RPCFailHandlerPtr &onFail, const RPCError &err);
gsl::not_null<Instance*> _instance;
not_null<Instance*> _instance;
std::unique_ptr<Connection> _connection;
bool _killed = false;
@@ -378,7 +378,7 @@ private:
};
inline gsl::not_null<QReadWriteLock*> SessionData::keyMutex() const {
inline not_null<QReadWriteLock*> SessionData::keyMutex() const {
return _owner->keyMutex();
}