Skip to content

Commit

Permalink
Backed out 4 changesets (bug 1842871, bug 1876536) for Constructor re…
Browse files Browse the repository at this point in the history
…lated sm bustages. CLOSED TREE

Backed out changeset 2a8075f926e8 (bug 1842871)
Backed out changeset 133df2717c5b (bug 1876536)
Backed out changeset 8ec499a5a57b (bug 1876536)
Backed out changeset 1568bfa2cc45 (bug 1876536)
  • Loading branch information
Stanca Serban committed Feb 1, 2024
1 parent d5ac7fc commit b78f8ab
Show file tree
Hide file tree
Showing 16 changed files with 52 additions and 208 deletions.
1 change: 0 additions & 1 deletion build/clang-plugin/Checks.inc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ CHECK(OverrideBaseCallUsageChecker, "override-base-call-usage")
CHECK(ParamTraitsEnumChecker, "paramtraits-enum")
CHECK(RefCountedCopyConstructorChecker, "refcounted-copy-constructor")
CHECK(RefCountedInsideLambdaChecker, "refcounted-inside-lambda")
CHECK(RefCountedThisInsideConstructorChecker, "refcount-within-constructor")
CHECK(ScopeChecker, "scope")
CHECK(SprintfLiteralChecker, "sprintf-literal")
CHECK(TemporaryLifetimeBoundChecker, "temporary-lifetime-bound")
Expand Down
1 change: 0 additions & 1 deletion build/clang-plugin/ChecksIncludes.inc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include "ParamTraitsEnumChecker.h"
#include "RefCountedCopyConstructorChecker.h"
#include "RefCountedInsideLambdaChecker.h"
#include "RefCountedThisInsideConstructorChecker.h"
#include "ScopeChecker.h"
#include "SprintfLiteralChecker.h"
#include "TemporaryLifetimeBoundChecker.h"
Expand Down
29 changes: 0 additions & 29 deletions build/clang-plugin/RefCountedThisInsideConstructorChecker.cpp

This file was deleted.

19 changes: 0 additions & 19 deletions build/clang-plugin/RefCountedThisInsideConstructorChecker.h

This file was deleted.

