Skip to content

Commit

Permalink
Backed out 8 changesets (bug 1920115) for causing multiple failures.
Browse files Browse the repository at this point in the history
Backed out changeset 2d0905a92f2c (bug 1920115)
Backed out changeset 67bf260fe59b (bug 1920115)
Backed out changeset 4739af17e757 (bug 1920115)
Backed out changeset 0773f669c498 (bug 1920115)
Backed out changeset 4b579a1c9b46 (bug 1920115)
Backed out changeset 79b3b0148eb4 (bug 1920115)
Backed out changeset 78181c32bdc6 (bug 1920115)
Backed out changeset 912cf1adac80 (bug 1920115)
  • Loading branch information
Stanca Serban committed Feb 28, 2025
1 parent e7468e2 commit 69747e8
Show file tree
Hide file tree
Showing 29 changed files with 302 additions and 924 deletions.
14 changes: 0 additions & 14 deletions dom/base/IdleRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "mozilla/dom/WindowBinding.h"
#include "nsComponentManagerUtils.h"
#include "nsPIDOMWindow.h"
#include "mozilla/dom/WebTaskScheduler.h"

namespace mozilla::dom {

Expand Down Expand Up @@ -55,20 +54,7 @@ void IdleRequest::IdleRun(nsPIDOMWindowInner* aWindow,
new IdleDeadline(aWindow, aDidTimeout, aDeadline);
RefPtr<IdleRequestCallback> callback(std::move(mCallback));
MOZ_ASSERT(!mCallback);

RefPtr<nsGlobalWindowInner> innerWindow = nsGlobalWindowInner::Cast(aWindow);
// https://wicg.github.io/scheduling-apis/#sec-patches-invoke-idle-callbacks
// Let state be a new scheduling state.
RefPtr<WebTaskSchedulingState> newState = new WebTaskSchedulingState();
// Set state’s priority source to the result of creating a fixed priority
// unabortable task signal given "background" and realm.
newState->SetPrioritySource(
new TaskSignal(aWindow->AsGlobal(), TaskPriority::Background));
// Set event loop’s current scheduling state to state.
innerWindow->SetWebTaskSchedulingState(newState);
callback->Call(*deadline, "requestIdleCallback handler");
// Set event loop’s current scheduling state to null.
innerWindow->SetWebTaskSchedulingState(nullptr);
}

} // namespace mozilla::dom
18 changes: 1 addition & 17 deletions dom/base/TimeoutManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "mozilla/net/WebSocketEventService.h"
#include "mozilla/MediaManager.h"
#include "mozilla/dom/WorkerScope.h"
#include "mozilla/dom/WebTaskScheduler.h"

using namespace mozilla;
using namespace mozilla::dom;
Expand Down Expand Up @@ -663,17 +662,6 @@ void TimeoutManager::RunTimeout(const TimeStamp& aNow,
return;
}

if (!GetInnerWindow()) {
// Workers don't use TaskController at the moment, so all the
// runnables have the same priorities. So we special case it
// here to allow "higher" prority tasks to run first before
// timers.
if (mGlobalObject.HasScheduledNormalOrHighPriorityWebTasks()) {
MOZ_ALWAYS_SUCCEEDS(MaybeSchedule(aNow));
return;
}
}

Timeouts& timeouts(aProcessIdle ? mIdleTimeouts : mTimeouts);

// Limit the overall time spent in RunTimeout() to reduce jank.
Expand Down Expand Up @@ -975,12 +963,8 @@ void TimeoutManager::RunTimeout(const TimeStamp& aNow,
}
// Check to see if we have run out of time to execute timeout handlers.
// If we've exceeded our time budget then terminate the loop immediately.
//
// Or if there are high priority tasks dispatched by the Scheduler API,
// they should run first before timers.
TimeDuration elapsed = now - start;
if (elapsed >= totalTimeLimit ||
mGlobalObject.HasScheduledNormalOrHighPriorityWebTasks()) {
if (elapsed >= totalTimeLimit) {
// We ran out of time. Make sure to schedule the executor to
// run immediately for the next timer, if it exists. Its possible,
// however, that the last timeout handler suspended the window. If
Expand Down
14 changes: 0 additions & 14 deletions dom/base/nsGlobalWindowInner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1400,8 +1400,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindowInner)

NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWebTaskScheduler)

NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWebTaskSchedulingState)

NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTrustedTypePolicyFactory)

#ifdef MOZ_WEBSPEECH
Expand Down Expand Up @@ -1513,8 +1511,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindowInner)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mWebTaskScheduler)
}

NS_IMPL_CYCLE_COLLECTION_UNLINK(mWebTaskSchedulingState)

NS_IMPL_CYCLE_COLLECTION_UNLINK(mTrustedTypePolicyFactory)

#ifdef MOZ_WEBSPEECH
Expand Down Expand Up @@ -1831,7 +1827,6 @@ void nsGlobalWindowInner::InitDocumentDependentState(JSContext* aCx) {
if (mWebTaskScheduler) {
mWebTaskScheduler->Disconnect();
mWebTaskScheduler = nullptr;
mWebTaskSchedulingState = nullptr;
}

// This must be called after nullifying the internal objects because here we
Expand Down Expand Up @@ -2900,10 +2895,6 @@ bool nsPIDOMWindowInner::IsCurrentInnerWindow() const {
return outer && outer->GetCurrentInnerWindow() == this;
}

bool nsGlobalWindowInner::HasScheduledNormalOrHighPriorityWebTasks() const {
return gNumNormalOrHighPriorityQueuesHaveTaskScheduledMainThread > 0;
}

bool nsPIDOMWindowInner::IsFullyActive() const {
WindowContext* wc = GetWindowContext();
if (!wc || wc->IsDiscarded() || !wc->IsCurrent()) {
Expand Down Expand Up @@ -4104,11 +4095,6 @@ WebTaskScheduler* nsGlobalWindowInner::Scheduler() {
return mWebTaskScheduler;
}

inline void nsGlobalWindowInner::SetWebTaskSchedulingState(
WebTaskSchedulingState* aState) {
mWebTaskSchedulingState = aState;
}

bool nsGlobalWindowInner::Find(const nsAString& aString, bool aCaseSensitive,
bool aBackwards, bool aWrapAround,
bool aWholeWord, bool aSearchInFrames,
Expand Down
9 changes: 0 additions & 9 deletions dom/base/nsGlobalWindowInner.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ class Selection;
struct SizeToContentConstraints;
class WebTaskScheduler;
class WebTaskSchedulerMainThread;
class WebTaskSchedulingState;
class SpeechSynthesis;
class Timeout;
class TrustedTypePolicyFactory;
Expand Down Expand Up @@ -338,7 +337,6 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
virtual bool HasActiveIndexedDBDatabases() override;
virtual bool HasActivePeerConnections() override;
virtual bool HasOpenWebSockets() const override;
virtual bool HasScheduledNormalOrHighPriorityWebTasks() const override;
void SyncStateFromParentWindow();

// Called on the current inner window of a browsing context when its
Expand Down Expand Up @@ -963,12 +961,6 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
bool CrossOriginIsolated() const override;

mozilla::dom::WebTaskScheduler* Scheduler();
void SetWebTaskSchedulingState(
mozilla::dom::WebTaskSchedulingState* aState) override;
mozilla::dom::WebTaskSchedulingState* GetWebTaskSchedulingState()
const override {
return mWebTaskSchedulingState;
}

protected:
// Web IDL helpers
Expand Down Expand Up @@ -1285,7 +1277,6 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
RefPtr<mozilla::dom::ContentMediaController> mContentMediaController;

RefPtr<mozilla::dom::WebTaskSchedulerMainThread> mWebTaskScheduler;
RefPtr<mozilla::dom::WebTaskSchedulingState> mWebTaskSchedulingState;

RefPtr<mozilla::dom::TrustedTypePolicyFactory> mTrustedTypePolicyFactory;

Expand Down
12 changes: 0 additions & 12 deletions dom/base/nsIGlobalObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class ServiceWorkerContainer;
class ServiceWorkerRegistration;
class ServiceWorkerRegistrationDescriptor;
class StorageManager;
class WebTaskSchedulingState;
enum class CallerType : uint32_t;
} // namespace dom
namespace ipc {
Expand Down Expand Up @@ -195,13 +194,6 @@ class nsIGlobalObject : public nsISupports {
return nullptr;
}

virtual void SetWebTaskSchedulingState(
mozilla::dom::WebTaskSchedulingState* aState) {}
virtual mozilla::dom::WebTaskSchedulingState* GetWebTaskSchedulingState()
const {
return nullptr;
}

// For globals with a concept of a Base URI (windows, workers), the base URI,
// nullptr otherwise.
virtual nsIURI* GetBaseURI() const;
Expand Down Expand Up @@ -345,10 +337,6 @@ class nsIGlobalObject : public nsISupports {

virtual bool IsXPCSandbox() { return false; }

virtual bool HasScheduledNormalOrHighPriorityWebTasks() const {
return false;
}

/**
* Report a localized error message to the error console. Currently this
* amounts to a wrapper around nsContentUtils::ReportToConsole for window
Expand Down
7 changes: 0 additions & 7 deletions dom/script/ScriptSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,6 @@ nsIGlobalObject* GetCurrentGlobal() {
return xpc::NativeGlobal(global);
}

WebTaskSchedulingState* GetWebTaskSchedulingState() {
if (const nsIGlobalObject* global = GetEntryGlobal()) {
return global->GetWebTaskSchedulingState();
}
return nullptr;
}

nsIPrincipal* GetWebIDLCallerPrincipal() {
MOZ_ASSERT(NS_IsMainThread());
ScriptSettingsStackEntry* entry = ScriptSettingsStack::EntryPoint();
Expand Down
3 changes: 0 additions & 3 deletions dom/script/ScriptSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ namespace mozilla {
namespace dom {

class Document;
class WebTaskSchedulingState;

/*
* Per thread setup/teardown routines. Init and Destroy should be invoked
Expand Down Expand Up @@ -96,8 +95,6 @@ nsIGlobalObject* GetIncumbentGlobal();
// Returns the global associated with the current compartment. This may be null.
nsIGlobalObject* GetCurrentGlobal();

WebTaskSchedulingState* GetWebTaskSchedulingState();

// JS-implemented WebIDL presents an interesting situation with respect to the
// subject principal. A regular C++-implemented API can simply examine the
// compartment of the most-recently-executed script, and use that to infer the
Expand Down
3 changes: 0 additions & 3 deletions dom/webidl/WebTaskScheduling.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ interface Scheduler {
SchedulerPostTaskCallback callback,
optional SchedulerPostTaskOptions options = {}
);

[BinaryName="yieldImpl"]
Promise<undefined> yield();
};

dictionary TaskControllerInit {
Expand Down
23 changes: 0 additions & 23 deletions dom/webscheduling/TaskSignal.cpp

This file was deleted.

11 changes: 9 additions & 2 deletions dom/webscheduling/TaskSignal.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/AbortSignal.h"
#include "mozilla/dom/WebTaskSchedulingBinding.h"
#include "WebTaskScheduler.h"

namespace mozilla::dom {
class TaskSignal : public AbortSignal {
Expand Down Expand Up @@ -39,9 +40,15 @@ class TaskSignal : public AbortSignal {
mPriorityChanging = aPriorityChanging;
}

void RunPriorityChangeAlgorithms();
void SetWebTaskScheduler(WebTaskScheduler* aScheduler) {
mSchedulers.AppendElement(aScheduler);
}

void SetWebTaskScheduler(WebTaskScheduler* aScheduler);
void RunPriorityChangeAlgorithms() {
for (const WeakPtr<WebTaskScheduler>& scheduler : mSchedulers) {
scheduler->RunTaskSignalPriorityChange(this);
}
}

private:
TaskPriority mPriority;
Expand Down
Loading

0 comments on commit 69747e8

Please sign in to comment.