Skip to content

Commit

Permalink
Bug 1519636 - Reformat recent changes to the Google coding style r=em…
Browse files Browse the repository at this point in the history
…ilio,media-playback-reviewers,padenot

clang-format version 17.0.6 (taskcluster-QueHFUviQeyM8Y7r_d7MQQ)

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D195397
  • Loading branch information
sylvestre committed Dec 4, 2023
1 parent d7c483c commit b591dd1
Show file tree
Hide file tree
Showing 74 changed files with 727 additions and 516 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ int main(int argc, char** argv) {
hr = ieHist->AddUrl(L"http://www.mozilla.org/1", L"Mozilla HTTP Test", 0);
if (FAILED(hr)) return -3;

hr = ieHist->AddUrl(L"https://www.mozilla.org/2", L"Mozilla HTTPS Test 🦊", 0);
hr =
ieHist->AddUrl(L"https://www.mozilla.org/2", L"Mozilla HTTPS Test 🦊", 0);
if (FAILED(hr)) return -4;

CoUninitialize();
Expand Down
2 changes: 1 addition & 1 deletion config/nsinstall.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

#ifdef NEED_S_ISLNK
# if !defined(S_ISLNK) && defined(S_IFLNK)
# define S_ISLNK(a) (((a)&S_IFMT) == S_IFLNK)
# define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK)
# endif
#endif

Expand Down
3 changes: 1 addition & 2 deletions dom/canvas/WebGLContextState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,7 @@ Maybe<double> WebGLContext::GetParameter(const GLenum pname) {
default:
return fb->ColorAttachment0();
}
}
();
}();

const auto imageInfo = attachment.GetImageInfo();
if (!imageInfo) return nullptr;
Expand Down
26 changes: 13 additions & 13 deletions dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,25 +115,25 @@ FFmpegLibWrapper::LinkResult FFmpegLibWrapper::Link() {
: LinkResult::UnknownFutureLibAVVersion;
}

