зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1492011 Remove Console::mCallDataStoragePending r=baku
Now that ConsoleCallData has nothing to trace, mCallDataStoragePending has no purpose. Depends on D67989 Differential Revision: https://phabricator.services.mozilla.com/D67990 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
ddd9e31d2f
Коммит
2f45248784
|
@ -195,24 +195,15 @@ class ConsoleCallData final {
|
|||
Maybe<nsTArray<ConsoleStackEntry>> mReifiedStack;
|
||||
nsCOMPtr<nsIStackFrame> mStack;
|
||||
|
||||
// mStatus is about the lifetime of this object. Console must take care of
|
||||
// keep it alive or not following this enumeration.
|
||||
// mStatus is about the lifetime of this object.
|
||||
enum {
|
||||
// If the object is created but it is owned by some runnable, this is its
|
||||
// status. It can be deleted at any time.
|
||||
// If the object is created but it is not owned by some runnable, this is
|
||||
// its status.
|
||||
eUnused,
|
||||
|
||||
// When a runnable takes ownership of a ConsoleCallData and send it to
|
||||
// different thread, this is its status. Console cannot delete it at this
|
||||
// time.
|
||||
eInUse,
|
||||
|
||||
// When a runnable owns this ConsoleCallData, we can't delete it directly.
|
||||
// instead, we mark it with this new status and we move it in
|
||||
// mCallDataStoragePending list in order to keep it alive an trace it
|
||||
// correctly. Once the runnable finishs its task, it will delete this object
|
||||
// calling ReleaseCallData().
|
||||
eToBeDeleted
|
||||
// different thread, this is its status.
|
||||
eInUse
|
||||
} mStatus;
|
||||
|
||||
private:
|
||||
|
@ -331,12 +322,8 @@ class ConsoleRunnable : public StructuredCloneHolderBase {
|
|||
void ReleaseCallData(Console* aConsole, ConsoleCallData* aCallData) {
|
||||
aConsole->AssertIsOnOwningThread();
|
||||
|
||||
if (aCallData->mStatus == ConsoleCallData::eToBeDeleted) {
|
||||
aConsole->ReleaseCallData(aCallData);
|
||||
} else {
|
||||
MOZ_ASSERT(aCallData->mStatus == ConsoleCallData::eInUse);
|
||||
aCallData->mStatus = ConsoleCallData::eUnused;
|
||||
}
|
||||
MOZ_ASSERT(aCallData->mStatus == ConsoleCallData::eInUse);
|
||||
aCallData->mStatus = ConsoleCallData::eUnused;
|
||||
}
|
||||
|
||||
// Generic
|
||||
|
@ -2393,26 +2380,14 @@ bool Console::StoreCallData(JSContext* aCx, ConsoleCallData* aCallData,
|
|||
|
||||
MOZ_ASSERT(aCallData);
|
||||
MOZ_ASSERT(!mCallDataStorage.Contains(aCallData));
|
||||
MOZ_ASSERT(!mCallDataStoragePending.Contains(aCallData));
|
||||
|
||||
mCallDataStorage.AppendElement(aCallData);
|
||||
|
||||
MOZ_ASSERT(mCallDataStorage.Length() == mArgumentStorage.length());
|
||||
|
||||
if (mCallDataStorage.Length() > STORAGE_MAX_EVENTS) {
|
||||
RefPtr<ConsoleCallData> callData = mCallDataStorage[0];
|
||||
mCallDataStorage.RemoveElementAt(0);
|
||||
mArgumentStorage.erase(&mArgumentStorage[0]);
|
||||
|
||||
MOZ_ASSERT(callData->mStatus != ConsoleCallData::eToBeDeleted);
|
||||
|
||||
// We cannot delete this object now because we have to trace its JSValues
|
||||
// until the pending operation (ConsoleCallDataWorkerRunnable or
|
||||
// ConsoleCallDataWorkletRunnable) is completed.
|
||||
if (callData->mStatus == ConsoleCallData::eInUse) {
|
||||
callData->mStatus = ConsoleCallData::eToBeDeleted;
|
||||
mCallDataStoragePending.AppendElement(callData);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -2422,7 +2397,6 @@ void Console::UnstoreCallData(ConsoleCallData* aCallData) {
|
|||
|
||||
MOZ_ASSERT(aCallData);
|
||||
MOZ_ASSERT(mCallDataStorage.Length() == mArgumentStorage.length());
|
||||
MOZ_ASSERT(!mCallDataStoragePending.Contains(aCallData));
|
||||
|
||||
size_t index = mCallDataStorage.IndexOf(aCallData);
|
||||
// It can be that mCallDataStorage has been already cleaned in case the
|
||||
|
@ -2436,15 +2410,6 @@ void Console::UnstoreCallData(ConsoleCallData* aCallData) {
|
|||
mArgumentStorage.erase(&mArgumentStorage[index]);
|
||||
}
|
||||
|
||||
void Console::ReleaseCallData(ConsoleCallData* aCallData) {
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(aCallData);
|
||||
MOZ_ASSERT(aCallData->mStatus == ConsoleCallData::eToBeDeleted);
|
||||
MOZ_ASSERT(mCallDataStoragePending.Contains(aCallData));
|
||||
|
||||
mCallDataStoragePending.RemoveElement(aCallData);
|
||||
}
|
||||
|
||||
void Console::NotifyHandler(JSContext* aCx,
|
||||
const Sequence<JS::Value>& aArguments,
|
||||
ConsoleCallData* aCallData) {
|
||||
|
|
|
@ -232,9 +232,6 @@ class Console final : public nsIObserver, public nsSupportsWeakReference {
|
|||
|
||||
void UnstoreCallData(ConsoleCallData* aData);
|
||||
|
||||
// Read in Console.cpp how this method is used.
|
||||
void ReleaseCallData(ConsoleCallData* aCallData);
|
||||
|
||||
// aCx and aArguments must be in the same JS compartment.
|
||||
MOZ_CAN_RUN_SCRIPT
|
||||
void NotifyHandler(JSContext* aCx, const Sequence<JS::Value>& aArguments,
|
||||
|
@ -457,17 +454,6 @@ class Console final : public nsIObserver, public nsSupportsWeakReference {
|
|||
nsDataHashtable<nsStringHashKey, uint32_t> mCounterRegistry;
|
||||
|
||||
nsTArray<RefPtr<ConsoleCallData>> mCallDataStorage;
|
||||
|
||||
// This array is used in a particular corner-case where:
|
||||
// 1. we are in a worker thread
|
||||
// 2. we have more than STORAGE_MAX_EVENTS
|
||||
// 3. but the main-thread ConsoleCallDataRunnable of the first one is still
|
||||
// running (this means that something very bad is happening on the
|
||||
// main-thread).
|
||||
// When this happens we want to keep the ConsoleCallData alive for traceing
|
||||
// its JSValues also if 'officially' this ConsoleCallData must be removed from
|
||||
// the storage.
|
||||
nsTArray<RefPtr<ConsoleCallData>> mCallDataStoragePending;
|
||||
// These are references to the arguments we received in each call
|
||||
// from the DOM bindings.
|
||||
// Vector<T> supports non-memmovable types such as ArgumentData
|
||||
|
|
Загрузка…
Ссылка в новой задаче