Bug 1626570 - Improve handling of copying arrays in dom/workers/. r=dom-workers-and-storage-reviewers,ytausky

Differential Revision: https://phabricator.services.mozilla.com/D73668
This commit is contained in:
Simon Giesecke 2020-05-11 08:22:17 +00:00
Родитель fdd762b2fb
Коммит da93ce54da
8 изменённых файлов: 13 добавлений и 13 удалений

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

@ -42,7 +42,7 @@ struct JSSettings {
JSContentChromeSettings chrome;
JSContentChromeSettings content;
nsTArray<JSGCSetting> gcSettings;
CopyableTArray<JSGCSetting> gcSettings;
JS::ContextOptions contextOptions;
#ifdef JS_GC_ZEAL

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

@ -2031,7 +2031,7 @@ void RuntimeService::UpdateAllWorkerLanguages(
const nsTArray<nsString>& aLanguages) {
MOZ_ASSERT(NS_IsMainThread());
mNavigatorProperties.mLanguages = aLanguages;
mNavigatorProperties.mLanguages = aLanguages.Clone();
BROADCAST_ALL_WORKERS(UpdateLanguages, aLanguages);
}

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

@ -82,7 +82,7 @@ class RuntimeService final : public nsIObserver {
nsString mAppVersionOverridden;
nsString mPlatform;
nsString mPlatformOverridden;
nsTArray<nsString> mLanguages;
CopyableTArray<nsString> mLanguages;
};
private:

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

@ -395,7 +395,7 @@ void WorkerDebugger::Close() {
MOZ_ASSERT(mWorkerPrivate);
mWorkerPrivate = nullptr;
nsTArray<nsCOMPtr<nsIWorkerDebuggerListener>> listeners(mListeners);
nsTArray<nsCOMPtr<nsIWorkerDebuggerListener>> listeners(mListeners.Clone());
for (size_t index = 0; index < listeners.Length(); ++index) {
listeners[index]->OnClose();
}
@ -416,7 +416,7 @@ void WorkerDebugger::PostMessageToDebuggerOnMainThread(
const nsAString& aMessage) {
AssertIsOnMainThread();
nsTArray<nsCOMPtr<nsIWorkerDebuggerListener>> listeners(mListeners);
nsTArray<nsCOMPtr<nsIWorkerDebuggerListener>> listeners(mListeners.Clone());
for (size_t index = 0; index < listeners.Length(); ++index) {
listeners[index]->OnMessage(aMessage);
}
@ -439,7 +439,7 @@ void WorkerDebugger::ReportErrorToDebuggerOnMainThread(
const nsAString& aFilename, uint32_t aLineno, const nsAString& aMessage) {
AssertIsOnMainThread();
nsTArray<nsCOMPtr<nsIWorkerDebuggerListener>> listeners(mListeners);
nsTArray<nsCOMPtr<nsIWorkerDebuggerListener>> listeners(mListeners.Clone());
for (size_t index = 0; index < listeners.Length(); ++index) {
listeners[index]->OnError(aFilename, aLineno, aMessage);
}

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

@ -76,7 +76,7 @@ class WorkerDebuggerEnumerator final : public nsSimpleEnumerator {
public:
explicit WorkerDebuggerEnumerator(
const nsTArray<RefPtr<WorkerDebugger>>& aDebuggers)
: mDebuggers(aDebuggers), mIndex(0) {}
: mDebuggers(aDebuggers.Clone()), mIndex(0) {}
NS_DECL_NSISIMPLEENUMERATOR
@ -282,7 +282,7 @@ void WorkerDebuggerManager::RegisterDebuggerMainThread(
{
MutexAutoLock lock(mMutex);
listeners = mListeners;
listeners = mListeners.Clone();
}
for (size_t index = 0; index < listeners.Length(); ++index) {
@ -314,7 +314,7 @@ void WorkerDebuggerManager::UnregisterDebuggerMainThread(
{
MutexAutoLock lock(mMutex);
listeners = mListeners;
listeners = mListeners.Clone();
}
for (size_t index = 0; index < listeners.Length(); ++index) {

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

@ -65,7 +65,7 @@ JSObject* WorkerNavigator::WrapObject(JSContext* aCx,
void WorkerNavigator::SetLanguages(const nsTArray<nsString>& aLanguages) {
WorkerNavigator_Binding::ClearCachedLanguagesValue(this);
mProperties.mLanguages = aLanguages;
mProperties.mLanguages = aLanguages.Clone();
}
void WorkerNavigator::GetAppName(nsString& aAppName,

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

@ -73,7 +73,7 @@ class WorkerNavigator final : public nsWrapperCache {
}
void GetLanguages(nsTArray<nsString>& aLanguages) const {
aLanguages = mProperties.mLanguages;
aLanguages = mProperties.mLanguages.Clone();
}
void GetUserAgent(nsString& aUserAgent, CallerType aCallerType,

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

@ -515,7 +515,7 @@ class ReportErrorToConsoleRunnable final : public WorkerRunnable {
const nsTArray<nsString>& aParams)
: WorkerRunnable(aWorkerPrivate, ParentThreadUnchangedBusyCount),
mMessage(aMessage),
mParams(aParams) {}
mParams(aParams.Clone()) {}
virtual void PostDispatch(WorkerPrivate* aWorkerPrivate,
bool aDispatchResult) override {
@ -656,7 +656,7 @@ class UpdateLanguagesRunnable final : public WorkerRunnable {
public:
UpdateLanguagesRunnable(WorkerPrivate* aWorkerPrivate,
const nsTArray<nsString>& aLanguages)
: WorkerRunnable(aWorkerPrivate), mLanguages(aLanguages) {}
: WorkerRunnable(aWorkerPrivate), mLanguages(aLanguages.Clone()) {}
virtual bool WorkerRun(JSContext* aCx,
WorkerPrivate* aWorkerPrivate) override {