#define AV_FUNC_OPTION_SILENT(func, ver) \
if ((ver)&version) { \
if (!((func) = (decltype(func))PR_FindSymbol( \
((ver)&AV_FUNC_AVUTIL_MASK) ? mAVUtilLib : mAVCodecLib, \
#func))) { \
} \
} else { \
(func) = (decltype(func))nullptr; \
#define AV_FUNC_OPTION_SILENT(func, ver) \
if ((ver) & version) { \
if (!((func) = (decltype(func))PR_FindSymbol( \
((ver) & AV_FUNC_AVUTIL_MASK) ? mAVUtilLib : mAVCodecLib, \
#func))) { \
} \
} else { \
(func) = (decltype(func))nullptr; \
}

#define AV_FUNC_OPTION(func, ver) \
AV_FUNC_OPTION_SILENT(func, ver) \
if ((ver)&version && (func) == (decltype(func))nullptr) { \
FFMPEGP_LOG("Couldn't load function " #func); \
#define AV_FUNC_OPTION(func, ver) \
AV_FUNC_OPTION_SILENT(func, ver) \
if ((ver) & version && (func) == (decltype(func))nullptr) { \
FFMPEGP_LOG("Couldn't load function " #func); \
}

#define AV_FUNC(func, ver) \
AV_FUNC_OPTION(func, ver) \
if ((ver)&version && !(func)) { \
if ((ver) & version && !(func)) { \
Unlink(); \
return isFFMpeg ? LinkResult::MissingFFMpegFunction \
: LinkResult::MissingLibAVFunction; \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
// 'StatusBarOrientationDidChange'.
// This notification must be posted in order for the capturer to reflect the
// orientation change in video w.r.t. the application orientation.
@interface RTCVideoCaptureIosObjC : NSObject <AVCaptureVideoDataOutputSampleBufferDelegate>
@interface RTCVideoCaptureIosObjC
: NSObject <AVCaptureVideoDataOutputSampleBufferDelegate>

@property webrtc::VideoRotation frameRotation;

Expand All @@ -32,7 +33,8 @@
// default init methods have been overridden to return nil.
- (id)initWithOwner:(webrtc::videocapturemodule::VideoCaptureIos*)owner;
- (BOOL)setCaptureDeviceByUniqueId:(NSString*)uniqueId;
- (BOOL)startCaptureWithCapability:(const webrtc::VideoCaptureCapability&)capability;
- (BOOL)startCaptureWithCapability:
(const webrtc::VideoCaptureCapability&)capability;
- (BOOL)stopCapture;

@end
Expand Down
3 changes: 2 additions & 1 deletion dom/media/systemservices/objc_video_capture/video_capture.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class VideoCaptureIos : public VideoCaptureImpl {
VideoCaptureIos();
virtual ~VideoCaptureIos();

static rtc::scoped_refptr<VideoCaptureModule> Create(const char* device_unique_id_utf8);
static rtc::scoped_refptr<VideoCaptureModule> Create(
const char* device_unique_id_utf8);

// Implementation of VideoCaptureImpl.
int32_t StartCapture(const VideoCaptureCapability& capability) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,35 @@ namespace webrtc::videocapturemodule {

/**
* VideoCaptureImpl implementation of the libwebrtc ios/mac sdk camera backend.
* Single threaded except for OnFrame() that happens on a platform callback thread.
* Single threaded except for OnFrame() that happens on a platform callback
* thread.
*/
class VideoCaptureAvFoundation : public VideoCaptureImpl {
public:
VideoCaptureAvFoundation(AVCaptureDevice* _Nonnull aDevice);
virtual ~VideoCaptureAvFoundation();

static rtc::scoped_refptr<VideoCaptureModule> Create(const char* _Nullable aDeviceUniqueIdUTF8);
static rtc::scoped_refptr<VideoCaptureModule> Create(
const char* _Nullable aDeviceUniqueIdUTF8);

// Implementation of VideoCaptureImpl. Single threaded.

// Starts capturing synchronously. Idempotent. If an existing capture is live and another
// capability is requested we'll restart the underlying backend with the new capability.
int32_t StartCapture(const VideoCaptureCapability& aCapability) MOZ_EXCLUDES(api_lock_) override;
// Starts capturing synchronously. Idempotent. If an existing capture is live
// and another capability is requested we'll restart the underlying backend
// with the new capability.
int32_t StartCapture(const VideoCaptureCapability& aCapability)
MOZ_EXCLUDES(api_lock_) override;
// Stops capturing synchronously. Idempotent.
int32_t StopCapture() MOZ_EXCLUDES(api_lock_) override;
bool CaptureStarted() MOZ_EXCLUDES(api_lock_) override;
int32_t CaptureSettings(VideoCaptureCapability& aSettings) override;

// Callback. This can be called on any thread.
int32_t OnFrame(__strong RTCVideoFrame* _Nonnull aFrame) MOZ_EXCLUDES(api_lock_);
int32_t OnFrame(__strong RTCVideoFrame* _Nonnull aFrame)
MOZ_EXCLUDES(api_lock_);

void SetTrackingId(uint32_t aTrackingIdProcId) MOZ_EXCLUDES(api_lock_) override;
void SetTrackingId(uint32_t aTrackingIdProcId)
MOZ_EXCLUDES(api_lock_) override;

// Registers the current thread with the profiler if not already registered.
void MaybeRegisterCallbackThread();
Expand All @@ -54,26 +60,32 @@ class VideoCaptureAvFoundation : public VideoCaptureImpl {
AVCaptureDevice* _Nonnull const mDevice RTC_GUARDED_BY(mChecker);
VideoCaptureAdapter* _Nonnull const mAdapter RTC_GUARDED_BY(mChecker);
RTCCameraVideoCapturer* _Nonnull const mCapturer RTC_GUARDED_BY(mChecker);
// If capture has started, this is the capability it was started for. Written on the mChecker
// thread only.
// If capture has started, this is the capability it was started for. Written
// on the mChecker thread only.
mozilla::Maybe<VideoCaptureCapability> mCapability MOZ_GUARDED_BY(api_lock_);
// The image type that mCapability maps to. Set in lockstep with mCapability.
mozilla::Maybe<mozilla::CaptureStage::ImageType> mImageType MOZ_GUARDED_BY(api_lock_);
// Id string uniquely identifying this capture source. Written on the mChecker thread only.
mozilla::Maybe<mozilla::CaptureStage::ImageType> mImageType
MOZ_GUARDED_BY(api_lock_);
// Id string uniquely identifying this capture source. Written on the mChecker
// thread only.
mozilla::Maybe<mozilla::TrackingId> mTrackingId MOZ_GUARDED_BY(api_lock_);
// Adds frame specific markers to the profiler while mTrackingId is set. Callback thread only.
// Adds frame specific markers to the profiler while mTrackingId is set.
// Callback thread only.
mozilla::PerformanceRecorderMulti<mozilla::CaptureStage> mCaptureRecorder;
mozilla::PerformanceRecorderMulti<mozilla::CopyVideoStage> mConversionRecorder;
mozilla::PerformanceRecorderMulti<mozilla::CopyVideoStage>
mConversionRecorder;
std::atomic<ProfilerThreadId> mCallbackThreadId;
};

} // namespace webrtc::videocapturemodule

@interface VideoCaptureAdapter : NSObject <RTCVideoCapturerDelegate> {
webrtc::Mutex _mutex;
webrtc::videocapturemodule::VideoCaptureAvFoundation* _Nullable _capturer RTC_GUARDED_BY(_mutex);
webrtc::videocapturemodule::VideoCaptureAvFoundation* _Nullable _capturer
RTC_GUARDED_BY(_mutex);
}
- (void)setCapturer:(webrtc::videocapturemodule::VideoCaptureAvFoundation* _Nullable)capturer;
- (void)setCapturer:
(webrtc::videocapturemodule::VideoCaptureAvFoundation* _Nullable)capturer;
@end

#endif
23 changes: 12 additions & 11 deletions extensions/auth/nsAuthGSSAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,23 @@ static struct GSSFunction {
static bool gssNativeImp = true;
static PRLibrary* gssLibrary = nullptr;

#define gss_display_status_ptr ((gss_display_status_type)*gssFuncs[0].func)
#define gss_init_sec_context_ptr ((gss_init_sec_context_type)*gssFuncs[1].func)
#define gss_indicate_mechs_ptr ((gss_indicate_mechs_type)*gssFuncs[2].func)
#define gss_release_oid_set_ptr ((gss_release_oid_set_type)*gssFuncs[3].func)
#define gss_display_status_ptr ((gss_display_status_type) * gssFuncs[0].func)
#define gss_init_sec_context_ptr \
((gss_init_sec_context_type) * gssFuncs[1].func)
#define gss_indicate_mechs_ptr ((gss_indicate_mechs_type) * gssFuncs[2].func)
#define gss_release_oid_set_ptr ((gss_release_oid_set_type) * gssFuncs[3].func)
#define gss_delete_sec_context_ptr \
((gss_delete_sec_context_type)*gssFuncs[4].func)
#define gss_import_name_ptr ((gss_import_name_type)*gssFuncs[5].func)
#define gss_release_buffer_ptr ((gss_release_buffer_type)*gssFuncs[6].func)
#define gss_release_name_ptr ((gss_release_name_type)*gssFuncs[7].func)
#define gss_wrap_ptr ((gss_wrap_type)*gssFuncs[8].func)
#define gss_unwrap_ptr ((gss_unwrap_type)*gssFuncs[9].func)
((gss_delete_sec_context_type) * gssFuncs[4].func)
#define gss_import_name_ptr ((gss_import_name_type) * gssFuncs[5].func)
#define gss_release_buffer_ptr ((gss_release_buffer_type) * gssFuncs[6].func)
#define gss_release_name_ptr ((gss_release_name_type) * gssFuncs[7].func)
#define gss_wrap_ptr ((gss_wrap_type) * gssFuncs[8].func)
#define gss_unwrap_ptr ((gss_unwrap_type) * gssFuncs[9].func)

#ifdef XP_MACOSX
static PRFuncPtr KLCacheHasValidTicketsPtr;
# define KLCacheHasValidTickets_ptr \
((KLCacheHasValidTickets_type)*KLCacheHasValidTicketsPtr)
((KLCacheHasValidTickets_type) * KLCacheHasValidTicketsPtr)
#endif

static nsresult gssInit() {
Expand Down
2 changes: 1 addition & 1 deletion gfx/2d/MMIHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#define __MMI_HELPERS_H__

#define __mm_packxxxx(_f, _D, _d, _s, _t) \
# _f " %[" #_t "], %[" #_d "h], %[" #_s "h] \n\t" #_f " %[" #_D "l], %[" #_d \
#_f " %[" #_t "], %[" #_d "h], %[" #_s "h] \n\t" #_f " %[" #_D "l], %[" #_d \
"l], %[" #_s \
"l] \n\t" \
"punpckhwd %[" #_D "h], %[" #_D "l], %[" #_t \
Expand Down
2 changes: 1 addition & 1 deletion gfx/2d/ssse3-scaler.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ typedef pixman_fixed_16_16_t pixman_fixed_t;
#define pixman_fixed_1 (pixman_int_to_fixed(1))
#define pixman_fixed_to_int(f) ((int)((f) >> 16))
#define pixman_int_to_fixed(i) ((pixman_fixed_t)((i) << 16))
#define pixman_double_to_fixed(d) ((pixman_fixed_t)((d)*65536.0))
#define pixman_double_to_fixed(d) ((pixman_fixed_t)((d) * 65536.0))
#define PIXMAN_FIXED_INT_MAX 32767
#define PIXMAN_FIXED_INT_MIN -32768
typedef struct pixman_vector pixman_vector_t;
Expand Down
7 changes: 6 additions & 1 deletion gfx/gl/GLContextProviderWGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ bool WGLLibrary::EnsureInitialized() {
}
}

#define SYMBOL(X) {(PRFuncPtr*)&mSymbols.f##X, {{"wgl" #X}}}
#define SYMBOL(X) \
{ \
(PRFuncPtr*)&mSymbols.f##X, { \
{ "wgl" #X } \
} \
}
#define END_OF_SYMBOLS \
{ \
nullptr, {} \
Expand Down
63 changes: 37 additions & 26 deletions gfx/layers/NativeLayerCA.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ class NativeLayerRootCA : public NativeLayerRoot {
enum class WhichRepresentation : uint8_t { ONSCREEN, OFFSCREEN };

// Overridden methods
already_AddRefed<NativeLayer> CreateLayer(const gfx::IntSize& aSize, bool aIsOpaque,
SurfacePoolHandle* aSurfacePoolHandle) override;
already_AddRefed<NativeLayer> CreateLayer(
const gfx::IntSize& aSize, bool aIsOpaque,
SurfacePoolHandle* aSurfacePoolHandle) override;
void AppendLayer(NativeLayer* aLayer) override;
void RemoveLayer(NativeLayer* aLayer) override;
void SetLayers(const nsTArray<RefPtr<NativeLayer>>& aLayers) override;
Expand All @@ -131,8 +132,10 @@ class NativeLayerRootCA : public NativeLayerRoot {
void SetBackingScale(float aBackingScale);
float BackingScale();

already_AddRefed<NativeLayer> CreateLayerForExternalTexture(bool aIsOpaque) override;
already_AddRefed<NativeLayer> CreateLayerForColor(gfx::DeviceColor aColor) override;
already_AddRefed<NativeLayer> CreateLayerForExternalTexture(
bool aIsOpaque) override;
already_AddRefed<NativeLayer> CreateLayerForColor(
gfx::DeviceColor aColor) override;

void SetWindowIsFullscreen(bool aFullscreen);

Expand All @@ -146,7 +149,8 @@ class NativeLayerRootCA : public NativeLayerRoot {
explicit Representation(CALayer* aRootCALayer);
~Representation();
void Commit(WhichRepresentation aRepresentation,
const nsTArray<RefPtr<NativeLayerCA>>& aSublayers, bool aWindowIsFullscreen);
const nsTArray<RefPtr<NativeLayerCA>>& aSublayers,
bool aWindowIsFullscreen);
CALayer* mRootCALayer = nullptr; // strong
bool mMutatedLayerStructure = false;
};
Expand Down Expand Up @@ -187,21 +191,23 @@ class RenderSourceNLRS;

class NativeLayerRootSnapshotterCA final : public NativeLayerRootSnapshotter {
public:
static UniquePtr<NativeLayerRootSnapshotterCA> Create(NativeLayerRootCA* aLayerRoot,
CALayer* aRootCALayer);
static UniquePtr<NativeLayerRootSnapshotterCA> Create(
NativeLayerRootCA* aLayerRoot, CALayer* aRootCALayer);
virtual ~NativeLayerRootSnapshotterCA();

bool ReadbackPixels(const gfx::IntSize& aReadbackSize, gfx::SurfaceFormat aReadbackFormat,
bool ReadbackPixels(const gfx::IntSize& aReadbackSize,
gfx::SurfaceFormat aReadbackFormat,
const Range<uint8_t>& aReadbackBuffer) override;
already_AddRefed<profiler_screenshots::RenderSource> GetWindowContents(
const gfx::IntSize& aWindowSize) override;
already_AddRefed<profiler_screenshots::DownscaleTarget> CreateDownscaleTarget(
const gfx::IntSize& aSize) override;
already_AddRefed<profiler_screenshots::AsyncReadbackBuffer> CreateAsyncReadbackBuffer(
const gfx::IntSize& aSize) override;
already_AddRefed<profiler_screenshots::AsyncReadbackBuffer>
CreateAsyncReadbackBuffer(const gfx::IntSize& aSize) override;

protected:
NativeLayerRootSnapshotterCA(NativeLayerRootCA* aLayerRoot, RefPtr<gl::GLContext>&& aGL,
NativeLayerRootSnapshotterCA(NativeLayerRootCA* aLayerRoot,
RefPtr<gl::GLContext>&& aGL,
CALayer* aRootCALayer);
void UpdateSnapshot(const gfx::IntSize& aSize);

Expand Down Expand Up @@ -236,9 +242,9 @@ class NativeLayerCA : public NativeLayer {
gfx::Matrix4x4 GetTransform() override;
gfx::IntRect GetRect() override;
void SetSamplingFilter(gfx::SamplingFilter aSamplingFilter) override;
RefPtr<gfx::DrawTarget> NextSurfaceAsDrawTarget(const gfx::IntRect& aDisplayRect,
const gfx::IntRegion& aUpdateRegion,
gfx::BackendType aBackendType) override;
RefPtr<gfx::DrawTarget> NextSurfaceAsDrawTarget(
const gfx::IntRect& aDisplayRect, const gfx::IntRegion& aUpdateRegion,
gfx::BackendType aBackendType) override;
Maybe<GLuint> NextSurfaceAsFramebuffer(const gfx::IntRect& aDisplayRect,
const gfx::IntRegion& aUpdateRegion,
bool aNeedsDepth) override;
Expand All @@ -260,7 +266,8 @@ class NativeLayerCA : public NativeLayer {
protected:
friend class NativeLayerRootCA;

NativeLayerCA(const gfx::IntSize& aSize, bool aIsOpaque, SurfacePoolHandleCA* aSurfacePoolHandle);
NativeLayerCA(const gfx::IntSize& aSize, bool aIsOpaque,
SurfacePoolHandleCA* aSurfacePoolHandle);
explicit NativeLayerCA(bool aIsOpaque);
explicit NativeLayerCA(gfx::DeviceColor aColor);
~NativeLayerCA() override;
Expand Down Expand Up @@ -303,7 +310,8 @@ class NativeLayerCA : public NativeLayer {
// aCopyFn: Fn(CFTypeRefPtr<IOSurfaceRef> aValidSourceIOSurface,
// const gfx::IntRegion& aCopyRegion) -> void
template <typename F>
void HandlePartialUpdate(const MutexAutoLock& aProofOfLock, const gfx::IntRect& aDisplayRect,
void HandlePartialUpdate(const MutexAutoLock& aProofOfLock,
const gfx::IntRect& aDisplayRect,
const gfx::IntRegion& aUpdateRegion, F&& aCopyFn);

struct SurfaceWithInvalidRegion {
Expand All @@ -316,7 +324,8 @@ class NativeLayerCA : public NativeLayer {
uint32_t mCheckCount; // The number of calls to IOSurfaceIsInUse
};

Maybe<SurfaceWithInvalidRegion> GetUnusedSurfaceAndCleanUp(const MutexAutoLock& aProofOfLock);
Maybe<SurfaceWithInvalidRegion> GetUnusedSurfaceAndCleanUp(
const MutexAutoLock& aProofOfLock);

bool IsVideo();
bool IsVideoAndLocked(const MutexAutoLock& aProofOfLock);
Expand All @@ -328,8 +337,9 @@ class NativeLayerCA : public NativeLayer {
// If set, the CGRect has the scaled position of the clip relative to the
// surface origin and the scaled size of the clip rect.
static Maybe<CGRect> CalculateClipGeometry(
const gfx::IntSize& aSize, const gfx::IntPoint& aPosition, const gfx::Matrix4x4& aTransform,
const gfx::IntRect& aDisplayRect, const Maybe<gfx::IntRect>& aClipRect, float aBackingScale);
const gfx::IntSize& aSize, const gfx::IntPoint& aPosition,
const gfx::Matrix4x4& aTransform, const gfx::IntRect& aDisplayRect,
const Maybe<gfx::IntRect>& aClipRect, float aBackingScale);

// Wraps one CALayer representation of this NativeLayer.
struct Representation {
Expand All @@ -349,13 +359,14 @@ class NativeLayerCA : public NativeLayer {
// a partial update, the return value will indicate if all the needed
// changes were able to be applied under these restrictions. A false return
// value indicates an All update is necessary.
bool ApplyChanges(UpdateType aUpdate, const gfx::IntSize& aSize, bool aIsOpaque,
const gfx::IntPoint& aPosition, const gfx::Matrix4x4& aTransform,
const gfx::IntRect& aDisplayRect, const Maybe<gfx::IntRect>& aClipRect,
float aBackingScale, bool aSurfaceIsFlipped,
gfx::SamplingFilter aSamplingFilter, bool aSpecializeVideo,
CFTypeRefPtr<IOSurfaceRef> aFrontSurface, CFTypeRefPtr<CGColorRef> aColor,
bool aIsDRM, bool aIsVideo);
bool ApplyChanges(
UpdateType aUpdate, const gfx::IntSize& aSize, bool aIsOpaque,
const gfx::IntPoint& aPosition, const gfx::Matrix4x4& aTransform,
const gfx::IntRect& aDisplayRect, const Maybe<gfx::IntRect>& aClipRect,
float aBackingScale, bool aSurfaceIsFlipped,
gfx::SamplingFilter aSamplingFilter, bool aSpecializeVideo,
CFTypeRefPtr<IOSurfaceRef> aFrontSurface,
CFTypeRefPtr<CGColorRef> aColor, bool aIsDRM, bool aIsVideo);

// Return whether any aspects of this layer representation have been mutated
// since the last call to ApplyChanges, i.e. whether ApplyChanges needs to
Expand Down
Loading

0 comments on commit b591dd1

Please sign in to comment.