commit 60dddd0a2a486522819b15ad4d74721f5c1006c5
parent 8119220fbc603160a1b46bbb99f260bd590c3d2d
Author: Nazım Can Altınova <canaltinova@gmail.com>
Date: Tue, 21 Oct 2025 23:59:06 +0000
Bug 1979114 - Make ProfileGenerationAdditionalInformation MoveOnly and remove the copy constructors of additional information structs r=mstange,profiler-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D259322
Diffstat:
3 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/tools/profiler/gecko/ProfilerTypes.ipdlh b/tools/profiler/gecko/ProfilerTypes.ipdlh
@@ -4,7 +4,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
-using struct mozilla::ProfileGenerationAdditionalInformation from "ProfileAdditionalInformation.h";
+[MoveOnly] using struct mozilla::ProfileGenerationAdditionalInformation from
+ "ProfileAdditionalInformation.h";
namespace mozilla {
diff --git a/tools/profiler/gecko/nsProfiler.h b/tools/profiler/gecko/nsProfiler.h
@@ -52,7 +52,7 @@ class nsProfiler final : public nsIProfiler {
mozilla::MozPromise<mozilla::void_t, nsresult, true>;
using GatheringPromise =
mozilla::MozPromise<mozilla::ProfileAndAdditionalInformation, nsresult,
- false>;
+ true>;
using SymbolTablePromise =
mozilla::MozPromise<mozilla::SymbolTable, nsresult, true>;
diff --git a/tools/profiler/public/ProfileAdditionalInformation.h b/tools/profiler/public/ProfileAdditionalInformation.h
@@ -36,6 +36,16 @@ struct ProfileGenerationAdditionalInformation {
size_t SizeOf() const { return mSharedLibraries.SizeOf(); }
+ ProfileGenerationAdditionalInformation(
+ const ProfileGenerationAdditionalInformation& other) = delete;
+ ProfileGenerationAdditionalInformation& operator=(
+ const ProfileGenerationAdditionalInformation&) = delete;
+
+ ProfileGenerationAdditionalInformation(
+ ProfileGenerationAdditionalInformation&& other) = default;
+ ProfileGenerationAdditionalInformation& operator=(
+ ProfileGenerationAdditionalInformation&& other) = default;
+
void Append(ProfileGenerationAdditionalInformation&& aOther) {
mSharedLibraries.AddAllSharedLibraries(aOther.mSharedLibraries);
}
@@ -58,6 +68,15 @@ struct ProfileAndAdditionalInformation {
: mProfile(std::move(aProfile)),
mAdditionalInformation(Some(std::move(aAdditionalInformation))) {}
+ ProfileAndAdditionalInformation(const ProfileAndAdditionalInformation&) =
+ delete;
+ ProfileAndAdditionalInformation& operator=(
+ const ProfileAndAdditionalInformation&) = delete;
+
+ ProfileAndAdditionalInformation(ProfileAndAdditionalInformation&&) = default;
+ ProfileAndAdditionalInformation& operator=(
+ ProfileAndAdditionalInformation&&) = default;
+
size_t SizeOf() const {
size_t size = mProfile.Length();
if (mAdditionalInformation.isSome()) {