Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
Kill JS imports
Browse files Browse the repository at this point in the history
  • Loading branch information
philn authored and cpearce committed Sep 26, 2017
1 parent a07e855 commit d78c69b
Show file tree
Hide file tree
Showing 47 changed files with 44 additions and 24,128 deletions.
2 changes: 1 addition & 1 deletion GECKO_REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
423684:831be24c0b0f
423685:37d867195947
19 changes: 16 additions & 3 deletions gecko/glue/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include "Scheduler.h"

#include "jsfriendapi.h"
#include "LabeledEventQueue.h"
#include "LeakRefPtr.h"
#include "MainThreadQueue.h"
Expand All @@ -19,6 +18,7 @@
#include "PrioritizedEventQueue.h"

#ifndef GECKO_MEDIA_CRATE
#include "jsfriendapi.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/ipc/BackgroundChild.h"
#include "nsCycleCollector.h"
Expand Down Expand Up @@ -111,13 +111,15 @@ class mozilla::SchedulerImpl
static void StartEvent(Scheduler::EventLoopActivation& aActivation);
static void FinishEvent(Scheduler::EventLoopActivation& aActivation);

#ifndef GECKO_MEDIA_CRATE
void SetJSContext(size_t aIndex, JSContext* aCx)
{
mContexts[aIndex] = aCx;
}

static void YieldCallback(JSContext* aCx);
static bool InterruptCallback(JSContext* aCx);
#endif

CooperativeThreadPool* GetThreadPool() { return mThreadPool.get(); }

Expand All @@ -135,8 +137,10 @@ class mozilla::SchedulerImpl
static bool sPrefUseMultipleQueues;

private:
#ifndef GECKO_MEDIA_CRATE
void Interrupt(JSContext* aCx);
void YieldFromJS(JSContext* aCx);
#endif

static void SwitcherThread(void* aData);
void Switcher();
Expand Down Expand Up @@ -212,7 +216,9 @@ class mozilla::SchedulerImpl
static size_t sNumThreadsRunning;
static bool sUnlabeledEventRunning;

#ifndef GECKO_MEDIA_CRATE
JSContext* mContexts[CooperativeThreadPool::kMaxThreads];
#endif
};

bool SchedulerImpl::sPrefScheduler = false;
Expand Down Expand Up @@ -393,10 +399,13 @@ SchedulerImpl::SchedulerImpl(SchedulerEventQueue* aQueue)
, mQueueResource(this)
, mSystemZoneResource(this)
, mController(this, aQueue)
#ifndef GECKO_MEDIA_CRATE
, mContexts()
#endif
{
}

#ifndef GECKO_MEDIA_CRATE
void
SchedulerImpl::Interrupt(JSContext* aCx)
{
Expand All @@ -423,6 +432,7 @@ SchedulerImpl::YieldCallback(JSContext* aCx)
{
Scheduler::sScheduler->YieldFromJS(aCx);
}
#endif

void
SchedulerImpl::Switcher()
Expand Down Expand Up @@ -533,9 +543,12 @@ SchedulerImpl::SystemZoneResource::IsAvailable(const MutexAutoLock& aProofOfLock
{
mScheduler->mLock.AssertCurrentThreadOwns();

#ifdef GECKO_MEDIA_CRATE
return false;
// JSContext* cx = dom::danger::GetJSContext();
// return js::SystemZoneAvailable(cx);
#else
JSContext* cx = dom::danger::GetJSContext();
return js::SystemZoneAvailable(cx);
#endif
}

MOZ_THREAD_LOCAL(Scheduler::EventLoopActivation*) Scheduler::EventLoopActivation::sTopActivation;
Expand Down
6 changes: 3 additions & 3 deletions gecko/glue/SchedulerGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include "mozilla/SchedulerGroup.h"

#include "jsfriendapi.h"
#include "mozilla/AbstractThread.h"
#include "mozilla/Atomics.h"
#include "mozilla/Move.h"
Expand All @@ -16,6 +15,7 @@
#include "nsThreadUtils.h"

#ifndef GECKO_MEDIA_CRATE
#include "jsfriendapi.h"
#include "mozilla/dom/ScriptSettings.h"
#endif

Expand Down Expand Up @@ -98,10 +98,10 @@ AutoCollectVsyncTelemetry::CollectTelemetry()
mozilla::Telemetry::HistogramID eventsId =
mIsBackground ? Telemetry::CONTENT_JS_BACKGROUND_TICK_DELAY_EVENTS_MS
: Telemetry::CONTENT_JS_FOREGROUND_TICK_DELAY_EVENTS_MS;
#endif
mozilla::Telemetry::HistogramID totalId =
mIsBackground ? Telemetry::CONTENT_JS_BACKGROUND_TICK_DELAY_TOTAL_MS
: Telemetry::CONTENT_JS_FOREGROUND_TICK_DELAY_TOTAL_MS;
#endif

uint64_t lastSeenVsync = gEarliestUnprocessedVsync;
if (!lastSeenVsync) {
Expand All @@ -126,8 +126,8 @@ AutoCollectVsyncTelemetry::CollectTelemetry()

#ifndef GECKO_MEDIA_CRATE
Telemetry::Accumulate(eventsId, mKey, duration);
#endif
Telemetry::Accumulate(totalId, duration);
#endif

if (pendingVsync > mStart) {
return;
Expand Down
2 changes: 2 additions & 0 deletions gecko/glue/include/nsCOMPtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
#include "nsISupportsUtils.h" // for |nsresult|, |NS_ADDREF|, |NS_GET_TEMPLATE_IID| et al
#include "mozilla/RefPtr.h"

#ifndef GECKO_MEDIA_CRATE
#include "nsCycleCollectionNoteChild.h"
#endif


/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@

#include "mozilla/MemoryReporting.h"
#include "nsTArray.h"

#ifndef GECKO_MEDIA_CRATE
#include "nsCycleCollectionNoteChild.h"
#endif

#include <functional>

Expand Down Expand Up @@ -475,6 +478,7 @@ class nsTObserverArray : public nsAutoTObserverArray<T, 0>
}
};

#ifndef GECKO_MEDIA_CRATE
template<typename T, size_t N>
inline void
ImplCycleCollectionUnlink(nsAutoTObserverArray<T, N>& aField)
Expand All @@ -495,6 +499,7 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
ImplCycleCollectionTraverse(aCallback, aField.ElementAt(i), aName, aFlags);
}
}
#endif

