diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2021-02-04 10:16:36 +0100 |
---|---|---|
committer | Ivan Solovev <ivan.solovev@qt.io> | 2021-02-09 17:08:49 +0100 |
commit | 506432c8b62ca0be3738661f9ba1a342db411ace (patch) | |
tree | 3b5691c97ae7a0516f0eec4e0231c1a0b6a79462 /src/plugins/position/serialnmea/qnmeasatelliteinfosource.cpp | |
parent | 5cb7117cbf5c33024a726151587d02ef4052218a (diff) | |
download | qtlocation-506432c8b62ca0be3738661f9ba1a342db411ace.tar.gz |
QtPositioning: refactor QGeoSatelliteInfo
The following changes were implemented for the class:
- Use QExplicitlySharedDataPointer for private d-ptr.
- Implement move-constructor and move-assignment operator.
The moved-from object is left in partially-formed state. Such
behavior is documented.
- Use Q_DECLARE_SHARED to declare the typeinfo as Q_RELOCATABLE_TYPE
and provide a free swap() overload.
- Provide a qHash() overload.
- Provide a QTest::toString() overload.
All these changes are common pattern for Qt value classes.
The benchmark shows that it results in slight performance drop while
constructing a brand new object (most probably because of the overhead
of QSharedData and QExplicitlySharedDataPointer), but also gives a
comparable performance boost for copy constructor and copy assignment.
And of course a significant performance boost on move-operations (which
were just copy-operations previously). Other API calls didn't have any
significant performance impact.
Task-number: QTBUG-90491
Change-Id: I51ed7041c4b9ecd763f045abbb80df5e0dcde8f6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/plugins/position/serialnmea/qnmeasatelliteinfosource.cpp')
-rw-r--r-- | src/plugins/position/serialnmea/qnmeasatelliteinfosource.cpp | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/src/plugins/position/serialnmea/qnmeasatelliteinfosource.cpp b/src/plugins/position/serialnmea/qnmeasatelliteinfosource.cpp index e08bc5e2..a2cd5447 100644 --- a/src/plugins/position/serialnmea/qnmeasatelliteinfosource.cpp +++ b/src/plugins/position/serialnmea/qnmeasatelliteinfosource.cpp @@ -62,7 +62,6 @@ public: QGeoSatelliteInfoPrivateNmea(const QGeoSatelliteInfoPrivate &other); QGeoSatelliteInfoPrivateNmea(const QGeoSatelliteInfoPrivateNmea &other); virtual ~QGeoSatelliteInfoPrivateNmea(); - QGeoSatelliteInfoPrivate *clone() const override; QList<QByteArray> nmeaSentences; }; @@ -79,11 +78,6 @@ QGeoSatelliteInfoPrivateNmea::QGeoSatelliteInfoPrivateNmea(const QGeoSatelliteIn } QGeoSatelliteInfoPrivateNmea::~QGeoSatelliteInfoPrivateNmea() {} - -QGeoSatelliteInfoPrivate *QGeoSatelliteInfoPrivateNmea::clone() const -{ - return new QGeoSatelliteInfoPrivateNmea(*this); -} #else typedef QGeoSatelliteInfoPrivate QGeoSatelliteInfoPrivateNmea; #endif |