Skip to content

Commit

Permalink
Bug 1519636 - Reformat with clang-format-11 to the Google coding styl…
Browse files Browse the repository at this point in the history
…e r=andi,sg,geckoview-reviewers,snorp

It is bringing some minor changes

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D90795
  • Loading branch information
sylvestre committed Nov 18, 2020
1 parent b7fbaf3 commit f624bed
Show file tree
Hide file tree
Showing 88 changed files with 486 additions and 530 deletions.
23 changes: 10 additions & 13 deletions devtools/shared/heapsnapshot/HeapSnapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,19 +177,16 @@ const CharT* HeapSnapshot::getOrInternString(
}

// Get a de-duplicated string as a Maybe<StringOrRef> from the given `msg`.
#define GET_STRING_OR_REF_WITH_PROP_NAMES(msg, strPropertyName, \
refPropertyName) \
(msg.has_##refPropertyName() \
? Some(StringOrRef(msg.refPropertyName())) \
: msg.has_##strPropertyName() \
? Some(StringOrRef(&msg.strPropertyName())) \
: Nothing())

#define GET_STRING_OR_REF(msg, property) \
(msg.has_##property##ref() \
? Some(StringOrRef(msg.property##ref())) \
: msg.has_##property() ? Some(StringOrRef(&msg.property())) \
: Nothing())
#define GET_STRING_OR_REF_WITH_PROP_NAMES(msg, strPropertyName, \
refPropertyName) \
(msg.has_##refPropertyName() ? Some(StringOrRef(msg.refPropertyName())) \
: msg.has_##strPropertyName() ? Some(StringOrRef(&msg.strPropertyName())) \
: Nothing())

#define GET_STRING_OR_REF(msg, property) \
(msg.has_##property##ref() ? Some(StringOrRef(msg.property##ref())) \
: msg.has_##property() ? Some(StringOrRef(&msg.property())) \
: Nothing())

bool HeapSnapshot::saveNode(const protobuf::Node& node,
NodeIdSet& edgeReferents) {
Expand Down
6 changes: 3 additions & 3 deletions dom/base/Document.h
Original file line number Diff line number Diff line change
Expand Up @@ -2785,9 +2785,9 @@ class Document : public nsINode,
* use non-builtin XBL bindings.
*/
bool AllowXULXBL() {
return mAllowXULXBL == eTriTrue
? true
: mAllowXULXBL == eTriFalse ? false : InternalAllowXULXBL();
return mAllowXULXBL == eTriTrue ? true
: mAllowXULXBL == eTriFalse ? false
: InternalAllowXULXBL();
}

/**
Expand Down
3 changes: 2 additions & 1 deletion dom/base/TimeoutManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,8 @@ bool TimeoutManager::ClearTimeoutInternal(int32_t aTimerId,
("%s(TimeoutManager=%p, timeout=%p, ID=%u)\n",
timeout->mReason == Timeout::Reason::eIdleCallbackTimeout
? "CancelIdleCallback"
: timeout->mIsInterval ? "ClearInterval" : "ClearTimeout",
: timeout->mIsInterval ? "ClearInterval"
: "ClearTimeout",
this, timeout, timeout->mTimeoutId));

if (timeout->mRunning) {
Expand Down
3 changes: 2 additions & 1 deletion dom/base/nsContentUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7967,7 +7967,8 @@ nsresult nsContentUtils::SendMouseEvent(
event.mButton = aButton;
event.mButtons = aButtons != nsIDOMWindowUtils::MOUSE_BUTTONS_NOT_SPECIFIED
? aButtons
: msg == eMouseUp ? 0 : GetButtonsFlagForButton(aButton);
: msg == eMouseUp ? 0
: GetButtonsFlagForButton(aButton);
event.mPressure = aPressure;
event.mInputSource = aInputSourceArg;
event.mClickCount = aClickCount;
Expand Down
9 changes: 4 additions & 5 deletions dom/canvas/WebGLTexelConversions.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,10 @@ struct DataTypeForFormat<WebGLTexelFormat::RGB11F11F10F, true, false, false> {

template <WebGLTexelFormat Format>
struct IntermediateFormat {
static const WebGLTexelFormat Value = IsFloatFormat<Format>::Value
? WebGLTexelFormat::RGBA32F
: IsHalfFloatFormat<Format>::Value
? WebGLTexelFormat::RGBA16F
: WebGLTexelFormat::RGBA8;
static const WebGLTexelFormat Value =
IsFloatFormat<Format>::Value ? WebGLTexelFormat::RGBA32F
: IsHalfFloatFormat<Format>::Value ? WebGLTexelFormat::RGBA16F
: WebGLTexelFormat::RGBA8;
};

inline size_t TexelBytesForFormat(WebGLTexelFormat format) {
Expand Down
8 changes: 4 additions & 4 deletions dom/events/EventDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -894,10 +894,10 @@ nsresult EventDispatcher::Dispatch(nsISupports* aTarget,

// Create visitor object and start event dispatching.
// GetEventTargetParent for the original target.
nsEventStatus status =
aDOMEvent && aDOMEvent->DefaultPrevented()
? nsEventStatus_eConsumeNoDefault
: aEventStatus ? *aEventStatus : nsEventStatus_eIgnore;
nsEventStatus status = aDOMEvent && aDOMEvent->DefaultPrevented()
? nsEventStatus_eConsumeNoDefault
: aEventStatus ? *aEventStatus
: nsEventStatus_eIgnore;
nsCOMPtr<EventTarget> targetForPreVisitor = aEvent->mTarget;
EventChainPreVisitor preVisitor(aPresContext, aEvent, aDOMEvent, status,
isInAnon, targetForPreVisitor);
Expand Down
7 changes: 3 additions & 4 deletions dom/html/HTMLMediaElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7252,10 +7252,9 @@ void HTMLMediaElement::SetDecoder(MediaDecoder* aDecoder) {
}

float HTMLMediaElement::ComputedVolume() const {
return mMuted
? 0.0f
: mAudioChannelWrapper ? mAudioChannelWrapper->GetEffectiveVolume()
: mVolume;
return mMuted ? 0.0f
: mAudioChannelWrapper ? mAudioChannelWrapper->GetEffectiveVolume()
: mVolume;
}

bool HTMLMediaElement::ComputedMuted() const {
Expand Down
6 changes: 3 additions & 3 deletions dom/indexedDB/ActorsParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4538,9 +4538,9 @@ class IndexCursorBase : public CursorBase {

const nsCString& GetContinueQuery(const bool hasContinueKey,
const bool hasContinuePrimaryKey) const {
return hasContinuePrimaryKey
? mContinuePrimaryKeyQuery
: hasContinueKey ? mContinueToQuery : mContinueQuery;
return hasContinuePrimaryKey ? mContinuePrimaryKeyQuery
: hasContinueKey ? mContinueToQuery
: mContinueQuery;
}
};
};
Expand Down
4 changes: 2 additions & 2 deletions dom/indexedDB/SafeRefPtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,10 @@ class MOZ_IS_REFPTR MOZ_TRIVIAL_ABI SafeRefPtr {
};

template <typename T>
SafeRefPtr(RefPtr<T> &&) -> SafeRefPtr<T>;
SafeRefPtr(RefPtr<T>&&) -> SafeRefPtr<T>;

template <typename T>
SafeRefPtr(already_AddRefed<T> &&) -> SafeRefPtr<T>;
SafeRefPtr(already_AddRefed<T>&&) -> SafeRefPtr<T>;

template <typename T>
SafeRefPtr<T>::SafeRefPtr(T* aRawPtr, detail::InitialConstructionTag)
Expand Down
3 changes: 1 addition & 2 deletions dom/ipc/jsactor/JSProcessActorProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ bool JSProcessActorProtocol::Matches(const nsACString& aRemoteType,
ErrorResult& aRv) {
if (!mIncludeParent && aRemoteType.IsEmpty()) {
aRv.ThrowNotSupportedError(nsPrintfCString(
"Process protocol '%s' doesn't match the parent process",
mName.get()));
"Process protocol '%s' doesn't match the parent process", mName.get()));
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions dom/media/AudioStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,9 @@ AudioStream::Start() {
mState = ERRORED;
}

LOG("started, state %s", mState == STARTED
? "STARTED"
: mState == DRAINED ? "DRAINED" : "ERRORED");
LOG("started, state %s", mState == STARTED ? "STARTED"
: mState == DRAINED ? "DRAINED"
: "ERRORED");
if (mState == STARTED || mState == DRAINED) {
return promise.forget();
}
Expand Down
10 changes: 4 additions & 6 deletions dom/media/MediaCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1513,12 +1513,10 @@ void MediaCache::Update() {
}
LOG("Stream %p, mCacheSuspended=%d, enableReading=%d, action=%s", stream,
stream->mCacheSuspended, enableReading,
actions[i].mTag == StreamAction::SEEK
? "SEEK"
: actions[i].mTag == StreamAction::RESUME
? "RESUME"
: actions[i].mTag == StreamAction::SUSPEND ? "SUSPEND"
: "NONE");
actions[i].mTag == StreamAction::SEEK ? "SEEK"
: actions[i].mTag == StreamAction::RESUME ? "RESUME"
: actions[i].mTag == StreamAction::SUSPEND ? "SUSPEND"
: "NONE");
}
#ifdef DEBUG
mInUpdate = false;
Expand Down
20 changes: 9 additions & 11 deletions dom/media/MediaFormatReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1618,10 +1618,9 @@ void MediaFormatReader::NotifyNewOutput(
break;
case MediaData::Type::RAW_DATA:
DDLOGPR(DDLogCategory::Log,
aTrack == TrackInfo::kAudioTrack
? "decoded_audio"
: aTrack == TrackInfo::kVideoTrack ? "decoded_video"
: "decoded_?",
aTrack == TrackInfo::kAudioTrack ? "decoded_audio"
: aTrack == TrackInfo::kVideoTrack ? "decoded_video"
: "decoded_?",
"{\"type\":\"RawData\", \"offset\":%" PRIi64
" \"time_us\":%" PRIi64 ", \"timecode_us\":%" PRIi64
", \"duration_us\":%" PRIi64 ", \"kf\":%s}",
Expand All @@ -1632,10 +1631,9 @@ void MediaFormatReader::NotifyNewOutput(
break;
case MediaData::Type::NULL_DATA:
DDLOGPR(DDLogCategory::Log,
aTrack == TrackInfo::kAudioTrack
? "decoded_audio"
: aTrack == TrackInfo::kVideoTrack ? "decoded_video"
: "decoded_?",
aTrack == TrackInfo::kAudioTrack ? "decoded_audio"
: aTrack == TrackInfo::kVideoTrack ? "decoded_video"
: "decoded_?",
"{\"type\":\"NullData\", \"offset\":%" PRIi64
" \"time_us\":%" PRIi64 ", \"timecode_us\":%" PRIi64
", \"duration_us\":%" PRIi64 ", \"kf\":%s}",
Expand Down Expand Up @@ -1845,9 +1843,9 @@ void MediaFormatReader::DecodeDemuxedSamples(TrackType aTrack,
RefPtr<MediaFormatReader> self = this;
decoder.mFlushed = false;
DDLOGPR(DDLogCategory::Log,
aTrack == TrackInfo::kAudioTrack
? "decode_audio"
: aTrack == TrackInfo::kVideoTrack ? "decode_video" : "decode_?",
aTrack == TrackInfo::kAudioTrack ? "decode_audio"
: aTrack == TrackInfo::kVideoTrack ? "decode_video"
: "decode_?",
"{\"type\":\"MediaRawData\", \"offset\":%" PRIi64
", \"bytes\":%zu, \"time_us\":%" PRIi64 ", \"timecode_us\":%" PRIi64
", \"duration_us\":%" PRIi64 ",%s%s}",
Expand Down
7 changes: 3 additions & 4 deletions dom/media/MediaManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1946,10 +1946,9 @@ RefPtr<MediaManager::MgrPromise> MediaManager::EnumerateRawDevices(
// Need to ask permission to retrieve list of all devices;
// notify frontend observer and wait for callback notification to post task.
const char16_t* const type =
(aVideoInputType != MediaSourceEnum::Camera)
? u"audio"
: (aAudioInputType != MediaSourceEnum::Microphone) ? u"video"
: u"all";
(aVideoInputType != MediaSourceEnum::Camera) ? u"audio"
: (aAudioInputType != MediaSourceEnum::Microphone) ? u"video"
: u"all";
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
obs->NotifyObservers(static_cast<nsIRunnable*>(task),
"getUserMedia:ask-device-permission", type);
Expand Down
18 changes: 9 additions & 9 deletions dom/media/mediasource/MediaSourceDemuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,15 @@ MediaSourceTrackDemuxer::MediaSourceTrackDemuxer(MediaSourceDemuxer* aParent,
VorbisDataDecoder::IsVorbis(
mParent->GetTrackInfo(mType)->mMimeType)
? 80000
: mParent->GetTrackInfo(mType)->mMimeType.EqualsLiteral(
"audio/mp4a-latm")
// AAC encoder delay is by default 2112 audio frames.
// See
// https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFAppenG/QTFFAppenG.html
// So we always seek 2112 frames
? (2112 * 1000000ULL /
mParent->GetTrackInfo(mType)->GetAsAudioInfo()->mRate)
: 0)) {}
: mParent->GetTrackInfo(mType)->mMimeType.EqualsLiteral(
"audio/mp4a-latm")
// AAC encoder delay is by default 2112 audio frames.
// See
// https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFAppenG/QTFFAppenG.html
// So we always seek 2112 frames
? (2112 * 1000000ULL /
mParent->GetTrackInfo(mType)->GetAsAudioInfo()->mRate)
: 0)) {}

UniquePtr<TrackInfo> MediaSourceTrackDemuxer::GetInfo() const {
return mParent->GetTrackInfo(mType)->Clone();
Expand Down
8 changes: 3 additions & 5 deletions dom/media/platforms/apple/AppleVTDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,9 @@ AppleVTDecoder::AppleVTDecoder(const VideoInfo& aConfig,
? DefaultColorSpace({mPictureWidth, mPictureHeight})
: aConfig.mColorSpace),
mColorRange(aConfig.mColorRange),
mStreamType(MP4Decoder::IsH264(aConfig.mMimeType)
? StreamType::H264
: VPXDecoder::IsVP9(aConfig.mMimeType)
? StreamType::VP9
: StreamType::Unknown),
mStreamType(MP4Decoder::IsH264(aConfig.mMimeType) ? StreamType::H264
: VPXDecoder::IsVP9(aConfig.mMimeType) ? StreamType::VP9
: StreamType::Unknown),
mTaskQueue(
new TaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER),
"AppleVTDecoder")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,11 @@ void VideoCaptureAndroid::OnIncomingFrame(rtc::scoped_refptr<I420Buffer> buffer,
rtc::CritScope cs(&_apiCs);

VideoRotation rotation =
(degrees <= 45 || degrees > 315)
? kVideoRotation_0
: (degrees > 45 && degrees <= 135)
? kVideoRotation_90
: (degrees > 135 && degrees <= 225)
? kVideoRotation_180
: (degrees > 225 && degrees <= 315)
? kVideoRotation_270
: kVideoRotation_0; // Impossible.
(degrees <= 45 || degrees > 315) ? kVideoRotation_0
: (degrees > 45 && degrees <= 135) ? kVideoRotation_90
: (degrees > 135 && degrees <= 225) ? kVideoRotation_180
: (degrees > 225 && degrees <= 315) ? kVideoRotation_270
: kVideoRotation_0; // Impossible.

// Historically, we have ignored captureTime. Why?
VideoFrame captureFrame(I420Buffer::Rotate(*buffer, rotation), 0,
Expand Down
8 changes: 4 additions & 4 deletions dom/media/webaudio/blink/DenormalDisabler.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,18 @@ class DenormalDisabler {
inline int getStatusWord() {
int result;
# if defined(__aarch64__)
asm volatile("mrs %x[result], FPCR" : [ result ] "=r"(result));
asm volatile("mrs %x[result], FPCR" : [result] "=r"(result));
# else
asm volatile("vmrs %[result], FPSCR" : [ result ] "=r"(result));
asm volatile("vmrs %[result], FPSCR" : [result] "=r"(result));
# endif
return result;
}

inline void setStatusWord(int a) {
# if defined(__aarch64__)
asm volatile("msr FPCR, %x[src]" : : [ src ] "r"(a));
asm volatile("msr FPCR, %x[src]" : : [src] "r"(a));
# else
asm volatile("vmsr FPSCR, %[src]" : : [ src ] "r"(a));
asm volatile("vmsr FPSCR, %[src]" : : [src] "r"(a));
# endif
}

Expand Down
8 changes: 5 additions & 3 deletions dom/quota/ActorsParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1052,13 +1052,15 @@ class OriginInfo final {
class OriginInfoLRUComparator {
public:
bool Equals(const OriginInfo* a, const OriginInfo* b) const {
return a && b ? a->LockedAccessTime() == b->LockedAccessTime()
: !a && !b ? true : false;
return a && b ? a->LockedAccessTime() == b->LockedAccessTime()
: !a && !b ? true
: false;
}

bool LessThan(const OriginInfo* a, const OriginInfo* b) const {
return a && b ? a->LockedAccessTime() < b->LockedAccessTime()
: b ? true : false;
: b ? true
: false;
}
};

Expand Down
6 changes: 3 additions & 3 deletions dom/smil/SMILTimedElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1354,9 +1354,9 @@ void SMILTimedElement::DoPostSeek() {

void SMILTimedElement::UnpreserveInstanceTimes(InstanceTimeList& aList) {
const SMILInterval* prevInterval = GetPreviousInterval();
const SMILInstanceTime* cutoff =
mCurrentInterval ? mCurrentInterval->Begin()
: prevInterval ? prevInterval->Begin() : nullptr;
const SMILInstanceTime* cutoff = mCurrentInterval ? mCurrentInterval->Begin()
: prevInterval ? prevInterval->Begin()
: nullptr;
uint32_t count = aList.Length();
for (uint32_t i = 0; i < count; ++i) {
SMILInstanceTime* instance = aList[i].get();
Expand Down
8 changes: 4 additions & 4 deletions dom/workers/WorkerPrivate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3264,10 +3264,10 @@ void WorkerPrivate::SetGCTimerMode(GCTimerMode aMode) {

data->mPeriodicGCTimerRunning = false;
data->mIdleGCTimerRunning = false;
LOG(WorkerLog(),
("Worker %p canceled GC timer because %s\n", this,
aMode == PeriodicTimer ? "periodic"
: aMode == IdleTimer ? "idle" : "none"));
LOG(WorkerLog(), ("Worker %p canceled GC timer because %s\n", this,
aMode == PeriodicTimer ? "periodic"
: aMode == IdleTimer ? "idle"
: "none"));

if (aMode == NoTimer) {
return;
Expand Down
9 changes: 4 additions & 5 deletions dom/xslt/xslt/txXSLTEnvironmentFunctionCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,10 @@ bool txXSLTEnvironmentFunctionCall::isSensitiveTo(ContextSensitivity aContext) {

#ifdef TX_TO_STRING
void txXSLTEnvironmentFunctionCall::appendName(nsAString& aDest) {
nsStaticAtom* atom = mType == SYSTEM_PROPERTY
? nsGkAtoms::systemProperty
: mType == ELEMENT_AVAILABLE
? nsGkAtoms::elementAvailable
: nsGkAtoms::functionAvailable;
nsStaticAtom* atom = mType == SYSTEM_PROPERTY ? nsGkAtoms::systemProperty
: mType == ELEMENT_AVAILABLE
? nsGkAtoms::elementAvailable
: nsGkAtoms::functionAvailable;
aDest.Append(atom->GetUTF16String());
}
#endif
Loading

0 comments on commit f624bed

Please sign in to comment.