зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1429904 - Give UniqueJSONStrings a copy constructor. r=njn
MozReview-Commit-ID: tlh6qkYX7A --HG-- extra : rebase_source : 115d834c1e0eed80f54da4aec2db04105b91d90c
This commit is contained in:
Родитель
721a2ea7b8
Коммит
79f37c94cf
|
@ -245,6 +245,25 @@ MakeForEachTrackedOptimizationAttemptsLambdaOp(LambdaT&& aLambda)
|
|||
return ForEachTrackedOptimizationAttemptsLambdaOp<LambdaT>(Move(aLambda));
|
||||
}
|
||||
|
||||
UniqueJSONStrings::UniqueJSONStrings()
|
||||
{
|
||||
mStringTableWriter.StartBareList();
|
||||
}
|
||||
|
||||
UniqueJSONStrings::UniqueJSONStrings(const UniqueJSONStrings& aOther)
|
||||
{
|
||||
mStringTableWriter.StartBareList();
|
||||
if (aOther.mStringToIndexMap.Count() > 0) {
|
||||
for (auto iter = aOther.mStringToIndexMap.ConstIter();
|
||||
!iter.Done(); iter.Next()) {
|
||||
mStringToIndexMap.Put(iter.Key(), iter.Data());
|
||||
}
|
||||
UniquePtr<char[]> stringTableJSON =
|
||||
aOther.mStringTableWriter.WriteFunc()->CopyData();
|
||||
mStringTableWriter.Splice(stringTableJSON.get());
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t
|
||||
UniqueJSONStrings::GetOrAddIndex(const char* aStr)
|
||||
{
|
||||
|
|
|
@ -120,9 +120,8 @@ static_assert(sizeof(ProfileBufferEntry) == 9, "bad ProfileBufferEntry size");
|
|||
class UniqueJSONStrings
|
||||
{
|
||||
public:
|
||||
UniqueJSONStrings() {
|
||||
mStringTableWriter.StartBareList();
|
||||
}
|
||||
UniqueJSONStrings();
|
||||
explicit UniqueJSONStrings(const UniqueJSONStrings& aOther);
|
||||
|
||||
void SpliceStringTableElements(SpliceableJSONWriter& aWriter) {
|
||||
aWriter.TakeAndSplice(mStringTableWriter.WriteFunc());
|
||||
|
|
Загрузка…
Ссылка в новой задаче