// XXXbz I wish I didn't have to pass in the observer type, but I
// don't see a way to get it out of array_.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
#include "nsISupports.h"
#include "mozilla/Logging.h"
#include "mozilla/XREAppData.h"

#ifndef GECKO_MEDIA_CRATE
#include "js/TypeDecls.h"
#endif

#include "mozilla/ArrayUtils.h"
#include "mozilla/Assertions.h"
Expand Down Expand Up @@ -481,10 +484,13 @@ XRE_API(void,
XRE_API(MessageLoop*,
XRE_GetIOMessageLoop, ())

#ifndef GECKO_MEDIA_CRATE
XRE_API(bool,
XRE_SendTestShellCommand, (JSContext* aCx,
JSString* aCommand,
void* aCallback))
#endif

XRE_API(bool,
XRE_ShutdownTestShell, ())

Expand Down
7 changes: 6 additions & 1 deletion gecko/include/xptcall.h → gecko/glue/include/xptcall.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
#include "nsISupports.h"
#include "xpt_struct.h"
#include "xptinfo.h"
#include "js/Value.h"
#include "mozilla/MemoryReporting.h"

#ifndef GECKO_MEDIA_CRATE
#include "js/Value.h"
#endif

struct nsXPTCMiniVariant
{
// No ctors or dtors so that we can use arrays of these on the stack
Expand All @@ -39,7 +42,9 @@ struct nsXPTCMiniVariant
// Types below here are unknown to the assembly implementations, and
// therefore _must_ be passed with indirect semantics. We put them in
// the union here for type safety, so that we can avoid void* tricks.
#ifndef GECKO_MEDIA_CRATE
JS::Value j;
#endif
} val;
};

Expand Down
5 changes: 4 additions & 1 deletion gecko/glue/nsThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
#include "nsCOMPtr.h"
#include "nsQueryObject.h"
#include "pratom.h"
#include "mozilla/CycleCollectedJSContext.h"
#include "mozilla/Logging.h"
#include "nsIObserverService.h"
#include "mozilla/HangMonitor.h"
#include "mozilla/IOInterposer.h"
#include "mozilla/Scheduler.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/ScopeExit.h"
#include "mozilla/Services.h"
#include "mozilla/SystemGroup.h"
#include "nsXPCOMPrivate.h"
Expand All @@ -44,6 +44,7 @@
#include "ThreadEventTarget.h"

#ifndef GECKO_MEDIA_CRATE
#include "mozilla/CycleCollectedJSContext.h"
#include "mozilla/ipc/MessageChannel.h"
#include "mozilla/ipc/BackgroundChild.h"
#include "mozilla/dom/ScriptSettings.h"
Expand Down Expand Up @@ -1210,6 +1211,7 @@ nsThread::RemoveObserver(nsIThreadObserver* aObserver)
return NS_OK;
}

#ifndef GECKO_MEDIA_CRATE
void
nsThread::SetScriptObserver(mozilla::CycleCollectedJSContext* aScriptObserver)
{
Expand All @@ -1221,6 +1223,7 @@ nsThread::SetScriptObserver(mozilla::CycleCollectedJSContext* aScriptObserver)
MOZ_ASSERT(!mScriptObserver);
mScriptObserver = aScriptObserver;
}
#endif

void
nsThread::DoMainThreadSpecificProcessing(bool aReallyWait)
Expand Down
Loading

0 comments on commit d78c69b

Please sign in to comment.