Bug 1691913 - Rename nsBaseHashtable::Put to InsertOrUpdate. r=xpcom-reviewers,necko-reviewers,jgilbert,dragana,nika

This makes the naming more consistent with other functions called
Insert and/or Update. Also, it removes the ambiguity whether
Put expects that an entry already exists or not, in particular because
it differed from nsTHashtable::PutEntry in that regard.

Differential Revision: https://phabricator.services.mozilla.com/D105473
This commit is contained in:
Simon Giesecke 2021-02-26 09:11:46 +00:00
Родитель 4f75368dcb
Коммит 9af107a839
298 изменённых файлов: 884 добавлений и 815 удалений

Просмотреть файл

@ -120,7 +120,7 @@ void DocAccessibleWrap::CacheViewportCallback(nsITimer* aTimer,
if (inViewAccs.Contains(acc->UniqueID())) {
break;
}
inViewAccs.Put(acc->UniqueID(), RefPtr{acc});
inViewAccs.InsertOrUpdate(acc->UniqueID(), RefPtr{acc});
}
}
@ -240,7 +240,7 @@ void DocAccessibleWrap::CacheFocusPath(AccessibleWrap* aAccessible) {
acc->Bounds(), acc->ActionCount(), name, textValue, nodeID,
description, acc->CurValue(), acc->MinValue(),
acc->MaxValue(), acc->Step(), attributes));
mFocusPath.Put(acc->UniqueID(), RefPtr{acc});
mFocusPath.InsertOrUpdate(acc->UniqueID(), RefPtr{acc});
}
ipcDoc->SendBatch(eBatch_FocusPath, cacheData);
@ -250,7 +250,7 @@ void DocAccessibleWrap::CacheFocusPath(AccessibleWrap* aAccessible) {
for (AccessibleWrap* acc = aAccessible; acc && acc != this->LocalParent();
acc = static_cast<AccessibleWrap*>(acc->LocalParent())) {
accessibles.AppendElement(acc);
mFocusPath.Put(acc->UniqueID(), RefPtr{acc});
mFocusPath.InsertOrUpdate(acc->UniqueID(), RefPtr{acc});
}
sessionAcc->ReplaceFocusPathCache(accessibles);

Просмотреть файл

@ -26,7 +26,7 @@ class DocAccessibleWrap : public DocAccessible {
* Manage the mapping from id to Accessible.
*/
void AddID(uint32_t aID, AccessibleWrap* aAcc) {
mIDToAccessibleMap.Put(aID, aAcc);
mIDToAccessibleMap.InsertOrUpdate(aID, aAcc);
}
void RemoveID(uint32_t aID) { mIDToAccessibleMap.Remove(aID); }
AccessibleWrap* GetAccessibleByID(int32_t aID) const;

Просмотреть файл

@ -134,7 +134,7 @@ class DocRemoteAccessibleWrap : public RemoteAccessibleWrap {
}
void AddID(uint32_t aID, AccessibleWrap* aAcc) {
mIDToAccessibleMap.Put(aID, aAcc);
mIDToAccessibleMap.InsertOrUpdate(aID, aAcc);
}
void RemoveID(uint32_t aID) { mIDToAccessibleMap.Remove(aID); }
AccessibleWrap* GetAccessibleByID(uint32_t aID) const {

Просмотреть файл

@ -91,8 +91,8 @@ struct ParentObject;
if (aValue.IsNull()) { \
m##typeName##Properties.Remove(static_cast<int>(aProperty)); \
} else { \
m##typeName##Properties.Put(static_cast<int>(aProperty), \
aValue.Value()); \
m##typeName##Properties.InsertOrUpdate(static_cast<int>(aProperty), \
aValue.Value()); \
} \
}
@ -152,7 +152,7 @@ class AccessibleNode : public nsISupports, public nsWrapperCache {
mStringProperties.Remove(static_cast<int>(aProperty));
} else {
nsString value(aValue);
mStringProperties.Put(static_cast<int>(aProperty), value);
mStringProperties.InsertOrUpdate(static_cast<int>(aProperty), value);
}
}
@ -190,7 +190,8 @@ class AccessibleNode : public nsISupports, public nsWrapperCache {
if (!aValue) {
mRelationProperties.Remove(static_cast<int>(aProperty));
} else {
mRelationProperties.Put(static_cast<int>(aProperty), RefPtr{aValue});
mRelationProperties.InsertOrUpdate(static_cast<int>(aProperty),
RefPtr{aValue});
}
}

Просмотреть файл

