Skip to content

Commit

Permalink
Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
Browse files Browse the repository at this point in the history
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D58175

--HG--
extra : moz-landing-system : lando
  • Loading branch information
sylvestre committed Jan 9, 2020
1 parent 4a2545c commit c521758
Show file tree
Hide file tree
Showing 52 changed files with 820 additions and 870 deletions.
2 changes: 1 addition & 1 deletion accessible/base/nsAccessibilityService.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class PresShell;
namespace dom {
class DOMStringList;
class Element;
}
} // namespace dom

namespace a11y {

Expand Down
2 changes: 1 addition & 1 deletion browser/app/nsBrowserApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ int main(int argc, char* argv[], char* envp[]) {
// argc & argv will be updated with the values passing from the
// chrome process. With the new values, this function
// continues the reset of the code acting as a content process.
if(gBootstrap->XRE_ForkServer(&argc, &argv)) {
if (gBootstrap->XRE_ForkServer(&argc, &argv)) {
// Return from the fork server in the fork server process.
// Stop the fork server.
gBootstrap->NS_LogTerm();
Expand Down
8 changes: 4 additions & 4 deletions browser/app/winlauncher/DllBlocklistInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ LauncherVoidResultWithLineInfo InitializeDllBlocklistOOP(
// safely make its ntdll calls.

HMODULE ourModule;
#if defined(_MSC_VER)
# if defined(_MSC_VER)
ourModule = reinterpret_cast<HMODULE>(&__ImageBase);
#else
# else
ourModule = ::GetModuleHandleW(nullptr);
#endif // defined(_MSC_VER)
# endif // defined(_MSC_VER)

mozilla::nt::PEHeaders ourExeImage(ourModule);
if (!ourExeImage) {
Expand All @@ -84,7 +84,7 @@ LauncherVoidResultWithLineInfo InitializeDllBlocklistOOP(
return importDirRestored;
}

Maybe<Span<IMAGE_THUNK_DATA>> ntdllThunks =
Maybe<Span<IMAGE_THUNK_DATA> > ntdllThunks =
ourExeImage.GetIATThunksForModule("ntdll.dll");
if (!ntdllThunks) {
return LAUNCHER_ERROR_FROM_WIN32(ERROR_INVALID_DATA);
Expand Down
7 changes: 6 additions & 1 deletion caps/ContentPrincipal.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ class ContentPrincipal final : public BasePrincipal {

virtual nsresult PopulateJSONObject(Json::Value& aObject) override;
// Serializable keys are the valid enum fields the serialization supports
enum SerializableKeys : uint8_t { eURI = 0, eDomain, eSuffix, eMax = eSuffix };
enum SerializableKeys : uint8_t {
eURI = 0,
eDomain,
eSuffix,
eMax = eSuffix
};
typedef mozilla::BasePrincipal::KeyValT<SerializableKeys> KeyVal;

static already_AddRefed<BasePrincipal> FromProperties(
Expand Down
1 change: 0 additions & 1 deletion docshell/shistory/ChildSHistory.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ namespace dom {

class ChildSHistory : public nsISupports, public nsWrapperCache {
public:

NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ChildSHistory)
nsISupports* GetParentObject() const;
Expand Down
4 changes: 2 additions & 2 deletions dom/base/ScreenOrientation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,9 +615,9 @@ ScreenOrientation::VisibleEventListener::HandleEvent(Event* aEvent) {

BrowsingContext* bc = doc->GetBrowsingContext();
if (bc && bc->GetCurrentOrientationType() !=
orientation->DeviceType(CallerType::System)) {
orientation->DeviceType(CallerType::System)) {
bc->SetCurrentOrientation(orientation->DeviceType(CallerType::System),
orientation->DeviceAngle(CallerType::System));
orientation->DeviceAngle(CallerType::System));

nsCOMPtr<nsIRunnable> runnable =
orientation->DispatchChangeEventAndResolvePromise();
Expand Down
20 changes: 11 additions & 9 deletions dom/bindings/BindingDeclarations.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,19 +188,19 @@ class Optional : public Optional_base<T, T> {
};

template <typename T>
class Optional<JS::Handle<T> >
: public Optional_base<JS::Handle<T>, JS::Rooted<T> > {
class Optional<JS::Handle<T>>
: public Optional_base<JS::Handle<T>, JS::Rooted<T>> {
public:
MOZ_ALLOW_TEMPORARY Optional()
: Optional_base<JS::Handle<T>, JS::Rooted<T> >() {}
: Optional_base<JS::Handle<T>, JS::Rooted<T>>() {}

explicit Optional(JSContext* cx)
: Optional_base<JS::Handle<T>, JS::Rooted<T> >() {
: Optional_base<JS::Handle<T>, JS::Rooted<T>>() {
this->Construct(cx);
}

Optional(JSContext* cx, const T& aValue)
: Optional_base<JS::Handle<T>, JS::Rooted<T> >(cx, aValue) {}
: Optional_base<JS::Handle<T>, JS::Rooted<T>>(cx, aValue) {}

// Override the const Value() to return the right thing so we're not
// returning references to temporaries.
Expand Down Expand Up @@ -249,7 +249,7 @@ class Optional<JS::Value> {
template <typename U>
class NonNull;
template <typename T>
class Optional<NonNull<T> > : public Optional_base<T, NonNull<T> > {
class Optional<NonNull<T>> : public Optional_base<T, NonNull<T>> {
public:
// We want our Value to actually return a non-const reference, even
// if we're const. At least for things that are normally pointer
Expand All @@ -264,7 +264,7 @@ class Optional<NonNull<T> > : public Optional_base<T, NonNull<T> > {
// A specialization of Optional for OwningNonNull that lets us get a
// T& from Value()
template <typename T>
class Optional<OwningNonNull<T> > : public Optional_base<T, OwningNonNull<T> > {
class Optional<OwningNonNull<T>> : public Optional_base<T, OwningNonNull<T>> {
public:
// We want our Value to actually return a non-const reference, even
// if we're const. At least for things that are normally pointer
Expand Down Expand Up @@ -412,8 +412,10 @@ template <typename T>
class Sequence : public FallibleTArray<T> {
public:
Sequence() : FallibleTArray<T>() {}
MOZ_IMPLICIT Sequence(FallibleTArray<T>&& aArray) : FallibleTArray<T>(std::move(aArray)) {}
MOZ_IMPLICIT Sequence(nsTArray<T>&& aArray) : FallibleTArray<T>(std::move(aArray)) {}
MOZ_IMPLICIT Sequence(FallibleTArray<T>&& aArray)
: FallibleTArray<T>(std::move(aArray)) {}
MOZ_IMPLICIT Sequence(nsTArray<T>&& aArray)
: FallibleTArray<T>(std::move(aArray)) {}
};

inline nsWrapperCache* GetWrapperCache(nsWrapperCache* cache) { return cache; }
Expand Down
3 changes: 2 additions & 1 deletion dom/bindings/test/WrapperCachedNonISupportsTestInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class WrapperCachedNonISupportsTestInterface final : public nsWrapperCache {
public:
WrapperCachedNonISupportsTestInterface() {}

static already_AddRefed<WrapperCachedNonISupportsTestInterface> Constructor(const GlobalObject& aGlobalObject);
static already_AddRefed<WrapperCachedNonISupportsTestInterface> Constructor(
const GlobalObject& aGlobalObject);

protected:
~WrapperCachedNonISupportsTestInterface() {}
Expand Down
4 changes: 2 additions & 2 deletions dom/localstorage/LSSnapshot.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class LSSnapshotInitInfo;
class LSWriteAndNotifyInfo;
class SnapshotWriteOptimizer;

template <typename> class Optional;

template <typename>
class Optional;

class LSSnapshot final : public nsIRunnable {
public:
Expand Down
3 changes: 2 additions & 1 deletion dom/localstorage/LSValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
class mozIStorageStatement;

namespace IPC {
template <typename> struct ParamTraits;
template <typename>
struct ParamTraits;
}

namespace mozilla {
Expand Down
40 changes: 21 additions & 19 deletions dom/media/FileBlockCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,14 @@ void FileBlockCache::Flush() {
// Dispatch a task so we won't clear the arrays while PerformBlockIOs() is
// dropping the data lock and cause InvalidArrayIndex.
RefPtr<FileBlockCache> self = this;
mBackgroundET->Dispatch(NS_NewRunnableFunction("FileBlockCache::Flush", [self]() {
MutexAutoLock mon(self->mDataMutex);
// Just discard pending changes, assume MediaCache won't read from
// blocks it hasn't written to.
self->mChangeIndexList.clear();
self->mBlockChanges.Clear();
}));
mBackgroundET->Dispatch(
NS_NewRunnableFunction("FileBlockCache::Flush", [self]() {
MutexAutoLock mon(self->mDataMutex);
// Just discard pending changes, assume MediaCache won't read from
// blocks it hasn't written to.
self->mChangeIndexList.clear();
self->mBlockChanges.Clear();
}));
}

size_t FileBlockCache::GetMaxBlocks(size_t aCacheSizeInKB) const {
Expand Down Expand Up @@ -175,18 +176,19 @@ void FileBlockCache::Close() {
}

// Let the thread close the FD, and then trigger its own shutdown.
// Note that mBackgroundET is now empty, so no other task will be posted there.
// Also mBackgroundET and mFD are empty and therefore can be reused immediately.
nsresult rv = thread->Dispatch(
NS_NewRunnableFunction(
"FileBlockCache::Close",
[thread, fd] {
if (fd) {
CloseFD(fd);
}
// No need to shutdown background task queues.
}),
NS_DISPATCH_EVENT_MAY_BLOCK);
// Note that mBackgroundET is now empty, so no other task will be posted
// there. Also mBackgroundET and mFD are empty and therefore can be reused
// immediately.
nsresult rv = thread->Dispatch(NS_NewRunnableFunction("FileBlockCache::Close",
[thread, fd] {
if (fd) {
CloseFD(fd);
}
// No need to shutdown
// background task
// queues.
}),
NS_DISPATCH_EVENT_MAY_BLOCK);
NS_ENSURE_SUCCESS_VOID(rv);
}

Expand Down
11 changes: 4 additions & 7 deletions dom/media/hls/HLSDemuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,7 @@ void HLSTrackDemuxer::UpdateMediaInfo(int index) {
audioInfo->mBitDepth = audioInfoObj->BitDepth();
audioInfo->mMimeType =
NS_ConvertUTF16toUTF8(audioInfoObj->MimeType()->ToString());
audioInfo->mDuration =
TimeUnit::FromMicroseconds(audioInfoObj->Duration());
audioInfo->mDuration = TimeUnit::FromMicroseconds(audioInfoObj->Duration());
jni::ByteArray::LocalRef csdBytes = audioInfoObj->CodecSpecificData();
if (csdBytes) {
auto&& csd = csdBytes->GetElements();
Expand All @@ -389,11 +388,9 @@ void HLSTrackDemuxer::UpdateMediaInfo(int index) {
videoInfo->mDisplay.height = videoInfoObj->PictureHeight();
videoInfo->mMimeType =
NS_ConvertUTF16toUTF8(videoInfoObj->MimeType()->ToString());
videoInfo->mDuration =
TimeUnit::FromMicroseconds(videoInfoObj->Duration());
HLS_DEBUG("HLSTrackDemuxer",
"Update video info (%d) / I(%dx%d) / D(%dx%d)", index,
videoInfo->mImage.width, videoInfo->mImage.height,
videoInfo->mDuration = TimeUnit::FromMicroseconds(videoInfoObj->Duration());
HLS_DEBUG("HLSTrackDemuxer", "Update video info (%d) / I(%dx%d) / D(%dx%d)",
index, videoInfo->mImage.width, videoInfo->mImage.height,
videoInfo->mDisplay.width, videoInfo->mDisplay.height);
}
}
Expand Down
3 changes: 2 additions & 1 deletion dom/security/nsContentSecurityUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ typedef mozilla::Pair<nsCString, mozilla::Maybe<nsString>>

class nsContentSecurityUtils {
public:
static FilenameTypeAndDetails FilenameToFilenameType(const nsString& fileName);
static FilenameTypeAndDetails FilenameToFilenameType(
const nsString& fileName);
static bool IsEvalAllowed(JSContext* cx, bool aIsSystemPrincipal,
const nsAString& aScript);
static void NotifyEvalUsage(bool aIsSystemPrincipal,
Expand Down
3 changes: 2 additions & 1 deletion gfx/2d/ScaleFactors2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ struct ScaleFactors2D {
return ScaleFactor<src, dst>(xScale);
}

ScaleFactors2D<src, dst>& operator=(const ScaleFactors2D<src, dst>&) = default;
ScaleFactors2D<src, dst>& operator=(const ScaleFactors2D<src, dst>&) =
default;

bool operator==(const ScaleFactors2D<src, dst>& aOther) const {
return xScale == aOther.xScale && yScale == aOther.yScale;
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/ScrollableLayerGuid.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "mozilla/HashFunctions.h" // for HashGeneric
#include "mozilla/gfx/Logging.h" // for Log
#include "mozilla/layers/LayersTypes.h" // for LayersId
#include "nsHashKeys.h" // for nsPrintfCString
#include "nsHashKeys.h" // for nsPrintfCString
#include "nsPrintfCString.h" // for nsPrintfCString

namespace mozilla {
Expand Down
3 changes: 2 additions & 1 deletion image/imgTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ class ImageDecoderListener final : public nsIStreamListener,
: mURI(aURI),
mImage(nullptr),
mCallback(aCallback),
mObserver(aObserver ? new NotificationObserverWrapper(aObserver) : nullptr) {
mObserver(aObserver ? new NotificationObserverWrapper(aObserver)
: nullptr) {
MOZ_ASSERT(NS_IsMainThread());
}

Expand Down
9 changes: 4 additions & 5 deletions ipc/app/MozillaRuntimeMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,16 @@

using namespace mozilla;

static bool
UseForkServer(int argc, char* argv[]) {
static bool UseForkServer(int argc, char* argv[]) {
#if defined(MOZ_ENABLE_FORKSERVER)
return strcmp(argv[argc - 1], "forkserver") == 0;
#else
return false;
#endif
}

static int
RunForkServer(Bootstrap::UniquePtr&& bootstrap, int argc, char* argv[]) {
static int RunForkServer(Bootstrap::UniquePtr&& bootstrap, int argc,
char* argv[]) {
#if defined(MOZ_ENABLE_FORKSERVER)
int ret = 0;

Expand All @@ -38,7 +37,7 @@ RunForkServer(Bootstrap::UniquePtr&& bootstrap, int argc, char* argv[]) {
// argc & argv will be updated with the values passing from the
// chrome process. With the new values, this function
// continues the reset of the code acting as a content process.
if(bootstrap->XRE_ForkServer(&argc, &argv)) {
if (bootstrap->XRE_ForkServer(&argc, &argv)) {
// Return from the fork server in the fork server process.
// Stop the fork server.
} else {
Expand Down
16 changes: 8 additions & 8 deletions ipc/chromium/src/base/process_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@
#include "mozilla/ipc/EnvironmentMap.h"

#if defined(MOZ_ENABLE_FORKSERVER)
#include "nsString.h"
#include "mozilla/Tuple.h"
#include "mozilla/ipc/FileDescriptorShuffle.h"
# include "nsString.h"
# include "mozilla/Tuple.h"
# include "mozilla/ipc/FileDescriptorShuffle.h"

namespace mozilla {
namespace ipc {
class FileDescriptor;
}
}
} // namespace mozilla
#endif

#if defined(OS_MACOSX)
Expand Down Expand Up @@ -195,7 +195,7 @@ EnvironmentArray BuildEnvironmentArray(const environment_map& env_vars_to_set);
* and second step, that is why two steps.
*/
class AppProcessBuilder {
public:
public:
AppProcessBuilder();
// This function will fork a new process for use as a
// content processes.
Expand All @@ -209,10 +209,10 @@ class AppProcessBuilder {
// The message loop may allocate resources like file descriptors.
// If this function is called before the end of the loop, the
// reosurces may be destroyed while the loop is still alive.
void InitAppProcess(int *argcp, char*** argvp);
void InitAppProcess(int* argcp, char*** argvp);

private:
void ReplaceArguments(int *argcp, char*** argvp);
private:
void ReplaceArguments(int* argcp, char*** argvp);

mozilla::ipc::FileDescriptorShuffle shuffle_;
std::vector<std::string> argv_;
Expand Down
Loading

0 comments on commit c521758

Please sign in to comment.