Skip to content

Commit

Permalink
Bug 1512961 - 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/D14060

--HG--
extra : moz-landing-system : lando
  • Loading branch information
sylvestre committed Dec 10, 2018
1 parent 5dcce00 commit ad75e91
Show file tree
Hide file tree
Showing 30 changed files with 216 additions and 294 deletions.
8 changes: 2 additions & 6 deletions accessible/android/ProxyAccessibleWrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,11 @@ void ProxyAccessibleWrap::ScrollTo(uint32_t aHow) const {
Proxy()->ScrollTo(aHow);
}

uint8_t
ProxyAccessibleWrap::ActionCount() const
{
uint8_t ProxyAccessibleWrap::ActionCount() const {
return Proxy()->ActionCount();
}

bool
ProxyAccessibleWrap::DoAction(uint8_t aIndex) const
{
bool ProxyAccessibleWrap::DoAction(uint8_t aIndex) const {
return Proxy()->DoAction(aIndex);
}

Expand Down
3 changes: 2 additions & 1 deletion accessible/android/SessionAccessibility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ void SessionAccessibility::ReplaceViewportCache(
AccessibleWrap* acc = aAccessibles.ElementAt(i);
if (aData.Length() == aAccessibles.Length()) {
const BatchData& data = aData.ElementAt(i);
auto bundle = acc->ToSmallBundle(data.State(), data.Bounds(), data.ActionCount());
auto bundle =
acc->ToSmallBundle(data.State(), data.Bounds(), data.ActionCount());
infos->SetElement(i, bundle);
} else {
infos->SetElement(i, acc->ToSmallBundle());
Expand Down
2 changes: 1 addition & 1 deletion dom/base/Element.h
Original file line number Diff line number Diff line change
Expand Up @@ -1897,7 +1897,7 @@ class Element : public FragmentOrElement {
// descendants of display: none elements.
mozilla::RustCell<ServoNodeData*> mServoData;

protected:
protected:
// Array containing all attributes for this element
AttrArray mAttrs;
};
Expand Down
60 changes: 22 additions & 38 deletions dom/ipc/WindowGlobalChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,14 @@ static StaticAutoPtr<WGCByIdMap> gWindowGlobalChildById;

WindowGlobalChild::WindowGlobalChild(nsGlobalWindowInner* aWindow,
dom::BrowsingContext* aBrowsingContext)
: mWindowGlobal(aWindow)
, mBrowsingContext(aBrowsingContext)
, mInnerWindowId(aWindow->WindowID())
, mOuterWindowId(aWindow->GetOuterWindow()->WindowID())
, mIPCClosed(true)
{
}

already_AddRefed<WindowGlobalChild>
WindowGlobalChild::Create(nsGlobalWindowInner* aWindow)
{
: mWindowGlobal(aWindow),
mBrowsingContext(aBrowsingContext),
mInnerWindowId(aWindow->WindowID()),
mOuterWindowId(aWindow->GetOuterWindow()->WindowID()),
mIPCClosed(true) {}

already_AddRefed<WindowGlobalChild> WindowGlobalChild::Create(
nsGlobalWindowInner* aWindow) {
nsCOMPtr<nsIPrincipal> principal = aWindow->GetPrincipal();
MOZ_ASSERT(principal);

Expand All @@ -40,8 +37,7 @@ WindowGlobalChild::Create(nsGlobalWindowInner* aWindow)

WindowGlobalInit init(principal,
BrowsingContextId(wgc->BrowsingContext()->Id()),
wgc->mInnerWindowId,
wgc->mOuterWindowId);
wgc->mInnerWindowId, wgc->mOuterWindowId);

// Send the link constructor over PInProcessChild or PBrowser.
if (XRE_IsParentProcess()) {
Expand All @@ -53,7 +49,8 @@ WindowGlobalChild::Create(nsGlobalWindowInner* aWindow)
// Note: ref is released in DeallocPWindowGlobalChild
ipc->SendPWindowGlobalConstructor(do_AddRef(wgc).take(), init);
} else {
RefPtr<TabChild> tabChild = TabChild::GetFrom(static_cast<mozIDOMWindow*>(aWindow));
RefPtr<TabChild> tabChild =
TabChild::GetFrom(static_cast<mozIDOMWindow*>(aWindow));
MOZ_ASSERT(tabChild);

// Note: ref is released in DeallocPWindowGlobalChild
Expand All @@ -74,62 +71,49 @@ WindowGlobalChild::Create(nsGlobalWindowInner* aWindow)
}

/* static */ already_AddRefed<WindowGlobalChild>
WindowGlobalChild::GetByInnerWindowId(uint64_t aInnerWindowId)
{
WindowGlobalChild::GetByInnerWindowId(uint64_t aInnerWindowId) {
if (!gWindowGlobalChildById) {
return nullptr;
}
return gWindowGlobalChildById->Get(aInnerWindowId);
}

bool
WindowGlobalChild::IsCurrentGlobal()
{
bool WindowGlobalChild::IsCurrentGlobal() {
return !mIPCClosed && mWindowGlobal->IsCurrentInnerWindow();
}

already_AddRefed<WindowGlobalParent>
WindowGlobalChild::GetParentActor()
{
already_AddRefed<WindowGlobalParent> WindowGlobalChild::GetParentActor() {
if (mIPCClosed) {
return nullptr;
}
IProtocol* otherSide = InProcessChild::ParentActorFor(this);
return do_AddRef(static_cast<WindowGlobalParent*>(otherSide));
}

void
WindowGlobalChild::ActorDestroy(ActorDestroyReason aWhy)
{
void WindowGlobalChild::ActorDestroy(ActorDestroyReason aWhy) {
mIPCClosed = true;
gWindowGlobalChildById->Remove(mInnerWindowId);
}

WindowGlobalChild::~WindowGlobalChild()
{
WindowGlobalChild::~WindowGlobalChild() {
MOZ_ASSERT(!gWindowGlobalChildById ||
!gWindowGlobalChildById->Contains(mInnerWindowId));
}

JSObject*
WindowGlobalChild::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
JSObject* WindowGlobalChild::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return WindowGlobalChild_Binding::Wrap(aCx, this, aGivenProto);
}

nsISupports*
WindowGlobalChild::GetParentObject()
{
nsISupports* WindowGlobalChild::GetParentObject() {
return xpc::NativeGlobal(xpc::PrivilegedJunkScope());
}

NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(WindowGlobalChild,
mWindowGlobal,
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(WindowGlobalChild, mWindowGlobal,
mBrowsingContext)

NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WindowGlobalChild, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WindowGlobalChild, Release)

} // namespace dom
} // namespace mozilla
} // namespace dom
} // namespace mozilla
30 changes: 14 additions & 16 deletions dom/ipc/WindowGlobalChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class nsGlobalWindowInner;
class nsDocShell;

namespace mozilla {
namespace dom {
namespace dom {

class BrowsingContext;
class WindowGlobalParent;
Expand All @@ -24,18 +24,16 @@ class WindowGlobalParent;
* Actor for a single nsGlobalWindowInner. This actor is used to communicate
* information to the parent process asynchronously.
*/
class WindowGlobalChild : public nsWrapperCache
, public PWindowGlobalChild
{
public:
class WindowGlobalChild : public nsWrapperCache, public PWindowGlobalChild {
public:
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WindowGlobalChild)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WindowGlobalChild)

static already_AddRefed<WindowGlobalChild>
GetByInnerWindowId(uint64_t aInnerWindowId);
static already_AddRefed<WindowGlobalChild> GetByInnerWindowId(
uint64_t aInnerWindowId);

static already_AddRefed<WindowGlobalChild>
GetByInnerWindowId(const GlobalObject& aGlobal, uint64_t aInnerWindowId) {
static already_AddRefed<WindowGlobalChild> GetByInnerWindowId(
const GlobalObject& aGlobal, uint64_t aInnerWindowId) {
return GetByInnerWindowId(aInnerWindowId);
}

Expand All @@ -60,17 +58,17 @@ class WindowGlobalChild : public nsWrapperCache
already_AddRefed<WindowGlobalParent> GetParentActor();

// Create and initialize the WindowGlobalChild object.
static already_AddRefed<WindowGlobalChild>
Create(nsGlobalWindowInner* aWindow);
static already_AddRefed<WindowGlobalChild> Create(
nsGlobalWindowInner* aWindow);

nsISupports* GetParentObject();
JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;

protected:
protected:
virtual void ActorDestroy(ActorDestroyReason aWhy) override;

private:
private:
WindowGlobalChild(nsGlobalWindowInner* aWindow, dom::BrowsingContext* aBc);
~WindowGlobalChild();

Expand All @@ -81,7 +79,7 @@ class WindowGlobalChild : public nsWrapperCache
bool mIPCClosed;
};

} // namespace dom
} // namespace mozilla
} // namespace dom
} // namespace mozilla

#endif // !defined(mozilla_dom_WindowGlobalChild_h)
#endif // !defined(mozilla_dom_WindowGlobalChild_h)
60 changes: 21 additions & 39 deletions dom/ipc/WindowGlobalParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ static StaticAutoPtr<WGPByIdMap> gWindowGlobalParentsById;

WindowGlobalParent::WindowGlobalParent(const WindowGlobalInit& aInit,
bool aInProcess)
: mDocumentPrincipal(aInit.principal())
, mInnerWindowId(aInit.innerWindowId())
, mOuterWindowId(aInit.outerWindowId())
, mInProcess(aInProcess)
, mIPCClosed(true) // Closed until WGP::Init
: mDocumentPrincipal(aInit.principal()),
mInnerWindowId(aInit.innerWindowId()),
mOuterWindowId(aInit.outerWindowId()),
mInProcess(aInProcess),
mIPCClosed(true) // Closed until WGP::Init
{
MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess(), "Parent process only");
MOZ_RELEASE_ASSERT(mDocumentPrincipal, "Must have a valid principal");
Expand All @@ -33,9 +33,7 @@ WindowGlobalParent::WindowGlobalParent(const WindowGlobalInit& aInit,
"Must be made in BrowsingContext");
}

void
WindowGlobalParent::Init(const WindowGlobalInit& aInit)
{
void WindowGlobalParent::Init(const WindowGlobalInit& aInit) {
MOZ_ASSERT(Manager(), "Should have a manager!");
MOZ_ASSERT(!mFrameLoader, "Cannot Init() a WindowGlobalParent twice!");

Expand Down Expand Up @@ -77,7 +75,8 @@ WindowGlobalParent::Init(const WindowGlobalInit& aInit)
RefPtr<WindowGlobalChild> otherSide = GetChildActor();
if (otherSide && otherSide->WindowGlobal()) {
// Get the toplevel window from the other side.
RefPtr<nsDocShell> docShell = nsDocShell::Cast(otherSide->WindowGlobal()->GetDocShell());
RefPtr<nsDocShell> docShell =
nsDocShell::Cast(otherSide->WindowGlobal()->GetDocShell());
if (docShell) {
docShell->GetTopFrameElement(getter_AddRefs(frameElement));
}
Expand All @@ -97,79 +96,62 @@ WindowGlobalParent::Init(const WindowGlobalInit& aInit)
}

/* static */ already_AddRefed<WindowGlobalParent>
WindowGlobalParent::GetByInnerWindowId(uint64_t aInnerWindowId)
{
WindowGlobalParent::GetByInnerWindowId(uint64_t aInnerWindowId) {
if (!gWindowGlobalParentsById) {
return nullptr;
}
return gWindowGlobalParentsById->Get(aInnerWindowId);
}

already_AddRefed<WindowGlobalChild>
WindowGlobalParent::GetChildActor()
{
already_AddRefed<WindowGlobalChild> WindowGlobalParent::GetChildActor() {
if (mIPCClosed) {
return nullptr;
}
IProtocol* otherSide = InProcessParent::ChildActorFor(this);
return do_AddRef(static_cast<WindowGlobalChild*>(otherSide));
}

IPCResult
WindowGlobalParent::RecvUpdateDocumentURI(nsIURI* aURI)
{
IPCResult WindowGlobalParent::RecvUpdateDocumentURI(nsIURI* aURI) {
// XXX(nika): Assert that the URI change was one which makes sense (either
// about:blank -> a real URI, or a legal push/popstate URI change?)
mDocumentURI = aURI;
return IPC_OK();
}

IPCResult
WindowGlobalParent::RecvBecomeCurrentWindowGlobal()
{
IPCResult WindowGlobalParent::RecvBecomeCurrentWindowGlobal() {
mBrowsingContext->SetCurrentWindowGlobal(this);
return IPC_OK();
}

bool
WindowGlobalParent::IsCurrentGlobal()
{
bool WindowGlobalParent::IsCurrentGlobal() {
return !mIPCClosed && mBrowsingContext->GetCurrentWindowGlobal() == this;
}

void
WindowGlobalParent::ActorDestroy(ActorDestroyReason aWhy)
{
void WindowGlobalParent::ActorDestroy(ActorDestroyReason aWhy) {
mIPCClosed = true;
gWindowGlobalParentsById->Remove(mInnerWindowId);
mBrowsingContext->UnregisterWindowGlobal(this);
}

WindowGlobalParent::~WindowGlobalParent()
{
WindowGlobalParent::~WindowGlobalParent() {
MOZ_ASSERT(!gWindowGlobalParentsById ||
!gWindowGlobalParentsById->Contains(mInnerWindowId));
}

JSObject*
WindowGlobalParent::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
JSObject* WindowGlobalParent::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return WindowGlobalParent_Binding::Wrap(aCx, this, aGivenProto);
}

nsISupports*
WindowGlobalParent::GetParentObject()
{
nsISupports* WindowGlobalParent::GetParentObject() {
return xpc::NativeGlobal(xpc::PrivilegedJunkScope());
}

NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(WindowGlobalParent,
mFrameLoader,
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(WindowGlobalParent, mFrameLoader,
mBrowsingContext)

NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WindowGlobalParent, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WindowGlobalParent, Release)

} // namespace dom
} // namespace mozilla
} // namespace dom
} // namespace mozilla
Loading

0 comments on commit ad75e91

Please sign in to comment.