1 change: 0 additions & 1 deletion build/clang-plugin/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ HOST_SOURCES += [
"ParamTraitsEnumChecker.cpp",
"RefCountedCopyConstructorChecker.cpp",
"RefCountedInsideLambdaChecker.cpp",
"RefCountedThisInsideConstructorChecker.cpp",
"ScopeChecker.cpp",
"SprintfLiteralChecker.cpp",
"TemporaryLifetimeBoundChecker.cpp",
Expand Down
70 changes: 0 additions & 70 deletions build/clang-plugin/tests/TestRefCountedThisInsideConstructor.cpp

This file was deleted.

1 change: 0 additions & 1 deletion build/clang-plugin/tests/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ SOURCES += [
"TestOverrideBaseCallAnnotation.cpp",
"TestParamTraitsEnum.cpp",
"TestRefCountedCopyConstructor.cpp",
"TestRefCountedThisInsideConstructor.cpp",
"TestSprintfLiteral.cpp",
"TestStackClass.cpp",
"TestStaticLocalClass.cpp",
Expand Down
3 changes: 1 addition & 2 deletions dom/canvas/ImageBitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class SendShutdownToWorkerThread : public MainThreadWorkerControlRunnable {
*/
class ImageBitmapShutdownObserver final : public nsIObserver {
public:
void Init() {
explicit ImageBitmapShutdownObserver() {
sShutdownMutex.AssertCurrentThreadOwns();
if (NS_IsMainThread()) {
RegisterObserver();
Expand Down Expand Up @@ -649,7 +649,6 @@ ImageBitmap::ImageBitmap(nsIGlobalObject* aGlobal, layers::Image* aData,
if (!sShutdownObserver &&
!AppShutdown::IsInOrBeyond(ShutdownPhase::XPCOMShutdown)) {
sShutdownObserver = new ImageBitmapShutdownObserver();
sShutdownObserver->Init();
}
if (sShutdownObserver) {
mShutdownRunnable = sShutdownObserver->Track(this);
Expand Down
20 changes: 9 additions & 11 deletions dom/canvas/SourceSurfaceWebgl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ SourceSurfaceWebgl::SourceSurfaceWebgl(DrawTargetWebgl* aDT)
mSharedContext(aDT->mSharedContext) {}

SourceSurfaceWebgl::SourceSurfaceWebgl(
const RefPtr<TextureHandle>& aHandle,
const RefPtr<SharedContextWebgl>& aSharedContext)
: mSharedContext(aSharedContext) {}
: mFormat(aHandle->GetFormat()),
mSize(aHandle->GetSize()),
mSharedContext(aSharedContext),
mHandle(aHandle) {
mHandle->SetSurface(this);
}

SourceSurfaceWebgl::~SourceSurfaceWebgl() {
if (mHandle) {
Expand Down Expand Up @@ -109,14 +115,6 @@ void SourceSurfaceWebgl::GiveTexture(RefPtr<TextureHandle> aHandle) {
mDT = nullptr;
}

void SourceSurfaceWebgl::SetHandle(TextureHandle* aHandle) {
MOZ_ASSERT(!mHandle);
mFormat = aHandle->GetFormat();
mSize = aHandle->GetSize();
mHandle = aHandle;
mHandle->SetSurface(this);
}

// Handler for when the owner DrawTargetWebgl is destroying the cached texture
// handle that has been allocated for this snapshot.
void SourceSurfaceWebgl::OnUnlinkTexture(SharedContextWebgl* aContext) {
Expand Down Expand Up @@ -165,8 +163,8 @@ already_AddRefed<SourceSurface> SourceSurfaceWebgl::ExtractSubrect(
return nullptr;
}
}
RefPtr<SourceSurfaceWebgl> surface = new SourceSurfaceWebgl(sharedContext);
surface->SetHandle(subHandle);
RefPtr<SourceSurface> surface =
new SourceSurfaceWebgl(subHandle, sharedContext);
return surface.forget();
}

Expand Down
6 changes: 2 additions & 4 deletions dom/canvas/SourceSurfaceWebgl.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class SourceSurfaceWebgl : public DataSourceSurface {
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SourceSurfaceWebgl, override)

explicit SourceSurfaceWebgl(DrawTargetWebgl* aDT);
SourceSurfaceWebgl(const RefPtr<TextureHandle>& aHandle,
const RefPtr<SharedContextWebgl>& aSharedContext);
virtual ~SourceSurfaceWebgl();

SurfaceType GetType() const override { return SurfaceType::WEBGL; }
Expand All @@ -44,16 +46,12 @@ class SourceSurfaceWebgl : public DataSourceSurface {
friend class DrawTargetWebgl;
friend class SharedContextWebgl;

explicit SourceSurfaceWebgl(const RefPtr<SharedContextWebgl>& aSharedContext);

bool EnsureData();

void DrawTargetWillChange(bool aNeedHandle);

void GiveTexture(RefPtr<TextureHandle> aHandle);

void SetHandle(TextureHandle* aHandle);

void OnUnlinkTexture(SharedContextWebgl* aContext);

DrawTargetWebgl* GetTarget() const { return mDT.get(); }
Expand Down
2 changes: 1 addition & 1 deletion dom/media/Benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ Benchmark::Benchmark(MediaDataDemuxer* aDemuxer, const Parameters& aParameters)
TaskQueue::Create(GetMediaThreadPool(MediaThreadType::SUPERVISOR),
"Benchmark::QueueObject")),
mParameters(aParameters),
mKeepAliveUntilComplete(this),
mPlaybackState(this, aDemuxer) {
MOZ_COUNT_CTOR(Benchmark);
}
Expand All @@ -138,7 +139,6 @@ Benchmark::~Benchmark() { MOZ_COUNT_DTOR(Benchmark); }

RefPtr<Benchmark::BenchmarkPromise> Benchmark::Run() {
RefPtr<Benchmark> self = this;
mKeepAliveUntilComplete = this;
return InvokeAsync(Thread(), __func__, [self] {
RefPtr<BenchmarkPromise> p = self->mPromise.Ensure(__func__);
self->mPlaybackState.Dispatch(NS_NewRunnableFunction(
Expand Down
48 changes: 18 additions & 30 deletions dom/media/MediaTrackGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3383,23 +3383,29 @@ void ProcessedMediaTrack::DestroyImpl() {
// SetTrackOrderDirty(), for other reasons.
}

MediaTrackGraphImpl::MediaTrackGraphImpl(uint64_t aWindowID,
TrackRate aSampleRate,
AudioDeviceID aPrimaryOutputDeviceID,
nsISerialEventTarget* aMainThread)
MediaTrackGraphImpl::MediaTrackGraphImpl(
GraphDriverType aDriverRequested, GraphRunType aRunTypeRequested,
uint64_t aWindowID, TrackRate aSampleRate, uint32_t aChannelCount,
AudioDeviceID aPrimaryOutputDeviceID, nsISerialEventTarget* aMainThread)
: MediaTrackGraph(aSampleRate, aPrimaryOutputDeviceID),
mWindowID(aWindowID),
mGraphRunner(aRunTypeRequested == SINGLE_THREAD
? GraphRunner::Create(this)
: already_AddRefed<GraphRunner>(nullptr)),
mFirstCycleBreaker(0)
// An offline graph is not initially processing.
,
mEndTime(aDriverRequested == OFFLINE_THREAD_DRIVER ? 0 : GRAPH_TIME_MAX),
mPortCount(0),
mMonitor("MediaTrackGraphImpl"),
mLifecycleState(LIFECYCLE_THREAD_NOT_STARTED),
mPostedRunInStableStateEvent(false),
mGraphDriverRunning(false),
mPostedRunInStableState(false),
mRealtime(aDriverRequested != OFFLINE_THREAD_DRIVER),
mTrackOrderDirty(false),
mMainThread(aMainThread),
mSelfRef(this),
mGlobalVolume(CubebUtils::GetVolumeScale())
#ifdef DEBUG
,
Expand All @@ -3409,33 +3415,20 @@ MediaTrackGraphImpl::MediaTrackGraphImpl(uint64_t aWindowID,
mMainThreadGraphTime(0, "MediaTrackGraphImpl::mMainThreadGraphTime"),
mAudioOutputLatency(0.0),
mMaxOutputChannelCount(std::min(8u, CubebUtils::MaxNumberOfChannels())) {
}

void MediaTrackGraphImpl::Init(GraphDriverType aDriverRequested,
GraphRunType aRunTypeRequested,
uint32_t aChannelCount) {
mSelfRef = this;
mEndTime = aDriverRequested == OFFLINE_THREAD_DRIVER ? 0 : GRAPH_TIME_MAX;
mRealtime = aDriverRequested != OFFLINE_THREAD_DRIVER;
// The primary output device always exists because an AudioCallbackDriver
// may exist, and want to be fed data, even when no tracks have audio
// outputs.
mOutputDeviceRefCnts.EmplaceBack(
DeviceReceiverAndCount{mPrimaryOutputDeviceID, nullptr, 0});
mOutputDevices.EmplaceBack(OutputDeviceEntry{mPrimaryOutputDeviceID});
DeviceReceiverAndCount{aPrimaryOutputDeviceID, nullptr, 0});
mOutputDevices.EmplaceBack(OutputDeviceEntry{aPrimaryOutputDeviceID});

bool failedToGetShutdownBlocker = false;
if (!IsNonRealtime()) {
failedToGetShutdownBlocker = !AddShutdownBlocker();
}

mGraphRunner = aRunTypeRequested == SINGLE_THREAD
? GraphRunner::Create(this)
: already_AddRefed<GraphRunner>(nullptr);

if ((aRunTypeRequested == SINGLE_THREAD && !mGraphRunner) ||
failedToGetShutdownBlocker) {
MonitorAutoLock lock(mMonitor);
// At least one of the following happened
// - Failed to create thread.
// - Failed to install a shutdown blocker when one is needed.
Expand All @@ -3457,7 +3450,7 @@ void MediaTrackGraphImpl::Init(GraphDriverType aDriverRequested,
} else {
mDriver = new SystemClockDriver(this, nullptr, mSampleRate);
}
nsCString streamName = GetDocumentTitle(mWindowID);
nsCString streamName = GetDocumentTitle(aWindowID);
LOG(LogLevel::Debug, ("%p: document title: %s", this, streamName.get()));
mDriver->SetStreamName(streamName);
} else {
Expand Down Expand Up @@ -3543,8 +3536,8 @@ MediaTrackGraphImpl* MediaTrackGraphImpl::GetInstance(
uint32_t channelCount =
std::min<uint32_t>(8, CubebUtils::MaxNumberOfChannels());
MediaTrackGraphImpl* graph = new MediaTrackGraphImpl(
aWindowID, aSampleRate, aPrimaryOutputDeviceID, aMainThread);
graph->Init(aGraphDriverRequested, runType, channelCount);
aGraphDriverRequested, runType, aWindowID, aSampleRate, channelCount,
aPrimaryOutputDeviceID, aMainThread);
MOZ_ALWAYS_TRUE(graphs->add(addPtr, graph));

LOG(LogLevel::Debug, ("Starting up MediaTrackGraph %p for window 0x%" PRIx64,
Expand All @@ -3567,27 +3560,22 @@ MediaTrackGraph* MediaTrackGraph::GetInstance(
aPrimaryOutputDeviceID, GetMainThreadSerialEventTarget());
}

MediaTrackGraph* MediaTrackGraphImpl::CreateNonRealtimeInstance(
MediaTrackGraph* MediaTrackGraph::CreateNonRealtimeInstance(
TrackRate aSampleRate) {
MOZ_ASSERT(NS_IsMainThread(), "Main thread only");

nsISerialEventTarget* mainThread = GetMainThreadSerialEventTarget();
// Offline graphs have 0 output channel count: they write the output to a
// buffer, not an audio output track.
MediaTrackGraphImpl* graph = new MediaTrackGraphImpl(
0, aSampleRate, DEFAULT_OUTPUT_DEVICE, mainThread);
graph->Init(OFFLINE_THREAD_DRIVER, DIRECT_DRIVER, 0);
OFFLINE_THREAD_DRIVER, DIRECT_DRIVER, 0, aSampleRate, 0,
DEFAULT_OUTPUT_DEVICE, mainThread);

LOG(LogLevel::Debug, ("Starting up Offline MediaTrackGraph %p", graph));

return graph;
}

MediaTrackGraph* MediaTrackGraph::CreateNonRealtimeInstance(
TrackRate aSampleRate) {
return MediaTrackGraphImpl::CreateNonRealtimeInstance(aSampleRate);
}

void MediaTrackGraph::ForceShutDown() {
MOZ_ASSERT(NS_IsMainThread(), "Main thread only");

Expand Down
Loading

0 comments on commit b78f8ab

Please sign in to comment.