@ -143,7 +143,7 @@ xpcAccessibleDocument* DocManager::GetXPCDocument(DocAccessible* aDocument) {
xpcAccessibleDocument* xpcDoc = mXPCDocumentCache.GetWeak(aDocument);
if (!xpcDoc) {
xpcDoc = new xpcAccessibleDocument(aDocument);
mXPCDocumentCache.Put(aDocument, RefPtr{xpcDoc});
mXPCDocumentCache.InsertOrUpdate(aDocument, RefPtr{xpcDoc});
}
return xpcDoc;
}
@ -164,7 +164,7 @@ xpcAccessibleDocument* DocManager::GetXPCDocument(DocAccessibleParent* aDoc) {
MOZ_ASSERT(!aDoc->IsShutdown(), "Adding a shutdown doc to remote XPC cache");
doc = new xpcAccessibleDocument(aDoc,
Interfaces::DOCUMENT | Interfaces::HYPERTEXT);
sRemoteXPCDocumentCache->Put(aDoc, RefPtr{doc});
sRemoteXPCDocumentCache->InsertOrUpdate(aDoc, RefPtr{doc});
return doc;
}
@ -486,7 +486,7 @@ DocAccessible* DocManager::CreateDocOrRootAccessible(Document* aDocument) {
: new DocAccessibleWrap(aDocument, presShell);
// Cache the document accessible into document cache.
mDocAccessibleCache.Put(aDocument, RefPtr{docAcc});
mDocAccessibleCache.InsertOrUpdate(aDocument, RefPtr{docAcc});
// Initialize the document accessible.
docAcc->Init();

Просмотреть файл

@ -944,7 +944,7 @@ void NotificationController::EventMap::PutEvent(AccTreeMutationEvent* aEvent) {
uint64_t addr = reinterpret_cast<uintptr_t>(aEvent->GetAccessible());
MOZ_ASSERT((addr & 0x3) == 0, "accessible is not 4 byte aligned");
addr |= type;
mTable.Put(addr, RefPtr{aEvent});
mTable.InsertOrUpdate(addr, RefPtr{aEvent});
}
AccTreeMutationEvent* NotificationController::EventMap::GetEvent(

Просмотреть файл

@ -1177,12 +1177,14 @@ bool nsAccessibilityService::Init() {
eventListenerService->AddListenerChangeListener(this);
for (uint32_t i = 0; i < ArrayLength(sHTMLMarkupMapList); i++) {
mHTMLMarkupMap.Put(sHTMLMarkupMapList[i].tag, &sHTMLMarkupMapList[i]);
mHTMLMarkupMap.InsertOrUpdate(sHTMLMarkupMapList[i].tag,
&sHTMLMarkupMapList[i]);
}
#ifdef MOZ_XUL
for (uint32_t i = 0; i < ArrayLength(sXULMarkupMapList); i++) {
mXULMarkupMap.Put(sXULMarkupMapList[i].tag, &sXULMarkupMapList[i]);
mXULMarkupMap.InsertOrUpdate(sXULMarkupMapList[i].tag,
&sXULMarkupMapList[i]);
}
#endif

Просмотреть файл

@ -603,7 +603,7 @@ void DocAccessible::HandleScroll(nsINode* aTarget) {
if (HasLoadState(eTreeConstructed)) {
DispatchScrollingEvent(aTarget, nsIAccessibleEvent::EVENT_SCROLLING);
}
mLastScrollingDispatch.Put(aTarget, now);
mLastScrollingDispatch.InsertOrUpdate(aTarget, now);
}
// If timer callback is still pending, push it 100ms into the future.
@ -1396,11 +1396,11 @@ void DocAccessible::BindToDocument(LocalAccessible* aAccessible,
const nsRoleMapEntry* aRoleMapEntry) {
// Put into DOM node cache.
if (aAccessible->IsNodeMapEntry()) {
mNodeToAccessibleMap.Put(aAccessible->GetNode(), aAccessible);
mNodeToAccessibleMap.InsertOrUpdate(aAccessible->GetNode(), aAccessible);
}
// Put into unique ID cache.
mAccessibleCache.Put(aAccessible->UniqueID(), RefPtr{aAccessible});
mAccessibleCache.InsertOrUpdate(aAccessible->UniqueID(), RefPtr{aAccessible});
aAccessible->SetRoleMapEntry(aRoleMapEntry);

Просмотреть файл

@ -84,7 +84,7 @@ LocalAccessible* TableCellAccessible::PrevColHeader() {
(tableCell->ColExtent() == 1 || tableCell->ColIdx() == colIdx)) {
if (!cachedHeader || !cachedHeader->IsDefunct()) {
// Cache it for this cell.
cache.Put(this, RefPtr<LocalAccessible>(cachedHeader));
cache.InsertOrUpdate(this, RefPtr<LocalAccessible>(cachedHeader));
return cachedHeader;
}
}
@ -97,12 +97,12 @@ LocalAccessible* TableCellAccessible::PrevColHeader() {
}
// Cache the header we found.
cache.Put(this, RefPtr<LocalAccessible>(cell));
cache.InsertOrUpdate(this, RefPtr<LocalAccessible>(cell));
return cell;
}
// There's no header, so cache that fact.
cache.Put(this, RefPtr<LocalAccessible>(nullptr));
cache.InsertOrUpdate(this, RefPtr<LocalAccessible>(nullptr));
return nullptr;
}

Просмотреть файл

@ -45,7 +45,7 @@ class DocAccessibleParent : public RemoteAccessible,
sMaxDocID++;
mActorID = sMaxDocID;
MOZ_ASSERT(!LiveDocs().Get(mActorID));
LiveDocs().Put(mActorID, this);
LiveDocs().InsertOrUpdate(mActorID, this);
}
/**

Просмотреть файл

@ -25,7 +25,7 @@ static nsDataHashtable<nsUint64HashKey, MOXTextMarkerDelegate*> sDelegates;
MOXTextMarkerDelegate* delegate = sDelegates.Get(aDoc.Bits());
if (!delegate) {
delegate = [[MOXTextMarkerDelegate alloc] initWithDoc:aDoc];
sDelegates.Put(aDoc.Bits(), delegate);
sDelegates.InsertOrUpdate(aDoc.Bits(), delegate);
[delegate retain];
}

Просмотреть файл

@ -57,7 +57,7 @@ class DocRemoteAccessibleWrap : public HyperTextRemoteAccessibleWrap {
}
void AddID(uint32_t aID, AccessibleWrap* aAcc) {
mIDToAccessibleMap.Put(aID, aAcc);
mIDToAccessibleMap.InsertOrUpdate(aID, aAcc);
}
void RemoveID(uint32_t aID) { mIDToAccessibleMap.Remove(aID); }
AccessibleWrap* GetAccessibleByID(uint32_t aID) const {

Просмотреть файл

@ -295,7 +295,7 @@ Maybe<bool> Compatibility::OnUIAMessage(WPARAM aWParam, LPARAM aLParam) {
// An object that is not ours. Since we do not yet know which kernel
// object we're interested in, we'll save the current object for later.
objMap.Put(curHandle.mObject, curHandle.mPid);
objMap.InsertOrUpdate(curHandle.mObject, curHandle.mPid);
} else if (handle == section.get()) {
// This is the file mapping that we opened above. We save this mObject
// in order to compare to Section objects opened by other processes.

Просмотреть файл

@ -44,7 +44,7 @@ class DocAccessibleWrap : public DocAccessible {
* Manage the mapping from id to Accessible.
*/
void AddID(uint32_t aID, AccessibleWrap* aAcc) {
mIDToAccessibleMap.Put(aID, aAcc);
mIDToAccessibleMap.InsertOrUpdate(aID, aAcc);
}
void RemoveID(uint32_t aID) { mIDToAccessibleMap.Remove(aID); }
AccessibleWrap* GetAccessibleByID(uint32_t aID) const {

Просмотреть файл

@ -195,7 +195,7 @@ uint32_t MsaaIdGenerator::GetContentProcessIDFor(
// If we run out of content process IDs, we're in trouble
MOZ_RELEASE_ASSERT(index < ArrayLength(sContentProcessIdBitmap));
sContentParentIdMap->Put(aIPCContentProcessID, value);
sContentParentIdMap->InsertOrUpdate(aIPCContentProcessID, value);
return value;
}

Просмотреть файл

@ -172,7 +172,7 @@ xpcAccessibleGeneric* xpcAccessibleDocument::GetAccessible(
xpcAcc = new xpcAccessibleGeneric(aAccessible);
}
mCache.Put(aAccessible, xpcAcc);
mCache.InsertOrUpdate(aAccessible, xpcAcc);
return xpcAcc;
}
@ -202,13 +202,13 @@ xpcAccessibleGeneric* xpcAccessibleDocument::GetXPCAccessible(
if (aProxy->mIsHyperText) {
interfaces |= eText;
acc = new xpcAccessibleHyperText(aProxy, interfaces);
mCache.Put(aProxy, acc);
mCache.InsertOrUpdate(aProxy, acc);
return acc;
}
acc = new xpcAccessibleGeneric(aProxy, interfaces);
mCache.Put(aProxy, acc);
mCache.InsertOrUpdate(aProxy, acc);
return acc;
}

Просмотреть файл

@ -443,7 +443,7 @@ LocalAccessible* XULTreeAccessible::GetTreeItemAccessible(int32_t aRow) const {
RefPtr<LocalAccessible> treeItem = CreateTreeItemAccessible(aRow);
if (treeItem) {
mAccessibleCache.Put(key, RefPtr{treeItem});
mAccessibleCache.InsertOrUpdate(key, RefPtr{treeItem});
Document()->BindToDocument(treeItem, nullptr);
return treeItem;
}

Просмотреть файл

@ -309,7 +309,7 @@ XULTreeGridCellAccessible* XULTreeGridRowAccessible::GetCellAccessible(
RefPtr<XULTreeGridCellAccessible> cell = new XULTreeGridCellAccessibleWrap(
mContent, mDoc, const_cast<XULTreeGridRowAccessible*>(this), mTree,
mTreeView, mRow, aColumn);
mAccessibleCache.Put(key, RefPtr{cell});
mAccessibleCache.InsertOrUpdate(key, RefPtr{cell});
Document()->BindToDocument(cell, nullptr);
return cell;
}

Просмотреть файл

@ -610,7 +610,7 @@ void nsChromeRegistryChrome::ManifestOverride(ManifestProcessingContext& cx,
"Cannot register non-local URI '%s' for an override.", resolved);
return;
}
mOverrideTable.Put(chromeuri, resolveduri);
mOverrideTable.InsertOrUpdate(chromeuri, resolveduri);
if (mDynamicRegistration) {
SerializedURI serializedChrome;

Просмотреть файл

@ -66,7 +66,7 @@ void nsChromeRegistryContent::RegisterPackage(const ChromePackage& aPackage) {
entry->localeBaseURI = locale;
entry->skinBaseURI = skin;
mPackagesHash.Put(aPackage.package, std::move(entry));
mPackagesHash.InsertOrUpdate(aPackage.package, std::move(entry));
}
void nsChromeRegistryContent::RegisterSubstitution(
@ -103,7 +103,7 @@ void nsChromeRegistryContent::RegisterOverride(
rv = NS_NewURI(getter_AddRefs(overrideURI), aOverride.overrideURI.spec);
if (NS_FAILED(rv)) return;
mOverrideTable.Put(chromeURI, overrideURI);
mOverrideTable.InsertOrUpdate(chromeURI, overrideURI);
}
nsIURI* nsChromeRegistryContent::GetBaseURIFromPackage(

Просмотреть файл

@ -155,10 +155,10 @@ static void UnregisterBrowserId(BrowsingContext* aBrowsingContext) {
}
static void Register(BrowsingContext* aBrowsingContext) {
sBrowsingContexts->Put(aBrowsingContext->Id(), aBrowsingContext);
sBrowsingContexts->InsertOrUpdate(aBrowsingContext->Id(), aBrowsingContext);
if (aBrowsingContext->IsTopContent()) {
sCurrentTopByBrowserId->Put(aBrowsingContext->BrowserId(),
aBrowsingContext);
sCurrentTopByBrowserId->InsertOrUpdate(aBrowsingContext->BrowserId(),
aBrowsingContext);
}
aBrowsingContext->Group()->Register(aBrowsingContext);

Просмотреть файл

@ -22,7 +22,7 @@ void ChildProcessChannelListener::RegisterCallback(uint64_t aIdentifier,
args->mTiming);
args->mResolver(rv);
} else {
mCallbacks.Put(aIdentifier, std::move(aCallback));
mCallbacks.InsertOrUpdate(aIdentifier, std::move(aCallback));
}
}
@ -35,8 +35,8 @@ void ChildProcessChannelListener::OnChannelReady(
(*callback)(aLoadState, std::move(aStreamFilterEndpoints), aTiming);
aResolver(rv);
} else {
mChannelArgs.Put(aIdentifier,
CallbackArgs{aLoadState, std::move(aStreamFilterEndpoints),
mChannelArgs.InsertOrUpdate(
aIdentifier, CallbackArgs{aLoadState, std::move(aStreamFilterEndpoints),
aTiming, std::move(aResolver)});
}
}

Просмотреть файл

@ -372,7 +372,7 @@ void SessionHistoryEntry::SetByLoadId(uint64_t aLoadId,
MOZ_LOG(
gSHLog, LogLevel::Verbose,
("SessionHistoryEntry::SetByLoadId(%" PRIu64 " - %p)", aLoadId, aEntry));
sLoadIdToEntry->Put(aLoadId, aEntry);
sLoadIdToEntry->InsertOrUpdate(aLoadId, aEntry);
}
void SessionHistoryEntry::RemoveLoadId(uint64_t aLoadId) {

Просмотреть файл

@ -51,7 +51,7 @@ static void AddSHEntrySharedParentState(
sIdToSharedState =
new nsDataHashtable<nsUint64HashKey, SHEntrySharedParentState*>();
}
sIdToSharedState->Put(aSharedState->mId, aSharedState);
sIdToSharedState->InsertOrUpdate(aSharedState->mId, aSharedState);
}
SHEntrySharedParentState::SHEntrySharedParentState() {
@ -82,7 +82,7 @@ void SHEntrySharedParentState::ChangeId(uint64_t aId) {
sIdToSharedState->Remove(mId);
mId = aId;
sIdToSharedState->Put(mId, this);
sIdToSharedState->InsertOrUpdate(mId, this);
}
void SHEntrySharedParentState::CopyFrom(SHEntrySharedParentState* aEntry) {

Просмотреть файл

@ -981,7 +981,7 @@ static void MarkAsInitialEntry(
if (!aEntry->BCHistoryLength().Modified()) {
++(aEntry->BCHistoryLength());
}
aHashtable.Put(aEntry->DocshellID(), aEntry);
aHashtable.InsertOrUpdate(aEntry->DocshellID(), aEntry);
for (const RefPtr<SessionHistoryEntry>& entry : aEntry->Children()) {
if (entry) {
MarkAsInitialEntry(entry, aHashtable);
@ -2045,7 +2045,7 @@ nsSHistory::IsEmptyOrHasEntriesForSingleTopLevelPage() {
static void CollectEntries(
nsDataHashtable<nsIDHashKey, SessionHistoryEntry*>& aHashtable,
SessionHistoryEntry* aEntry) {
aHashtable.Put(aEntry->DocshellID(), aEntry);
aHashtable.InsertOrUpdate(aEntry->DocshellID(), aEntry);
for (const RefPtr<SessionHistoryEntry>& entry : aEntry->Children()) {
if (entry) {
CollectEntries(aHashtable, entry);

Просмотреть файл

@ -104,7 +104,7 @@ KeyframeEffect::KeyframeEffect(Document* aDocument,
mProperties(aOther.mProperties.Clone()),
mBaseValues(aOther.mBaseValues.Count()) {
for (auto iter = aOther.mBaseValues.ConstIter(); !iter.Done(); iter.Next()) {
mBaseValues.Put(iter.Key(), RefPtr{iter.Data()});
mBaseValues.InsertOrUpdate(iter.Key(), RefPtr{iter.Data()});
}
}
@ -575,7 +575,7 @@ void KeyframeEffect::EnsureBaseStyle(
Servo_ComputedValues_ExtractAnimationValue(aBaseComputedStyle,
aProperty.mProperty)
.Consume();
mBaseValues.Put(aProperty.mProperty, std::move(baseValue));
mBaseValues.InsertOrUpdate(aProperty.mProperty, std::move(baseValue));
}
void KeyframeEffect::WillComposeStyle() {

Просмотреть файл

@ -569,7 +569,7 @@ CandidateFinder::CandidateFinder(
}
Element* key = elem.get();
mCandidates.Put(key, elem.forget());
mCandidates.InsertOrUpdate(key, elem.forget());
}
}
@ -984,7 +984,7 @@ void CustomElementRegistry::Define(
disableInternals, disableShadow);
CustomElementDefinition* def = definition.get();
mCustomDefinitions.Put(nameAtom, std::move(definition));
mCustomDefinitions.InsertOrUpdate(nameAtom, std::move(definition));
MOZ_ASSERT(mCustomDefinitions.Count() == mConstructors.count(),
"Number of entries should be the same");
@ -1043,7 +1043,7 @@ void CustomElementRegistry::SetElementCreationCallback(
}
RefPtr<CustomElementCreationCallback> callback = &aCallback;
mElementCreationCallbacks.Put(nameAtom, std::move(callback));
mElementCreationCallbacks.InsertOrUpdate(nameAtom, std::move(callback));
}
void CustomElementRegistry::Upgrade(nsINode& aRoot) {

Просмотреть файл

@ -934,7 +934,7 @@ nsresult ExternalResourceMap::AddExternalResource(nsIURI* aURI,
}
ExternalResource* newResource =
mMap.Put(aURI, MakeUnique<ExternalResource>()).get();
mMap.InsertOrUpdate(aURI, MakeUnique<ExternalResource>()).get();
newResource->mDocument = doc;
newResource->mViewer = aViewer;
@ -4418,349 +4418,349 @@ void Document::EnsureInitializeInternalCommandDataHashtable() {
}
sInternalCommandDataHashtable = new InternalCommandDataHashtable();
// clang-format off
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"bold"_ns,
InternalCommandData(
"cmd_bold",
Command::FormatBold,
ExecCommandParam::Ignore,
StyleUpdatingCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"italic"_ns,
InternalCommandData(
"cmd_italic",
Command::FormatItalic,
ExecCommandParam::Ignore,
StyleUpdatingCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"underline"_ns,
InternalCommandData(
"cmd_underline",
Command::FormatUnderline,
ExecCommandParam::Ignore,
StyleUpdatingCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"strikethrough"_ns,
InternalCommandData(
"cmd_strikethrough",
Command::FormatStrikeThrough,
ExecCommandParam::Ignore,
StyleUpdatingCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"subscript"_ns,
InternalCommandData(
"cmd_subscript",
Command::FormatSubscript,
ExecCommandParam::Ignore,
StyleUpdatingCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"superscript"_ns,
InternalCommandData(
"cmd_superscript",
Command::FormatSuperscript,
ExecCommandParam::Ignore,
StyleUpdatingCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"cut"_ns,
InternalCommandData(
"cmd_cut",
Command::Cut,
ExecCommandParam::Ignore,
CutCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"copy"_ns,
InternalCommandData(
"cmd_copy",
Command::Copy,
ExecCommandParam::Ignore,
CopyCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"paste"_ns,
InternalCommandData(
"cmd_paste",
Command::Paste,
ExecCommandParam::Ignore,
PasteCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"delete"_ns,
InternalCommandData(
"cmd_deleteCharBackward",
Command::DeleteCharBackward,
ExecCommandParam::Ignore,
DeleteCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"forwarddelete"_ns,
InternalCommandData(
"cmd_deleteCharForward",
Command::DeleteCharForward,
ExecCommandParam::Ignore,
DeleteCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"selectall"_ns,
InternalCommandData(
"cmd_selectAll",
Command::SelectAll,
ExecCommandParam::Ignore,
SelectAllCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"undo"_ns,
InternalCommandData(
"cmd_undo",
Command::HistoryUndo,
ExecCommandParam::Ignore,
UndoCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"redo"_ns,
InternalCommandData(
"cmd_redo",
Command::HistoryRedo,
ExecCommandParam::Ignore,
RedoCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"indent"_ns,
InternalCommandData("cmd_indent",
Command::FormatIndent,
ExecCommandParam::Ignore,
IndentCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"outdent"_ns,
InternalCommandData(
"cmd_outdent",
Command::FormatOutdent,
ExecCommandParam::Ignore,
OutdentCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"backcolor"_ns,
InternalCommandData(
"cmd_highlight",
Command::FormatBackColor,
ExecCommandParam::String,
HighlightColorStateCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"hilitecolor"_ns,
InternalCommandData(
"cmd_highlight",
Command::FormatBackColor,
ExecCommandParam::String,
HighlightColorStateCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"forecolor"_ns,
InternalCommandData(
"cmd_fontColor",
Command::FormatFontColor,
ExecCommandParam::String,
FontColorStateCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"fontname"_ns,
InternalCommandData(
"cmd_fontFace",
Command::FormatFontName,
ExecCommandParam::String,
FontFaceStateCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"fontsize"_ns,
InternalCommandData(
"cmd_fontSize",
Command::FormatFontSize,
ExecCommandParam::String,
FontSizeStateCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"increasefontsize"_ns,
InternalCommandData(
"cmd_increaseFont",
Command::FormatIncreaseFontSize,
ExecCommandParam::Ignore,
IncreaseFontSizeCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"decreasefontsize"_ns,
InternalCommandData(
"cmd_decreaseFont",
Command::FormatDecreaseFontSize,
ExecCommandParam::Ignore,
DecreaseFontSizeCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"inserthorizontalrule"_ns,
InternalCommandData(
"cmd_insertHR",
Command::InsertHorizontalRule,
ExecCommandParam::Ignore,
InsertTagCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"createlink"_ns,
InternalCommandData(
"cmd_insertLinkNoUI",
Command::InsertLink,
ExecCommandParam::String,
InsertTagCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"insertimage"_ns,
InternalCommandData(
"cmd_insertImageNoUI",
Command::InsertImage,
ExecCommandParam::String,
InsertTagCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"inserthtml"_ns,
InternalCommandData(
"cmd_insertHTML",
Command::InsertHTML,
ExecCommandParam::String,
InsertHTMLCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"inserttext"_ns,
InternalCommandData(
"cmd_insertText",
Command::InsertText,
ExecCommandParam::String,
InsertPlaintextCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"gethtml"_ns,
InternalCommandData(
"cmd_getContents",
Command::GetHTML,
ExecCommandParam::Ignore,
nullptr)); // Not defined in EditorCommands.h
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"justifyleft"_ns,
InternalCommandData(
"cmd_align",
Command::FormatJustifyLeft,
ExecCommandParam::Ignore, // Will be set to "left"
AlignCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"justifyright"_ns,
InternalCommandData(
"cmd_align",
Command::FormatJustifyRight,
ExecCommandParam::Ignore, // Will be set to "right"
AlignCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"justifycenter"_ns,
InternalCommandData(
"cmd_align",
Command::FormatJustifyCenter,
ExecCommandParam::Ignore, // Will be set to "center"
AlignCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"justifyfull"_ns,
InternalCommandData(
"cmd_align",
Command::FormatJustifyFull,
ExecCommandParam::Ignore, // Will be set to "justify"
AlignCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"removeformat"_ns,
InternalCommandData(
"cmd_removeStyles",
Command::FormatRemove,
ExecCommandParam::Ignore,
RemoveStylesCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"unlink"_ns,
InternalCommandData(
"cmd_removeLinks",
Command::FormatRemoveLink,
ExecCommandParam::Ignore,
StyleUpdatingCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"insertorderedlist"_ns,
InternalCommandData(
"cmd_ol",
Command::InsertOrderedList,
ExecCommandParam::Ignore,
ListCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"insertunorderedlist"_ns,
InternalCommandData(
"cmd_ul",
Command::InsertUnorderedList,
ExecCommandParam::Ignore,
ListCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"insertparagraph"_ns,
InternalCommandData(
"cmd_insertParagraph",
Command::InsertParagraph,
ExecCommandParam::Ignore,
InsertParagraphCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"insertlinebreak"_ns,
InternalCommandData(
"cmd_insertLineBreak",
Command::InsertLineBreak,
ExecCommandParam::Ignore,
InsertLineBreakCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"formatblock"_ns,
InternalCommandData(
"cmd_paragraphState",
Command::FormatBlock,
ExecCommandParam::String,
ParagraphStateCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"heading"_ns,
InternalCommandData(
"cmd_paragraphState",
Command::FormatBlock,
ExecCommandParam::String,
ParagraphStateCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"styleWithCSS"_ns,
InternalCommandData(
"cmd_setDocumentUseCSS",
Command::SetDocumentUseCSS,
ExecCommandParam::Boolean,
SetDocumentStateCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"usecss"_ns, // Legacy command
InternalCommandData(
"cmd_setDocumentUseCSS",
Command::SetDocumentUseCSS,
ExecCommandParam::InvertedBoolean,
SetDocumentStateCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"contentReadOnly"_ns,
InternalCommandData(
"cmd_setDocumentReadOnly",
Command::SetDocumentReadOnly,
ExecCommandParam::Boolean,
SetDocumentStateCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"readonly"_ns, // Legacy command
InternalCommandData(
"cmd_setDocumentReadOnly",
Command::SetDocumentReadOnly,
ExecCommandParam::InvertedBoolean,
SetDocumentStateCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"insertBrOnReturn"_ns,
InternalCommandData(
"cmd_insertBrOnReturn",
Command::SetDocumentInsertBROnEnterKeyPress,
ExecCommandParam::Boolean,
SetDocumentStateCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"defaultParagraphSeparator"_ns,
InternalCommandData(
"cmd_defaultParagraphSeparator",
Command::SetDocumentDefaultParagraphSeparator,
ExecCommandParam::String,
SetDocumentStateCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"enableObjectResizing"_ns,
InternalCommandData(
"cmd_enableObjectResizing",
Command::ToggleObjectResizers,
ExecCommandParam::Boolean,
SetDocumentStateCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"enableInlineTableEditing"_ns,
InternalCommandData(
"cmd_enableInlineTableEditing",
Command::ToggleInlineTableEditor,
ExecCommandParam::Boolean,
SetDocumentStateCommand::GetInstance));
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"enableAbsolutePositionEditing"_ns,
InternalCommandData(
"cmd_enableAbsolutePositionEditing",
@ -4769,7 +4769,7 @@ void Document::EnsureInitializeInternalCommandDataHashtable() {
SetDocumentStateCommand::GetInstance));
#if 0
// with empty string
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"justifynone"_ns,
InternalCommandData(
"cmd_align",
@ -4777,7 +4777,7 @@ void Document::EnsureInitializeInternalCommandDataHashtable() {
ExecCommandParam::Ignore,
nullptr)); // Not implemented yet.
// REQUIRED SPECIAL REVIEW special review
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"saveas"_ns,
InternalCommandData(
"cmd_saveAs",
@ -4785,7 +4785,7 @@ void Document::EnsureInitializeInternalCommandDataHashtable() {
ExecCommandParam::Boolean,
nullptr)); // Not implemented yet.
// REQUIRED SPECIAL REVIEW special review
sInternalCommandDataHashtable->Put(
sInternalCommandDataHashtable->InsertOrUpdate(
u"print"_ns,
InternalCommandData(
"cmd_print",
@ -11746,7 +11746,7 @@ void Document::PreLoadImage(nsIURI* aUri, const nsAString& aCrossOriginAttr,
// the "real" load occurs. Unpinned in DispatchContentLoadedEvents and
// unlink
if (!aLinkPreload && NS_SUCCEEDED(rv)) {
mPreloadingImages.Put(aUri, std::move(request));
mPreloadingImages.InsertOrUpdate(aUri, std::move(request));
}
}

Просмотреть файл

@ -3948,7 +3948,7 @@ void Element::RegisterIntersectionObserver(DOMIntersectionObserver* aObserver) {
if (!observers) {
observers = new IntersectionObserverList();
observers->Put(aObserver, eUninitialized);
observers->InsertOrUpdate(aObserver, eUninitialized);
SetProperty(nsGkAtoms::intersectionobserverlist, observers,
IntersectionObserverPropertyDtor, /* aTransfer = */ true);
return;

Просмотреть файл

@ -237,7 +237,7 @@ TMimeType<char_type>::Parse(const nsTSubstring<char_type>& aMimeType) {
if (!paramName.IsEmpty() && !paramNameHadInvalidChars &&
!paramValueHadInvalidChars &&
!mimeType->mParameters.Get(paramName, &paramValue)) {
mimeType->mParameters.Put(paramName, paramValue);
mimeType->mParameters.InsertOrUpdate(paramName, paramValue);
mimeType->mParameterNames.AppendElement(paramName);
}
}
@ -314,7 +314,7 @@ void TMimeType<char_type>::SetParameterValue(
}
ParameterValue value;
value.Append(aValue);
mParameters.Put(aName, value);
mParameters.InsertOrUpdate(aName, value);
}
template mozilla::UniquePtr<TMimeType<char16_t>> TMimeType<char16_t>::Parse(

Просмотреть файл

@ -97,7 +97,7 @@ class Timeout final : protected LinkedListElement<RefPtr<Timeout>> {
}
mTimeouts = aTimeouts;
if (mTimeouts) {
mTimeouts->Put(key, this);
mTimeouts->InsertOrUpdate(key, this);
}
}

Просмотреть файл

@ -966,9 +966,9 @@ bool nsContentUtils::InitializeEventTable() {
for (uint32_t i = 0; i < ArrayLength(eventArray) - 1; ++i) {
MOZ_ASSERT(!sAtomEventTable->Lookup(eventArray[i].mAtom),
"Double-defining event name; fix your EventNameList.h");
sAtomEventTable->Put(eventArray[i].mAtom, eventArray[i]);
sAtomEventTable->InsertOrUpdate(eventArray[i].mAtom, eventArray[i]);
if (ShouldAddEventToStringEventTable(eventArray[i])) {
sStringEventTable->Put(
sStringEventTable->InsertOrUpdate(
Substring(nsDependentAtomString(eventArray[i].mAtom), 2),
eventArray[i]);
}
@ -991,8 +991,9 @@ void nsContentUtils::InitializeTouchEventTable() {
{nullptr}};
// Subtract one from the length because of the trailing null
for (uint32_t i = 0; i < ArrayLength(touchEventArray) - 1; ++i) {
sAtomEventTable->Put(touchEventArray[i].mAtom, touchEventArray[i]);
sStringEventTable->Put(
sAtomEventTable->InsertOrUpdate(touchEventArray[i].mAtom,
touchEventArray[i]);
sStringEventTable->InsertOrUpdate(
Substring(nsDependentAtomString(touchEventArray[i].mAtom), 2),
touchEventArray[i]);
}
@ -4091,7 +4092,7 @@ nsAtom* nsContentUtils::GetEventMessageAndAtom(
// sAtomEventTable instead.
mapping.mMaybeSpecialSVGorSMILEvent =
GetEventMessage(atom) != eUnidentifiedEvent;
sStringEventTable->Put(aName, mapping);
sStringEventTable->InsertOrUpdate(aName, mapping);
return mapping.mAtom;
}
@ -4724,7 +4725,7 @@ void nsContentUtils::AddEntryToDOMArenaTable(nsINode* aNode,
new nsRefPtrHashtable<nsPtrHashKey<const nsINode>, dom::DOMArena>();
}
aNode->SetFlags(NODE_KEEPS_DOMARENA);
sDOMArenaHashtable->Put(aNode, RefPtr<DOMArena>(aDOMArena));
sDOMArenaHashtable->InsertOrUpdate(aNode, RefPtr<DOMArena>(aDOMArena));
}
already_AddRefed<DOMArena> nsContentUtils::TakeEntryFromDOMArenaTable(

Просмотреть файл

@ -253,7 +253,7 @@ already_AddRefed<Attr> nsDOMAttributeMap::SetNamedItemNS(Attr& aAttr,
// Add the new attribute to the attribute map before updating
// its value in the element. @see bug 364413.
nsAttrKey attrkey(ni->NamespaceID(), ni->NameAtom());
mAttributeCache.Put(attrkey, RefPtr{&aAttr});
mAttributeCache.InsertOrUpdate(attrkey, RefPtr{&aAttr});
aAttr.SetMap(this);
rv = mContent->SetAttr(ni->NamespaceID(), ni->NameAtom(), ni->GetPrefixAtom(),

Просмотреть файл

@ -63,7 +63,7 @@ static void RemoveDuplicatesInternal(AtomArray* aArray, uint32_t aStart) {
aArray->RemoveElementAt(i);
i--;
} else {
tokens.Put(atom, true);
tokens.InsertOrUpdate(atom, true);
}
}
}

Просмотреть файл

@ -1024,7 +1024,7 @@ void MessageManagerReporter::CountReferents(
uint32_t oldCount = 0;
aReferentCount->mMessageCounter.Get(key, &oldCount);
uint32_t currentCount = oldCount + listenerCount;
aReferentCount->mMessageCounter.Put(key, currentCount);
aReferentCount->mMessageCounter.InsertOrUpdate(key, currentCount);
// Keep track of messages that have a suspiciously large
// number of referents (symptom of leak).
@ -1342,7 +1342,7 @@ void nsMessageManagerScriptExecutor::TryCacheLoadAndCompileScript(
if (!isRunOnce) {
// Root the object also for caching.
auto* holder = new nsMessageManagerScriptHolder(cx, script);
sCachedScripts->Put(aURL, holder);
sCachedScripts->InsertOrUpdate(aURL, holder);
}
}
}

Просмотреть файл

@ -1012,7 +1012,7 @@ nsGlobalWindowInner::nsGlobalWindowInner(nsGlobalWindowOuter* aOuterWindow,
// We seem to see crashes in release builds because of null
// |sInnerWindowsById|.
if (sInnerWindowsById) {
sInnerWindowsById->Put(mWindowID, this);
sInnerWindowsById->InsertOrUpdate(mWindowID, this);
}
}
@ -6597,7 +6597,7 @@ void nsGlobalWindowInner::AddGamepad(GamepadHandle aHandle, Gamepad* aGamepad) {
}
mGamepadIndexSet.Put(index);
aGamepad->SetIndex(index);
mGamepads.Put(aHandle, RefPtr{aGamepad});
mGamepads.InsertOrUpdate(aHandle, RefPtr{aGamepad});
}
void nsGlobalWindowInner::RemoveGamepad(GamepadHandle aHandle) {

Просмотреть файл

@ -1376,7 +1376,7 @@ nsGlobalWindowOuter::nsGlobalWindowOuter(uint64_t aWindowID)
// We seem to see crashes in release builds because of null
// |sOuterWindowsById|.
if (sOuterWindowsById) {
sOuterWindowsById->Put(mWindowID, this);
sOuterWindowsById->InsertOrUpdate(mWindowID, this);
}
}

Просмотреть файл

@ -235,7 +235,7 @@ nsresult nsNameSpaceManager::AddNameSpace(already_AddRefed<nsAtom> aURI,
MOZ_ASSERT(aNameSpaceID == (int32_t)mURIArray.Length());
mURIArray.AppendElement(uri.forget());
mURIToIDTable.Put(mURIArray.LastElement(), aNameSpaceID);
mURIToIDTable.InsertOrUpdate(mURIArray.LastElement(), aNameSpaceID);
return NS_OK;
}
@ -250,7 +250,7 @@ nsresult nsNameSpaceManager::AddDisabledNameSpace(already_AddRefed<nsAtom> aURI,
MOZ_ASSERT(aNameSpaceID == (int32_t)mURIArray.Length());
mURIArray.AppendElement(uri.forget());
mDisabledURIToIDTable.Put(mURIArray.LastElement(), aNameSpaceID);
mDisabledURIToIDTable.InsertOrUpdate(mURIArray.LastElement(), aNameSpaceID);
return NS_OK;
}

Просмотреть файл

@ -154,7 +154,7 @@ already_AddRefed<mozilla::dom::NodeInfo> nsNodeInfoManager::GetNodeInfo(
nodeInfo =
new NodeInfo(aName, aPrefix, aNamespaceID, aNodeType, aExtraName, this);
mNodeInfoHash.Put(&nodeInfo->mInner, nodeInfo);
mNodeInfoHash.InsertOrUpdate(&nodeInfo->mInner, nodeInfo);
}
// Have to do the swap thing, because already_AddRefed<nsNodeInfo>
@ -194,7 +194,7 @@ nsresult nsNodeInfoManager::GetNodeInfo(const nsAString& aName, nsAtom* aPrefix,
RefPtr<nsAtom> nameAtom = NS_Atomize(aName);
nodeInfo =
new NodeInfo(nameAtom, aPrefix, aNamespaceID, aNodeType, nullptr, this);
mNodeInfoHash.Put(&nodeInfo->mInner, nodeInfo);
mNodeInfoHash.InsertOrUpdate(&nodeInfo->mInner, nodeInfo);
}
p.Set(nodeInfo);

Просмотреть файл

@ -232,7 +232,7 @@ static void CollectWindowReports(nsGlobalWindowInner* aWindow,
aAnonymize);
windowPath.AppendPrintf(", id=%" PRIu64 ")", top->WindowID());
aTopWindowPaths->Put(aWindow->WindowID(), windowPath);
aTopWindowPaths->InsertOrUpdate(aWindow->WindowID(), windowPath);
windowPath += aWindow->IsFrozen() ? "/cached/"_ns : "/active/"_ns;
} else {
@ -252,7 +252,7 @@ static void CollectWindowReports(nsGlobalWindowInner* aWindow,
censusWindowPath.ReplaceLiteral(0, strlen("explicit"), "event-counts");
// Remember the path for later.
aWindowPaths->Put(aWindow->WindowID(), windowPath);
aWindowPaths->InsertOrUpdate(aWindow->WindowID(), windowPath);
// Report the size from windowSizes and add to the appropriate total in
// aWindowTotalSizes.
@ -711,7 +711,7 @@ void nsWindowMemoryReporter::ObserveDOMWindowDetached(
return;
}
mDetachedWindows.Put(weakWindow, TimeStamp());
mDetachedWindows.InsertOrUpdate(weakWindow, TimeStamp());
AsyncCheckForGhostWindows();
}

Просмотреть файл

@ -33,7 +33,7 @@ nsControllerCommandTable::RegisterCommand(const char* aCommandName,
nsIControllerCommand* aCommand) {
NS_ENSURE_TRUE(mMutable, NS_ERROR_FAILURE);
mCommandsTable.Put(nsDependentCString(aCommandName), aCommand);
mCommandsTable.InsertOrUpdate(nsDependentCString(aCommandName), aCommand);
return NS_OK;
}

Просмотреть файл

@ -76,7 +76,7 @@ void PointerEventHandler::UpdateActivePointerState(WidgetMouseEvent* aEvent,
switch (aEvent->mMessage) {
case eMouseEnterIntoWidget:
// In this case we have to know information about available mouse pointers
sActivePointersIds->Put(
sActivePointersIds->InsertOrUpdate(
aEvent->pointerId,
MakeUnique<PointerInfo>(false, aEvent->mInputSource, true, nullptr));
@ -88,7 +88,7 @@ void PointerEventHandler::UpdateActivePointerState(WidgetMouseEvent* aEvent,
// XXXedgar, test could possibly synthesize a mousedown event on a
// coordinate outside the browser window and cause aTargetContent to be
// nullptr, not sure if this also happens on real usage.
sActivePointersIds->Put(
sActivePointersIds->InsertOrUpdate(
pointerEvent->pointerId,
MakeUnique<PointerInfo>(
true, pointerEvent->mInputSource, pointerEvent->mIsPrimary,
@ -107,7 +107,7 @@ void PointerEventHandler::UpdateActivePointerState(WidgetMouseEvent* aEvent,
if (WidgetPointerEvent* pointerEvent = aEvent->AsPointerEvent()) {
if (pointerEvent->mInputSource !=
MouseEvent_Binding::MOZ_SOURCE_TOUCH) {
sActivePointersIds->Put(
sActivePointersIds->InsertOrUpdate(
pointerEvent->pointerId,
MakeUnique<PointerInfo>(false, pointerEvent->mInputSource,
pointerEvent->mIsPrimary, nullptr));
@ -207,7 +207,7 @@ bool PointerEventHandler::SetPointerCaptureRemoteTarget(
return false;
}
sPointerCaptureRemoteTargetTable->Put(aPointerId, aBrowserParent);
sPointerCaptureRemoteTargetTable->InsertOrUpdate(aPointerId, aBrowserParent);
return true;
}

Просмотреть файл

@ -106,7 +106,7 @@ void RemoteLazyInputStreamStorage::AddStream(nsIInputStream* aInputStream,
data->mSize = aSize;
mozilla::StaticMutexAutoLock lock(gMutex);
mStorage.Put(aID, std::move(data));
mStorage.InsertOrUpdate(aID, std::move(data));
}
nsCOMPtr<nsIInputStream> RemoteLazyInputStreamStorage::ForgetStream(

Просмотреть файл

@ -197,7 +197,7 @@ class BlobURLsReporter final : public nsIMemoryReporter {
mozilla::dom::BlobImpl* blobImpl = iter.UserData()->mBlobImpl;
MOZ_ASSERT(blobImpl);
refCounts.Put(blobImpl, refCounts.Get(blobImpl) + 1);
refCounts.InsertOrUpdate(blobImpl, refCounts.Get(blobImpl) + 1);
}
for (auto iter = gDataTable->Iter(); !iter.Done(); iter.Next()) {
@ -535,7 +535,7 @@ static void AddDataEntryInternal(const nsACString& aURI, T aObject,
aAgentClusterId);
BlobURLsReporter::GetJSStackForBlob(info.get());
gDataTable->Put(aURI, std::move(info));
gDataTable->InsertOrUpdate(aURI, std::move(info));
}
void BlobURLProtocolHandler::Init(void) {

Просмотреть файл

@ -70,7 +70,7 @@ Gamepad::Gamepad(nsISupports* aParent, const nsAString& aID, int32_t aIndex,
}
// Mapping touchId(0) to touchIdHash(0) by default.
mTouchIdHash.Put(0, mTouchIdHashValue);
mTouchIdHash.InsertOrUpdate(0, mTouchIdHashValue);
++mTouchIdHashValue;
UpdateTimestamp();
}
@ -121,7 +121,7 @@ void Gamepad::SetTouchEvent(uint32_t aTouchIndex,
touchState.touchId = *hashValue;
} else {
touchState.touchId = mTouchIdHashValue;
mTouchIdHash.Put(aTouch.touchId, mTouchIdHashValue);
mTouchIdHash.InsertOrUpdate(aTouch.touchId, mTouchIdHashValue);
++mTouchIdHashValue;
}
mTouchEvents[aTouchIndex]->SetTouchState(touchState);

Просмотреть файл

@ -206,7 +206,7 @@ void GamepadManager::AddGamepad(GamepadHandle aHandle, const nsAString& aId,
// We store the gamepad related to its index given by the parent process,
// and no duplicate index is allowed.
MOZ_ASSERT(!mGamepads.Contains(aHandle));
mGamepads.Put(aHandle, std::move(newGamepad));
mGamepads.InsertOrUpdate(aHandle, std::move(newGamepad));
NewConnectionEvent(aHandle, true);
}

Просмотреть файл

@ -126,7 +126,7 @@ already_AddRefed<Promise> GamepadServiceTest::AddGamepad(
uint32_t id = ++mEventNumber;
MOZ_ASSERT(!mPromiseList.Contains(id));
mPromiseList.Put(id, RefPtr{p});
mPromiseList.InsertOrUpdate(id, RefPtr{p});
mChild->SendGamepadTestEvent(id, e);

Просмотреть файл

@ -45,7 +45,7 @@ mozilla::ipc::IPCResult GamepadEventChannelChild::RecvGamepadUpdate(
void GamepadEventChannelChild::AddPromise(const uint32_t& aID,
dom::Promise* aPromise) {
MOZ_ASSERT(!mPromiseList.Contains(aID));
mPromiseList.Put(aID, RefPtr{aPromise});
mPromiseList.InsertOrUpdate(aID, RefPtr{aPromise});
}
mozilla::ipc::IPCResult GamepadEventChannelChild::RecvReplyGamepadPromise(

Просмотреть файл

@ -2025,7 +2025,7 @@ HTMLFormElement::IndexOfControl(nsIFormControl* aControl) {
void HTMLFormElement::SetCurrentRadioButton(const nsAString& aName,
HTMLInputElement* aRadio) {
mSelectedRadioButtons.Put(aName, RefPtr{aRadio});
mSelectedRadioButtons.InsertOrUpdate(aName, RefPtr{aRadio});
}
HTMLInputElement* HTMLFormElement::GetCurrentRadioButton(
@ -2177,8 +2177,8 @@ uint32_t HTMLFormElement::GetRequiredRadioCount(const nsAString& aName) const {
void HTMLFormElement::RadioRequiredWillChange(const nsAString& aName,
bool aRequiredAdded) {
if (aRequiredAdded) {
mRequiredRadioButtonCounts.Put(aName,
mRequiredRadioButtonCounts.Get(aName) + 1);
mRequiredRadioButtonCounts.InsertOrUpdate(
aName, mRequiredRadioButtonCounts.Get(aName) + 1);
} else {
uint32_t requiredNb = mRequiredRadioButtonCounts.Get(aName);
NS_ASSERTION(requiredNb >= 1,
@ -2186,7 +2186,7 @@ void HTMLFormElement::RadioRequiredWillChange(const nsAString& aName,
if (requiredNb == 1) {
mRequiredRadioButtonCounts.Remove(aName);
} else {
mRequiredRadioButtonCounts.Put(aName, requiredNb - 1);
mRequiredRadioButtonCounts.InsertOrUpdate(aName, requiredNb - 1);
}
}
}
@ -2197,7 +2197,7 @@ bool HTMLFormElement::GetValueMissingState(const nsAString& aName) const {
void HTMLFormElement::SetValueMissingState(const nsAString& aName,
bool aValue) {
mValueMissingRadioGroups.Put(aName, aValue);
mValueMissingRadioGroups.InsertOrUpdate(aName, aValue);
}
EventStates HTMLFormElement::IntrinsicState() const {
@ -2361,7 +2361,7 @@ void HTMLFormElement::AddToPastNamesMap(const nsAString& aName,
// previous entry with the same name, if any.
nsCOMPtr<nsIContent> node = do_QueryInterface(aChild);
if (node) {
mPastNameLookupTable.Put(aName, ToSupports(node));
mPastNameLookupTable.InsertOrUpdate(aName, ToSupports(node));
node->SetFlags(MAY_BE_IN_PAST_NAMES_MAP);
}
}

Просмотреть файл

@ -3726,7 +3726,7 @@ void HTMLMediaElement::UpdateOutputTrackSources() {
track->QueueSetAutoend(false);
MOZ_DIAGNOSTIC_ASSERT(!mOutputTrackSources.GetWeak(id));
mOutputTrackSources.Put(id, RefPtr{source});
mOutputTrackSources.InsertOrUpdate(id, RefPtr{source});
// Add the new track source to any existing output streams
for (OutputMediaStream& ms : mOutputStreams) {

Просмотреть файл

@ -6193,7 +6193,7 @@ uint32_t TelemetryIdForFile(nsIFile* aFile) {
// We're locked, no need for atomics.
id = sNextId++;
gTelemetryIdHashtable->Put(hashValue, id);
gTelemetryIdHashtable->InsertOrUpdate(hashValue, id);
}
return id;
@ -7636,7 +7636,7 @@ nsresult DatabaseConnection::UpdateRefcountFunction::ProcessValue(
.get());
if (mInSavepoint) {
mSavepointEntriesIndex.Put(id, entry);
mSavepointEntriesIndex.InsertOrUpdate(id, entry);
}
switch (aUpdateType) {
@ -7894,13 +7894,14 @@ uint64_t ConnectionPool::Start(
if (databaseInfoIsNew) {
MutexAutoLock lock(mDatabasesMutex);
dbInfo =
mDatabases.Put(aDatabaseId, MakeUnique<DatabaseInfo>(this, aDatabaseId))
.get();
dbInfo = mDatabases
.InsertOrUpdate(aDatabaseId,
MakeUnique<DatabaseInfo>(this, aDatabaseId))
.get();
}
MOZ_ASSERT(!mTransactions.Contains(transactionId));
auto& transactionInfo = *mTransactions.Put(
auto& transactionInfo = *mTransactions.InsertOrUpdate(
transactionId, MakeUnique<TransactionInfo>(
*dbInfo, aBackgroundChildLoggingId, aDatabaseId,
transactionId, aLoggingSerialNumber, aObjectStoreNames,
@ -9096,7 +9097,7 @@ SafeRefPtr<FullDatabaseMetadata> FullDatabaseMetadata::Duplicate() const {
newIndexMetadata->mCommonMetadata = value->mCommonMetadata;
if (NS_WARN_IF(!newOSMetadata->mIndexes.Put(
if (NS_WARN_IF(!newOSMetadata->mIndexes.InsertOrUpdate(
indexEntry.GetKey(), std::move(newIndexMetadata), fallible))) {
return nullptr;
}
@ -9105,7 +9106,7 @@ SafeRefPtr<FullDatabaseMetadata> FullDatabaseMetadata::Duplicate() const {
MOZ_ASSERT(objectStoreValue->mIndexes.Count() ==
newOSMetadata->mIndexes.Count());
if (NS_WARN_IF(!newMetadata->mObjectStores.Put(
if (NS_WARN_IF(!newMetadata->mObjectStores.InsertOrUpdate(
objectStoreEntry.GetKey(), std::move(newOSMetadata), fallible))) {
return nullptr;
}
@ -9176,8 +9177,8 @@ SafeRefPtr<Factory> Factory::Create(const LoggingInfo& aLoggingInfo) {
#endif // !DISABLE_ASSERTS_FOR_FUZZING
} else {
loggingInfo = new DatabaseLoggingInfo(aLoggingInfo);
gLoggingInfoHashtable->Put(aLoggingInfo.backgroundChildLoggingId(),
loggingInfo);
gLoggingInfoHashtable->InsertOrUpdate(
aLoggingInfo.backgroundChildLoggingId(), loggingInfo);
}
return MakeSafeRefPtr<Factory>(std::move(loggingInfo));
@ -9619,7 +9620,7 @@ void Database::MapBlob(const IPCBlob& aIPCBlob,
stream.get_PRemoteLazyInputStreamParent());
MOZ_ASSERT(!mMappedBlobs.GetWeak(actor->ID()));
mMappedBlobs.Put(actor->ID(), AsRefPtr(std::move(aFileInfo)));
mMappedBlobs.InsertOrUpdate(actor->ID(), AsRefPtr(std::move(aFileInfo)));
RefPtr<UnmapBlobCallback> callback =
new UnmapBlobCallback(SafeRefPtrFromThis());
@ -11384,7 +11385,7 @@ mozilla::ipc::IPCResult VersionChangeTransaction::RecvCreateObjectStore(
newMetadata->mNextAutoIncrementId = aMetadata.autoIncrement() ? 1 : 0;
newMetadata->mCommittedAutoIncrementId = newMetadata->mNextAutoIncrementId;
if (NS_WARN_IF(!dbMetadata->mObjectStores.Put(
if (NS_WARN_IF(!dbMetadata->mObjectStores.InsertOrUpdate(
aMetadata.id(), std::move(newMetadata), fallible))) {
return IPC_FAIL_NO_REASON(this);
}
@ -11556,7 +11557,7 @@ mozilla::ipc::IPCResult VersionChangeTransaction::RecvCreateIndex(
RefPtr<FullIndexMetadata> newMetadata = new FullIndexMetadata();
newMetadata->mCommonMetadata = aMetadata;
if (NS_WARN_IF(!foundObjectStoreMetadata->mIndexes.Put(
if (NS_WARN_IF(!foundObjectStoreMetadata->mIndexes.InsertOrUpdate(
aMetadata.id(), std::move(newMetadata), fallible))) {
return IPC_FAIL_NO_REASON(this);
}
@ -12199,7 +12200,7 @@ nsresult FileManager::Init(nsIFile* aDirectory,
// be 0, but the dbRefCnt is non-zero, which will keep the FileInfo
// object alive.
MOZ_ASSERT(dbRefCnt > 0);
mFileInfos.Put(
mFileInfos.InsertOrUpdate(
id, MakeNotNull<FileInfo*>(FileManagerGuard{}, SafeRefPtrFromThis(),
id, static_cast<nsrefcnt>(dbRefCnt)));
@ -13326,8 +13327,8 @@ void Maintenance::RegisterDatabaseMaintenance(
MOZ_ASSERT(mState == State::BeginDatabaseMaintenance);
MOZ_ASSERT(!mDatabaseMaintenances.Get(aDatabaseMaintenance->DatabasePath()));
mDatabaseMaintenances.Put(aDatabaseMaintenance->DatabasePath(),
aDatabaseMaintenance);
mDatabaseMaintenances.InsertOrUpdate(aDatabaseMaintenance->DatabasePath(),
aDatabaseMaintenance);
}
void Maintenance::UnregisterDatabaseMaintenance(
@ -15300,7 +15301,8 @@ nsresult FactoryOp::Open() {
// XXX Propagate the error to the caller rather than asserting.
MOZ_RELEASE_ASSERT(keyOrErr.isOk());
lockedPrivateBrowsingInfoHashtable->Put(mDatabaseId, keyOrErr.unwrap());
lockedPrivateBrowsingInfoHashtable->InsertOrUpdate(mDatabaseId,
keyOrErr.unwrap());
}
}
@ -16237,8 +16239,8 @@ nsresult OpenDatabaseOp::LoadDatabaseInformation(
metadata->mNextAutoIncrementId = nextAutoIncrementId;
metadata->mCommittedAutoIncrementId = nextAutoIncrementId;
IDB_TRY(OkIf(objectStores.Put(objectStoreId, std::move(metadata),
fallible)),
IDB_TRY(OkIf(objectStores.InsertOrUpdate(
objectStoreId, std::move(metadata), fallible)),
Err(NS_ERROR_OUT_OF_MEMORY));
lastObjectStoreId = std::max(lastObjectStoreId, objectStoreId);
@ -16367,7 +16369,7 @@ nsresult OpenDatabaseOp::LoadDatabaseInformation(
}
}
IDB_TRY(OkIf(objectStoreMetadata->mIndexes.Put(
IDB_TRY(OkIf(objectStoreMetadata->mIndexes.InsertOrUpdate(
indexId, std::move(indexMetadata), fallible)),
Err(NS_ERROR_OUT_OF_MEMORY));
@ -16778,10 +16780,11 @@ void OpenDatabaseOp::EnsureDatabaseActor() {
} else {
// XXX Maybe use LookupOrInsertWith above, to avoid a second lookup here?
info = gLiveDatabaseHashtable
->Put(mDatabaseId,
MakeUnique<DatabaseActorInfo>(
mMetadata.clonePtr(),
WrapNotNullUnchecked(mDatabase.unsafeGetRawPtr())))
->InsertOrUpdate(
mDatabaseId,
MakeUnique<DatabaseActorInfo>(
mMetadata.clonePtr(),
WrapNotNullUnchecked(mDatabase.unsafeGetRawPtr())))
.get();
}
@ -18537,9 +18540,9 @@ bool CreateIndexOp::Init(TransactionBase& aTransaction) {
const FullIndexMetadata* const value = indexEntry.GetData();
MOZ_ASSERT(!uniqueIndexTable.Get(value->mCommonMetadata.id()));
if (NS_WARN_IF(!uniqueIndexTable.Put(value->mCommonMetadata.id(),
value->mCommonMetadata.unique(),
fallible))) {
if (NS_WARN_IF(!uniqueIndexTable.InsertOrUpdate(
value->mCommonMetadata.id(), value->mCommonMetadata.unique(),
fallible))) {
IDB_REPORT_INTERNAL_ERR();
NS_WARNING("out of memory");
return false;
@ -19419,7 +19422,8 @@ bool ObjectStoreAddOrPutRequestOp::Init(TransactionBase& aTransaction) {
MOZ_ASSERT_IF(!indexMetadata->mCommonMetadata.multiEntry(),
!mUniqueIndexTable.ref().Get(indexId));
if (NS_WARN_IF(!mUniqueIndexTable.ref().Put(indexId, unique, fallible))) {
if (NS_WARN_IF(!mUniqueIndexTable.ref().InsertOrUpdate(indexId, unique,
fallible))) {
return false;
}
}

Просмотреть файл

@ -41,7 +41,7 @@ class FileManagerBase {
AcquireStrongRefFromRawPtr{}},
id);
mFileInfos.Put(id, fileInfo);
mFileInfos.InsertOrUpdate(id, fileInfo);
return Some(fileInfo);
});
}

Просмотреть файл

@ -806,7 +806,7 @@ PBackgroundIDBDatabaseFileChild* IDBDatabase::GetOrCreateFileActorForBlob(
MOZ_ASSERT(actor->GetActorEventTarget(),
"The event target shall be inherited from its manager actor.");
mFileActors.Put(weakRef, actor);
mFileActors.InsertOrUpdate(weakRef, actor);
}
MOZ_ASSERT(actor);

Просмотреть файл

@ -59,7 +59,7 @@ class TestFileManager final : public FileManagerBase<TestFileManager>,
for (const auto id : kDBOnlyFileInfoIds) {
// Copied from within FileManager::Init.
mFileInfos.Put(
mFileInfos.InsertOrUpdate(
id, MakeNotNull<FileInfo*>(FileManagerGuard{}, SafeRefPtrFromThis(),
id, static_cast<nsrefcnt>(1)));

Просмотреть файл

@ -1554,7 +1554,7 @@ mozilla::ipc::IPCResult BrowserChild::RecvRealMouseMoveEvent(
// Put new data to replace the old one in the hash table.
CoalescedMouseData* newData =
mCoalescedMouseData
.Put(aEvent.pointerId, MakeUnique<CoalescedMouseData>())
.InsertOrUpdate(aEvent.pointerId, MakeUnique<CoalescedMouseData>())
.get();
newData->Coalesce(aEvent, aGuid, aInputBlockId);
@ -2669,7 +2669,7 @@ void BrowserChild::InitRenderingState(
sBrowserChildren = new BrowserChildMap;
}
MOZ_ASSERT(!sBrowserChildren->Get(uint64_t(aLayersId)));
sBrowserChildren->Put(uint64_t(aLayersId), this);
sBrowserChildren->InsertOrUpdate(uint64_t(aLayersId), this);
mLayersId = aLayersId;
}

Просмотреть файл

@ -300,7 +300,8 @@ void BrowserParent::AddBrowserParentToTable(layers::LayersId aLayersId,
if (!sLayerToBrowserParentTable) {
sLayerToBrowserParentTable = new LayerToBrowserParentTable();
}
sLayerToBrowserParentTable->Put(uint64_t(aLayersId), aBrowserParent);
sLayerToBrowserParentTable->InsertOrUpdate(uint64_t(aLayersId),
aBrowserParent);
}
void BrowserParent::RemoveBrowserParentFromTable(layers::LayersId aLayersId) {

Просмотреть файл

@ -3188,7 +3188,7 @@ void ContentChild::CreateGetFilesRequest(const nsAString& aDirectoryPath,
Unused << SendGetFilesRequest(aUUID, nsString(aDirectoryPath),
aRecursiveFlag);
mGetFilesPendingRequests.Put(aUUID, RefPtr{aChild});
mGetFilesPendingRequests.InsertOrUpdate(aUUID, RefPtr{aChild});
}
void ContentChild::DeleteGetFilesRequest(nsID& aUUID,

Просмотреть файл

@ -1223,7 +1223,7 @@ already_AddRefed<ContentParent> ContentParent::GetNewOrUsedJSPluginProcess(
return nullptr;
}
sJSPluginContentParents->Put(aPluginID, p);
sJSPluginContentParents->InsertOrUpdate(aPluginID, p);
return p.forget();
}
@ -5981,7 +5981,7 @@ mozilla::ipc::IPCResult ContentParent::RecvGetFilesRequest(
return IPC_OK();
}
mGetFilesPendingRequests.Put(aUUID, std::move(helper));
mGetFilesPendingRequests.InsertOrUpdate(aUUID, std::move(helper));
return IPC_OK();
}

Просмотреть файл

@ -887,7 +887,7 @@ bool HangMonitorParent::TakeBrowserMinidump(const PluginHangData& aPhd,
"Failed to generate timely browser stack, "
"this is bad for plugin hang analysis!");
} else {
mBrowserCrashDumpIds.Put(aPhd.pluginId(), aCrashId);
mBrowserCrashDumpIds.InsertOrUpdate(aPhd.pluginId(), aCrashId);
return true;
}
}
@ -995,7 +995,7 @@ void HangMonitorParent::UpdateMinidump(uint32_t aPluginId,
}
MutexAutoLock lock(mBrowserCrashDumpHashLock);
mBrowserCrashDumpIds.Put(aPluginId, aDumpId);
mBrowserCrashDumpIds.InsertOrUpdate(aPluginId, aDumpId);
}
/* HangMonitoredProcess implementation */

Просмотреть файл

@ -64,7 +64,7 @@ const nsID RefMessageBodyService::Register(
}
StaticMutexAutoLock lock(sRefMessageBodyServiceMutex);
GetOrCreateInternal(lock)->mMessages.Put(uuid, std::move(body));
GetOrCreateInternal(lock)->mMessages.InsertOrUpdate(uuid, std::move(body));
return uuid;
}

Просмотреть файл

@ -226,7 +226,7 @@ Result<Ok, nsresult> SharedMap::MaybeRebuild() {
// matter for this (the actual move will only happen within Put), to be
// clear about this, we call entry->Name() before calling Put.
const auto& name = entry->Name();
mEntries.Put(name, std::move(entry));
mEntries.InsertOrUpdate(name, std::move(entry));
}
return Ok();

Просмотреть файл

@ -80,7 +80,8 @@ bool SharedStringMap::Find(const nsCString& aKey, size_t* aIndex) {
void SharedStringMapBuilder::Add(const nsCString& aKey,
const nsString& aValue) {
mEntries.Put(aKey, Entry{mKeyTable.Add(aKey), mValueTable.Add(aValue)});
mEntries.InsertOrUpdate(aKey,
Entry{mKeyTable.Add(aKey), mValueTable.Add(aValue)});
}
Result<Ok, nsresult> SharedStringMapBuilder::Finalize(

Просмотреть файл

@ -243,8 +243,8 @@ already_AddRefed<Promise> JSActor::SendQuery(JSContext* aCx,
meta.queryId() = mNextQueryId++;
meta.kind() = JSActorMessageKind::Query;
mPendingQueries.Put(meta.queryId(),
PendingQuery{promise, meta.messageName()});
mPendingQueries.InsertOrUpdate(meta.queryId(),
PendingQuery{promise, meta.messageName()});
SendRawMessage(meta, std::move(data), CaptureJSStack(aCx), aRv);
return promise.forget();

Просмотреть файл

@ -97,7 +97,7 @@ already_AddRefed<JSActor> JSActorManager::GetActor(JSContext* aCx,
if (aRv.Failed()) {
return nullptr;
}
mJSActors.Put(aName, RefPtr{actor});
mJSActors.InsertOrUpdate(aName, RefPtr{actor});
return actor.forget();
}

Просмотреть файл

@ -169,7 +169,7 @@ void JSActorService::LoadJSActorInfos(nsTArray<JSProcessActorInfo>& aProcess,
auto name = info.name();
RefPtr<JSProcessActorProtocol> proto =
JSProcessActorProtocol::FromIPC(std::move(info));
mProcessActorDescriptors.Put(std::move(name), RefPtr{proto});
mProcessActorDescriptors.InsertOrUpdate(std::move(name), RefPtr{proto});
// Add observers for each actor.
proto->AddObservers();
@ -179,7 +179,7 @@ void JSActorService::LoadJSActorInfos(nsTArray<JSProcessActorInfo>& aProcess,
auto name = info.name();
RefPtr<JSWindowActorProtocol> proto =
JSWindowActorProtocol::FromIPC(std::move(info));
mWindowActorDescriptors.Put(std::move(name), RefPtr{proto});
mWindowActorDescriptors.InsertOrUpdate(std::move(name), RefPtr{proto});
// Register listeners for each chrome target.
for (EventTarget* target : mChromeEventTargets) {

Просмотреть файл

@ -2843,8 +2843,9 @@ nsresult LoadArchivedOrigins() {
LS_TRY(OkIf(originAttributes.PopulateFromSuffix(originSuffix)),
Err(NS_ERROR_FAILURE));
archivedOrigins->Put(hashKey, MakeUnique<ArchivedOriginInfo>(
originAttributes, originNoSuffix));
archivedOrigins->InsertOrUpdate(
hashKey,
MakeUnique<ArchivedOriginInfo>(originAttributes, originNoSuffix));
return Ok{};
}));
@ -4229,7 +4230,7 @@ already_AddRefed<Connection> ConnectionThread::CreateConnection(
RefPtr<Connection> connection =
new Connection(this, aOriginMetadata, std::move(aArchivedOriginScope),
aDatabaseWasNotAvailable);
mConnections.Put(aOriginMetadata.mOrigin, RefPtr{connection});
mConnections.InsertOrUpdate(aOriginMetadata.mOrigin, RefPtr{connection});
return connection.forget();
}
@ -4691,7 +4692,7 @@ void Datastore::SetItem(Database* aDatabase, const nsString& aKey,
NotifySnapshots(aDatabase, aKey, oldValue, /* affectsOrder */ isNewItem);
mValues.Put(aKey, aValue);
mValues.InsertOrUpdate(aKey, aValue);
int64_t delta;
@ -7246,7 +7247,8 @@ void PrepareDatastoreOp::GetResponse(LSRequestResponse& aResponse) {
}
MOZ_ASSERT(!gDatastores->MaybeGet(Origin()));
gDatastores->Put(Origin(), WrapMovingNotNullUnchecked(mDatastore));
gDatastores->InsertOrUpdate(Origin(),
WrapMovingNotNullUnchecked(mDatastore));
}
if (mPrivateBrowsingId && !mInvalidated) {
@ -7258,7 +7260,7 @@ void PrepareDatastoreOp::GetResponse(LSRequestResponse& aResponse) {
auto privateDatastore =
MakeUnique<PrivateDatastore>(WrapMovingNotNull(mDatastore));
gPrivateDatastores->Put(Origin(), std::move(privateDatastore));
gPrivateDatastores->InsertOrUpdate(Origin(), std::move(privateDatastore));
mPrivateDatastoreRegistered.Flip();
}
@ -7269,7 +7271,7 @@ void PrepareDatastoreOp::GetResponse(LSRequestResponse& aResponse) {
if (!gPreparedDatastores) {
gPreparedDatastores = new PreparedDatastoreHashtable();
}
const auto& preparedDatastore = gPreparedDatastores->Put(
const auto& preparedDatastore = gPreparedDatastores->InsertOrUpdate(
mDatastoreId, MakeUnique<PreparedDatastore>(
mDatastore, mContentParentId, Origin(), mDatastoreId,
/* aForPreload */ mForPreload));
@ -7464,7 +7466,7 @@ nsresult PrepareDatastoreOp::LoadDataOp::DoDatastoreWork() {
LSValue value;
LS_TRY(value.InitFromStatement(&stmt, 1));
mPrepareDatastoreOp->mValues.Put(key, value);
mPrepareDatastoreOp->mValues.InsertOrUpdate(key, value);
mPrepareDatastoreOp->mSizeOfKeys += key.Length();
mPrepareDatastoreOp->mSizeOfItems += key.Length() + value.Length();
#ifdef DEBUG
@ -7640,7 +7642,7 @@ void PrepareObserverOp::GetResponse(LSRequestResponse& aResponse) {
if (!gPreparedObsevers) {
gPreparedObsevers = new PreparedObserverHashtable();
}
gPreparedObsevers->Put(observerId, std::move(observer));
gPreparedObsevers->InsertOrUpdate(observerId, std::move(observer));
LSRequestPrepareObserverResponse prepareObserverResponse;
prepareObserverResponse.observerId() = observerId;

Просмотреть файл

@ -86,7 +86,7 @@ LSDatabase::LSDatabase(const nsACString& aOrigin)
}
MOZ_ASSERT(!gLSDatabases->Get(mOrigin));
gLSDatabases->Put(mOrigin, this);
gLSDatabases->InsertOrUpdate(mOrigin, this);
}
LSDatabase::~LSDatabase() {

Просмотреть файл

@ -34,7 +34,7 @@ LSObserver::LSObserver(const nsACString& aOrigin)
}
MOZ_ASSERT(!gLSObservers->Get(mOrigin));
gLSObservers->Put(mOrigin, this);
gLSObservers->InsertOrUpdate(mOrigin, this);
}
LSObserver::~LSObserver() {

Просмотреть файл

@ -202,7 +202,7 @@ nsresult LSSnapshot::Init(const nsAString& aKey,
mLoadedItems.PutEntry(itemInfo.key());
}
mValues.Put(itemInfo.key(), value.AsString());
mValues.InsertOrUpdate(itemInfo.key(), value.AsString());
}
if (loadState == LoadState::Partial) {
@ -352,7 +352,7 @@ nsresult LSSnapshot::SetItem(const nsAString& aKey, const nsAString& aValue,
if (oldValue.IsVoid()) {
mValues.Remove(aKey);
} else {
mValues.Put(aKey, oldValue);
mValues.InsertOrUpdate(aKey, oldValue);
}
});
@ -441,7 +441,7 @@ nsresult LSSnapshot::RemoveItem(const nsAString& aKey,
auto autoRevertValue = MakeScopeExit([&] {
MOZ_ASSERT(!oldValue.IsVoid());
mValues.Put(aKey, oldValue);
mValues.InsertOrUpdate(aKey, oldValue);
});
// Anything that can fail must be done early before we start modifying the
@ -646,7 +646,7 @@ nsresult LSSnapshot::GetItemInternal(const nsAString& aKey,
mUnknownItems.PutEntry(aKey);
} else {
mLoadedItems.PutEntry(aKey);
mValues.Put(aKey, result);
mValues.InsertOrUpdate(aKey, result);
// mLoadedItems.Count()==mInitLength is checked below.
}
@ -655,7 +655,7 @@ nsresult LSSnapshot::GetItemInternal(const nsAString& aKey,
const LSItemInfo& itemInfo = itemInfos[i];
mLoadedItems.PutEntry(itemInfo.key());
mValues.Put(itemInfo.key(), itemInfo.value().AsString());
mValues.InsertOrUpdate(itemInfo.key(), itemInfo.value().AsString());
}
if (mLoadedItems.Count() == mInitLength) {
@ -669,7 +669,7 @@ nsresult LSSnapshot::GetItemInternal(const nsAString& aKey,
if (aValue.WasPassed()) {
const nsString& value = aValue.Value();
if (!value.IsVoid()) {
mValues.Put(aKey, value);
mValues.InsertOrUpdate(aKey, value);
} else if (!result.IsVoid()) {
mValues.Remove(aKey);
}
@ -693,7 +693,7 @@ nsresult LSSnapshot::GetItemInternal(const nsAString& aKey,
MOZ_ASSERT(!result.IsVoid());
mLoadedItems.PutEntry(aKey);
mValues.Put(aKey, result);
mValues.InsertOrUpdate(aKey, result);
// mLoadedItems.Count()==mInitLength is checked below.
@ -701,7 +701,7 @@ nsresult LSSnapshot::GetItemInternal(const nsAString& aKey,
const LSItemInfo& itemInfo = itemInfos[i];
mLoadedItems.PutEntry(itemInfo.key());
mValues.Put(itemInfo.key(), itemInfo.value().AsString());
mValues.InsertOrUpdate(itemInfo.key(), itemInfo.value().AsString());
}
if (mLoadedItems.Count() == mInitLength) {
@ -717,7 +717,7 @@ nsresult LSSnapshot::GetItemInternal(const nsAString& aKey,
if (aValue.WasPassed()) {
const nsString& value = aValue.Value();
if (!value.IsVoid()) {
mValues.Put(aKey, value);
mValues.InsertOrUpdate(aKey, value);
} else if (!result.IsVoid()) {
mValues.Remove(aKey);
}
@ -787,7 +787,7 @@ nsresult LSSnapshot::EnsureAllKeys() {
nsDataHashtable<nsStringHashKey, nsString> newValues;
for (auto key : keys) {
newValues.Put(key, VoidString());
newValues.InsertOrUpdate(key, VoidString());
}
if (mHasOtherProcessObservers) {
@ -801,8 +801,9 @@ nsresult LSSnapshot::EnsureAllKeys() {
switch (writeAndNotifyInfo.type()) {
case LSWriteAndNotifyInfo::TLSSetItemAndNotifyInfo: {
newValues.Put(writeAndNotifyInfo.get_LSSetItemAndNotifyInfo().key(),
VoidString());
newValues.InsertOrUpdate(
writeAndNotifyInfo.get_LSSetItemAndNotifyInfo().key(),
VoidString());
break;
}
case LSWriteAndNotifyInfo::TLSRemoveItemAndNotifyInfo: {
@ -834,7 +835,8 @@ nsresult LSSnapshot::EnsureAllKeys() {
switch (writeInfo.type()) {
case LSWriteInfo::TLSSetItemInfo: {
newValues.Put(writeInfo.get_LSSetItemInfo().key(), VoidString());
newValues.InsertOrUpdate(writeInfo.get_LSSetItemInfo().key(),
VoidString());
break;
}
case LSWriteInfo::TLSRemoveItemInfo: {

Просмотреть файл

@ -33,7 +33,8 @@ void LSWriteOptimizerBase::DeleteItem(const nsAString& aKey, int64_t aDelta) {
existingWriteInfo->GetType() == WriteInfo::InsertItem) {
mWriteInfos.Remove(aKey);
} else {
mWriteInfos.Put(aKey, MakeUnique<DeleteItemInfo>(NextSerialNumber(), aKey));
mWriteInfos.InsertOrUpdate(
aKey, MakeUnique<DeleteItemInfo>(NextSerialNumber(), aKey));
}
mTotalDelta += aDelta;

Просмотреть файл

@ -36,7 +36,7 @@ void LSWriteOptimizer<T, U>::InsertItem(const nsAString& aKey, const T& aValue,
} else {
newWriteInfo = MakeUnique<InsertItemInfo>(NextSerialNumber(), aKey, aValue);
}
mWriteInfos.Put(aKey, std::move(newWriteInfo));
mWriteInfos.InsertOrUpdate(aKey, std::move(newWriteInfo));
mTotalDelta += aDelta;
}
@ -55,7 +55,7 @@ void LSWriteOptimizer<T, U>::UpdateItem(const nsAString& aKey, const T& aValue,
newWriteInfo = MakeUnique<UpdateItemInfo>(NextSerialNumber(), aKey, aValue,
/* aUpdateWithMove */ false);
}
mWriteInfos.Put(aKey, std::move(newWriteInfo));
mWriteInfos.InsertOrUpdate(aKey, std::move(newWriteInfo));
mTotalDelta += aDelta;
}

Просмотреть файл

@ -1162,7 +1162,7 @@ void MediaFormatReader::OnDemuxerInitDone(const MediaResult& aResult) {
mInfo.mVideo = *videoInfo->GetAsVideoInfo();
mVideo.mWorkingInfo = MakeUnique<VideoInfo>(mInfo.mVideo);
for (const MetadataTag& tag : videoInfo->mTags) {
tags->Put(tag.mKey, tag.mValue);
tags->InsertOrUpdate(tag.mKey, tag.mValue);
}
mVideo.mOriginalInfo = std::move(videoInfo);
mTrackDemuxersMayBlock |= mVideo.mTrackDemuxer->GetSamplesMayBlock();
@ -1191,7 +1191,7 @@ void MediaFormatReader::OnDemuxerInitDone(const MediaResult& aResult) {
mInfo.mAudio = *audioInfo->GetAsAudioInfo();
mAudio.mWorkingInfo = MakeUnique<AudioInfo>(mInfo.mAudio);
for (const MetadataTag& tag : audioInfo->mTags) {
tags->Put(tag.mKey, tag.mValue);
tags->InsertOrUpdate(tag.mKey, tag.mValue);
}
mAudio.mOriginalInfo = std::move(audioInfo);
mTrackDemuxersMayBlock |= mAudio.mTrackDemuxer->GetSamplesMayBlock();

Просмотреть файл

@ -2787,7 +2787,7 @@ RefPtr<MediaManager::StreamPromise> MediaManager::GetUserMedia(
focusSource);
// Store the task w/callbacks.
self->mActiveCallbacks.Put(callID, std::move(task));
self->mActiveCallbacks.InsertOrUpdate(callID, std::move(task));
// Add a WindowID cross-reference so OnNavigation can tear
// things down
@ -3349,7 +3349,7 @@ void MediaManager::AddWindowID(uint64_t aWindowId,
aListener->MuteOrUnmuteCameras(mCamerasMuted);
aListener->MuteOrUnmuteMicrophones(mMicrophonesMuted);
GetActiveWindows()->Put(aWindowId, std::move(aListener));
GetActiveWindows()->InsertOrUpdate(aWindowId, std::move(aListener));
}
void MediaManager::RemoveWindowID(uint64_t aWindowId) {

Просмотреть файл

@ -3175,7 +3175,7 @@ MediaTrackGraph* MediaTrackGraph::GetInstance(
channelCount, aOutputDeviceID, mainThread);
uint32_t hashkey = WindowToHash(aWindow, sampleRate, aOutputDeviceID);
gGraphs.Put(hashkey, graph);
gGraphs.InsertOrUpdate(hashkey, graph);
LOG(LogLevel::Debug,
("Starting up MediaTrackGraph %p for window %p", graph, aWindow));

Просмотреть файл

@ -466,7 +466,7 @@ void MediaKeySystemAccessManager::RequestMediaKeySystemAccess(
"MediaKeySystemAccessManager::DeprecationWarningLambda Logging "
"deprecation warning '%s' to WebConsole.",
aMsgName);
warnings.Put(aMsgName, true);
warnings.InsertOrUpdate(aMsgName, true);
AutoTArray<nsString, 1> params;
nsString& uri = *params.AppendElement();
if (doc) {

Просмотреть файл

@ -132,7 +132,7 @@ void MediaKeys::Terminated() {
for (auto iter = mKeySessions.Iter(); !iter.Done(); iter.Next()) {
RefPtr<MediaKeySession>& session = iter.Data();
// XXX Could the RefPtr still be moved here?
keySessions.Put(session->GetSessionId(), RefPtr{session});
keySessions.InsertOrUpdate(session->GetSessionId(), RefPtr{session});
}
for (auto iter = keySessions.Iter(); !iter.Done(); iter.Next()) {
RefPtr<MediaKeySession>& session = iter.Data();
@ -238,14 +238,14 @@ PromiseId MediaKeys::StorePromise(DetailedPromise* aPromise) {
}
#endif
mPromises.Put(id, RefPtr{aPromise});
mPromises.InsertOrUpdate(id, RefPtr{aPromise});
return id;
}
void MediaKeys::ConnectPendingPromiseIdWithToken(PromiseId aId,
uint32_t aToken) {
// Should only be called from MediaKeySession::GenerateRequest.
mPromiseIdToken.Put(aId, aToken);
mPromiseIdToken.InsertOrUpdate(aId, aToken);
EME_LOG(
"MediaKeys[%p]::ConnectPendingPromiseIdWithToken() id=%u => token(%u)",
this, aId, aToken);
@ -326,7 +326,7 @@ void MediaKeys::OnSessionIdReady(MediaKeySession* aSession) {
"MediaKeySession with invalid sessionId passed to OnSessionIdReady()");
return;
}
mKeySessions.Put(aSession->GetSessionId(), RefPtr{aSession});
mKeySessions.InsertOrUpdate(aSession->GetSessionId(), RefPtr{aSession});
}
void MediaKeys::ResolvePromise(PromiseId aId) {
@ -361,7 +361,7 @@ void MediaKeys::ResolvePromise(PromiseId aId) {
"CDM LoadSession() returned a different session ID than requested");
return;
}
mKeySessions.Put(session->GetSessionId(), RefPtr{session});
mKeySessions.InsertOrUpdate(session->GetSessionId(), RefPtr{session});
promise->MaybeResolve(session);
}
@ -619,7 +619,7 @@ already_AddRefed<MediaKeySession> MediaKeys::CreateSession(
EME_LOG("MediaKeys[%p]::CreateSession(aSessionType=%" PRIu8
") putting session with token=%" PRIu32 " into mPendingSessions",
this, static_cast<uint8_t>(aSessionType), session->Token());
mPendingSessions.Put(session->Token(), RefPtr{session});
mPendingSessions.InsertOrUpdate(session->Token(), RefPtr{session});
return session.forget();
}

Просмотреть файл

@ -132,7 +132,7 @@ void ChromiumCDMParent::CreateSession(uint32_t aCreateSessionToken,
aPromiseId, "Failed to send generateRequest to CDM process."_ns);
return;
}
mPromiseToCreateSessionToken.Put(aPromiseId, aCreateSessionToken);
mPromiseToCreateSessionToken.InsertOrUpdate(aPromiseId, aCreateSessionToken);
}
void ChromiumCDMParent::LoadSession(uint32_t aPromiseId, uint32_t aSessionType,

Просмотреть файл

@ -119,7 +119,8 @@ class GMPDiskStorage : public GMPStorage {
continue;
}
mRecords.Put(recordName, MakeUnique<Record>(filename, recordName));
mRecords.InsertOrUpdate(recordName,
MakeUnique<Record>(filename, recordName));
}
return NS_OK;

Просмотреть файл

@ -487,7 +487,7 @@ already_AddRefed<GMPContentParent> GMPServiceChild::GetBridgedGMPContentParent(
DebugOnly<bool> ok = endpoint.Bind(parent);
MOZ_ASSERT(ok);
mContentParents.Put(aOtherPid, RefPtr{parent});
mContentParents.InsertOrUpdate(aOtherPid, RefPtr{parent});
return parent.forget();
}

Просмотреть файл

@ -1040,7 +1040,7 @@ already_AddRefed<GMPStorage> GeckoMediaPluginServiceParent::GetMemoryStorageFor(
RefPtr<GMPStorage> s;
if (!mTempGMPStorage.Get(aNodeId, getter_AddRefs(s))) {
s = CreateGMPMemoryStorage();
mTempGMPStorage.Put(aNodeId, RefPtr{s});
mTempGMPStorage.InsertOrUpdate(aNodeId, RefPtr{s});
}
return s.forget();
}
@ -1081,7 +1081,7 @@ nsresult GeckoMediaPluginServiceParent::GetNodeId(
return rv;
}
aOutId = salt;
mPersistentStorageAllowed.Put(salt, false);
mPersistentStorageAllowed.InsertOrUpdate(salt, false);
return NS_OK;
}
@ -1103,7 +1103,7 @@ nsresult GeckoMediaPluginServiceParent::GetNodeId(
}
auto salt = MakeUnique<nsCString>(newSalt);
mPersistentStorageAllowed.Put(*salt, false);
mPersistentStorageAllowed.InsertOrUpdate(*salt, false);
entry.Insert(std::move(salt));
}
@ -1200,7 +1200,7 @@ nsresult GeckoMediaPluginServiceParent::GetNodeId(
}
aOutId = salt;
mPersistentStorageAllowed.Put(salt, true);
mPersistentStorageAllowed.InsertOrUpdate(salt, true);
return NS_OK;
}

Просмотреть файл

@ -84,7 +84,7 @@ GMPErr GMPStorageChild::CreateRecord(const nsCString& aRecordName,
}
RefPtr<GMPRecordImpl> record(new GMPRecordImpl(this, aRecordName, aClient));
mRecords.Put(aRecordName, RefPtr{record}); // Addrefs
mRecords.InsertOrUpdate(aRecordName, RefPtr{record}); // Addrefs
// The GMPRecord holds a self reference until the GMP calls Close() on
// it. This means the object is always valid (even if neutered) while

Просмотреть файл

@ -35,7 +35,7 @@ GMPErr GMPTimerChild::SetTimer(GMPTask* aTask, int64_t aTimeoutMS) {
return GMPQuotaExceededErr;
}
uint32_t timerId = mTimerCount;
mTimers.Put(timerId, aTask);
mTimers.InsertOrUpdate(timerId, aTask);
mTimerCount++;
if (!SendSetTimer(timerId, aTimeoutMS)) {

Просмотреть файл

@ -152,8 +152,9 @@ bool GMPInfoFileParser::Init(nsIFile* aInfoFile) {
auto value = MakeUnique<nsCString>(Substring(line, colon + 1));
value->Trim(" ");
mValues.Put(key,
std::move(value)); // Hashtable assumes ownership of value.
mValues.InsertOrUpdate(
key,
std::move(value)); // Hashtable assumes ownership of value.
}
return true;

Просмотреть файл

@ -199,7 +199,7 @@ static nsDataHashtable<nsCStringHashKey, int32_t> DecoderVersionTable() {
* will be erased. An example of assigning the version number `1` for AV1
* decoder is:
*
* decoderVersionTable.Put("video/av1"_ns, 1);
* decoderVersionTable.InsertOrUpdate("video/av1"_ns, 1);
*
* For the decoders not listed here the `CheckVersion` method exits early, to
* avoid sending unecessary IPC messages.

Просмотреть файл

@ -105,7 +105,8 @@ MediaPlaybackStatus::ContextMediaInfo&
MediaPlaybackStatus::GetNotNullContextInfo(uint64_t aContextId) {
MOZ_ASSERT(NS_IsMainThread());
if (!mContextInfoMap.Contains(aContextId)) {
mContextInfoMap.Put(aContextId, MakeUnique<ContextMediaInfo>(aContextId));
mContextInfoMap.InsertOrUpdate(aContextId,
MakeUnique<ContextMediaInfo>(aContextId));
}
return *(mContextInfoMap.GetValue(aContextId)->get());
}

Просмотреть файл

@ -67,7 +67,8 @@ void MediaStatusManager::NotifySessionCreated(uint64_t aBrowsingContextId) {
}
LOG("Session %" PRIu64 " has been created", aBrowsingContextId);
mMediaSessionInfoMap.Put(aBrowsingContextId, MediaSessionInfo::EmptyInfo());
mMediaSessionInfoMap.InsertOrUpdate(aBrowsingContextId,
MediaSessionInfo::EmptyInfo());
if (IsSessionOwningAudioFocus(aBrowsingContextId)) {
SetActiveMediaSessionContextId(aBrowsingContextId);
}

Просмотреть файл

@ -156,7 +156,7 @@ bool OggCodecState::AddVorbisComment(UniquePtr<MetadataTags>& aTags,
LOG(LogLevel::Debug, ("Skipping comment: invalid UTF-8 in value"));
return false;
}
aTags->Put(key, value);
aTags->InsertOrUpdate(key, value);
return true;
}
@ -1563,7 +1563,7 @@ bool SkeletonState::DecodeIndex(ogg_packet* aPacket) {
int32_t keyPointsRead = keyPoints->Length();
if (keyPointsRead > 0) {
mIndex.Put(serialno, std::move(keyPoints));
mIndex.InsertOrUpdate(serialno, std::move(keyPoints));
}
LOG(LogLevel::Debug, ("Loaded %d keypoints for Skeleton on stream %u",

Просмотреть файл

@ -15,7 +15,7 @@ OggCodecStore::OggCodecStore() : mMonitor("CodecStore") {}
OggCodecState* OggCodecStore::Add(uint32_t serial,
UniquePtr<OggCodecState> codecState) {
MonitorAutoLock mon(mMonitor);
return mCodecStates.Put(serial, std::move(codecState)).get();
return mCodecStates.InsertOrUpdate(serial, std::move(codecState)).get();
}
bool OggCodecStore::Contains(uint32_t serial) {

Просмотреть файл

@ -102,7 +102,7 @@ RefPtr<MediaDataDecoder::DecodePromise> DAV1DDecoder::InvokeDecode(
// release callback are not coming in the same order that the
// buffers have been added in the decoder (threading ordering
// inside decoder)
mDecodingBuffers.Put(aSample->Data(), RefPtr{aSample});
mDecodingBuffers.InsertOrUpdate(aSample->Data(), RefPtr{aSample});
Dav1dData data;
int res = dav1d_data_wrap(&data, aSample->Data(), aSample->Size(),
ReleaseDataBuffer_s, this);

Просмотреть файл

@ -145,7 +145,8 @@ class EMEDecryptor : public MediaDataDecoder,
return;
}
mDecrypts.Put(aSample, MakeUnique<DecryptPromiseRequestHolder>());
mDecrypts.InsertOrUpdate(aSample,
MakeUnique<DecryptPromiseRequestHolder>());
mProxy->Decrypt(aSample)
->Then(mThread, __func__, this, &EMEDecryptor::Decrypted,
&EMEDecryptor::Decrypted)

Просмотреть файл

@ -71,7 +71,8 @@ class OriginKeyStore : public nsISupports {
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
key = mKeys.Put(principalString, MakeUnique<OriginKey>(salt)).get();
key = mKeys.InsertOrUpdate(principalString, MakeUnique<OriginKey>(salt))
.get();
}
if (aPersist && !key->mSecondsStamp) {
key->mSecondsStamp = PR_Now() / PR_USEC_PER_SEC;
@ -258,7 +259,7 @@ class OriginKeyStore : public nsISupports {
if (NS_FAILED(rv)) {
continue;
}
mKeys.Put(origin, MakeUnique<OriginKey>(key, secondsstamp));
mKeys.InsertOrUpdate(origin, MakeUnique<OriginKey>(key, secondsstamp));
}
mPersistCount = mKeys.Count();
return NS_OK;

Просмотреть файл

@ -124,7 +124,7 @@ void MediaSystemResourceManager::Register(MediaSystemResourceClient* aClient) {
MOZ_ASSERT(aClient);
MOZ_ASSERT(!mResourceClients.Get(aClient->mId));
mResourceClients.Put(aClient->mId, aClient);
mResourceClients.InsertOrUpdate(aClient->mId, aClient);
}
void MediaSystemResourceManager::Unregister(

Просмотреть файл

@ -1241,7 +1241,8 @@ void AudioContext::Unmute() const {
void AudioContext::SetParamMapForWorkletName(
const nsAString& aName, AudioParamDescriptorMap* aParamMap) {
MOZ_ASSERT(!mWorkletParamDescriptors.GetValue(aName));
Unused << mWorkletParamDescriptors.Put(aName, move(*aParamMap), fallible);
Unused << mWorkletParamDescriptors.InsertOrUpdate(aName, move(*aParamMap),
fallible);
}
size_t AudioContext::SizeOfIncludingThis(

Просмотреть файл

@ -171,7 +171,8 @@ void AudioWorkletGlobalScope::RegisterProcessor(
* 8. Append the key-value pair name processorCtor to node name to processor
* constructor map of the associated AudioWorkletGlobalScope.
*/
if (!mNameToProcessorMap.Put(aName, RefPtr{&aProcessorCtor}, fallible)) {
if (!mNameToProcessorMap.InsertOrUpdate(aName, RefPtr{&aProcessorCtor},
fallible)) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return;
}

Просмотреть файл

@ -248,7 +248,7 @@ void SpeechSynthesis::GetVoices(
for (uint32_t i = 0; i < aResult.Length(); i++) {
SpeechSynthesisVoice* voice = aResult[i];
mVoiceCache.Put(voice->mUri, RefPtr{voice});
mVoiceCache.InsertOrUpdate(voice->mUri, RefPtr{voice});
}
}

Просмотреть файл

@ -487,7 +487,7 @@ nsresult nsSynthVoiceRegistry::AddVoiceImpl(
aLocalService, aQueuesUtterances);
mVoices.AppendElement(voice);
mUriVoiceMap.Put(aUri, std::move(voice));
mUriVoiceMap.InsertOrUpdate(aUri, std::move(voice));
mUseGlobalQueue |= aQueuesUtterances;
nsTArray<SpeechSynthesisParent*> ssplist;

Просмотреть файл

@ -398,9 +398,9 @@ void SpeechDispatcherService::Setup() {
uri.Append(NS_ConvertUTF8toUTF16(lang));
mVoices.Put(uri, MakeRefPtr<SpeechDispatcherVoice>(
NS_ConvertUTF8toUTF16(list[i]->name),
NS_ConvertUTF8toUTF16(lang)));
mVoices.InsertOrUpdate(uri, MakeRefPtr<SpeechDispatcherVoice>(
NS_ConvertUTF8toUTF16(list[i]->name),
NS_ConvertUTF8toUTF16(lang)));
}
}
@ -502,7 +502,7 @@ SpeechDispatcherService::Speak(const nsAString& aText, const nsAString& aUri,
return NS_ERROR_FAILURE;
}
mCallbacks.Put(msg_id, std::move(callback));
mCallbacks.InsertOrUpdate(msg_id, std::move(callback));
} else {
// Speech dispatcher does not work well with empty strings.
// In that case, don't send empty string to speechd,

Просмотреть файл

@ -305,7 +305,7 @@ bool SapiService::RegisterVoices() {
continue;
}
mVoices.Put(uri, std::move(voiceToken));
mVoices.InsertOrUpdate(uri, std::move(voiceToken));
}
registry->NotifyVoicesChanged();

Просмотреть файл

@ -104,12 +104,13 @@ bool MessagePortService::RequestEntangling(MessagePortParent* aParent,
return false;
}
mPorts.Put(aDestinationUUID,
MakeUnique<MessagePortServiceData>(aParent->ID()));
mPorts.InsertOrUpdate(aDestinationUUID,
MakeUnique<MessagePortServiceData>(aParent->ID()));
data = mPorts
.Put(aParent->ID(),
MakeUnique<MessagePortServiceData>(aDestinationUUID))
.InsertOrUpdate(
aParent->ID(),
MakeUnique<MessagePortServiceData>(aDestinationUUID))
.get();
}

Просмотреть файл

@ -2386,7 +2386,7 @@ NPError PluginInstanceChild::NPN_InitAsyncSurface(NPSize* size,
// Hold the shmem alive until Finalize() is called or this actor dies.
holder = new DirectBitmap(this, shmem, IntSize(size->width, size->height),
surface->bitmap.stride, mozformat);
mDirectBitmaps.Put(surface, std::move(holder));
mDirectBitmaps.InsertOrUpdate(surface, std::move(holder));
return NPERR_NO_ERROR;
}
#if defined(XP_WIN)
@ -2417,7 +2417,7 @@ NPError PluginInstanceChild::NPN_InitAsyncSurface(NPSize* size,
surface->format = format;
surface->sharedHandle = reinterpret_cast<HANDLE>(handle);
mDxgiSurfaces.Put(surface, handle);
mDxgiSurfaces.InsertOrUpdate(surface, handle);
return NPERR_NO_ERROR;
}
#endif

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше