Skip to content

Commit

Permalink
Backed out 5 changesets (bug 1523351) for build bustage at builds/wor…
Browse files Browse the repository at this point in the history
…ker/workspace/build/src/dom/gamepad/GamepadRemapping.cpp on a CLOSED TREE

Backed out changeset 723d0a919d71 (bug 1523351)
Backed out changeset 13dcba81ff07 (bug 1523351)
Backed out changeset 6209717410be (bug 1523351)
Backed out changeset 80b34e6ce876 (bug 1523351)
Backed out changeset 7bdb7982c3af (bug 1523351)
  • Loading branch information
dvarga1989 committed May 29, 2019
1 parent 0db63d2 commit b173205
Show file tree
Hide file tree
Showing 50 changed files with 65 additions and 1,315 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
GamepadService.noHand,
4, // buttons
2,
0,
0,
0).then((aIndex) => new Promise((aResolve) => {
// Press a button to make the gamepad visible to the page.
GamepadService.newButtonEvent(aIndex, 0, true, true);
Expand Down
59 changes: 6 additions & 53 deletions dom/gamepad/Gamepad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Gamepad)
NS_INTERFACE_MAP_END

NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Gamepad, mParent, mButtons, mPose,
mHapticActuators, mLightIndicators,
mTouchEvents)
mHapticActuators)

void Gamepad::UpdateTimestamp() {
nsCOMPtr<nsPIDOMWindowInner> newWindow(do_QueryInterface(mParent));
Expand All @@ -38,14 +37,12 @@ void Gamepad::UpdateTimestamp() {
Gamepad::Gamepad(nsISupports* aParent, const nsAString& aID, uint32_t aIndex,
uint32_t aHashKey, GamepadMappingType aMapping,
GamepadHand aHand, uint32_t aDisplayID, uint32_t aNumButtons,
uint32_t aNumAxes, uint32_t aNumHaptics,
uint32_t aNumLightIndicator, uint32_t aNumTouchEvents)
uint32_t aNumAxes, uint32_t aNumHaptics)
: mParent(aParent),
mID(aID),
mIndex(aIndex),
mHashKey(aHashKey),
mDisplayId(aDisplayID),
mTouchIdHashValue(0),
mMapping(aMapping),
mHand(aHand),
mConnected(true),
Expand All @@ -61,14 +58,6 @@ Gamepad::Gamepad(nsISupports* aParent, const nsAString& aID, uint32_t aIndex,
mHapticActuators.AppendElement(
new GamepadHapticActuator(mParent, mHashKey, i));
}
for (uint32_t i = 0; i < aNumLightIndicator; ++i) {
mLightIndicators.AppendElement(
new GamepadLightIndicator(mParent, mHashKey, i));
}
for (uint32_t i = 0; i < aNumTouchEvents; ++i) {
mTouchEvents.AppendElement(new GamepadTouch(mParent));
}

UpdateTimestamp();
}

Expand Down Expand Up @@ -99,35 +88,11 @@ void Gamepad::SetPose(const GamepadPoseState& aPose) {
UpdateTimestamp();
}

void Gamepad::SetLightIndicatorType(uint32_t aLightIndex,
GamepadLightIndicatorType aType) {
mLightIndicators[aLightIndex]->SetType(aType);
UpdateTimestamp();
}

void Gamepad::SetTouchEvent(uint32_t aTouchIndex,
const GamepadTouchState& aTouch) {
if (aTouchIndex >= mTouchEvents.Length()) {
MOZ_CRASH("Touch index exceeds the event array.");
return;
}

// Handling cross-origin tracking.
GamepadTouchState touchState(aTouch);
if (auto hashValue = mTouchIdHash.GetValue(touchState.touchId)) {
touchState.touchId = *hashValue;
} else {
touchState.touchId = mTouchIdHashValue;
mTouchIdHash.Put(aTouch.touchId, mTouchIdHashValue);
++mTouchIdHashValue;
}
mTouchEvents[aTouchIndex]->SetTouchState(touchState);
UpdateTimestamp();
}

void Gamepad::SetHand(GamepadHand aHand) { mHand = aHand; }

void Gamepad::SyncState(Gamepad* aOther) {
const char* kGamepadExtEnabledPref = "dom.gamepad.extensions.enabled";

if (mButtons.Length() != aOther->mButtons.Length() ||
mAxes.Length() != aOther->mAxes.Length()) {
return;
Expand All @@ -149,24 +114,13 @@ void Gamepad::SyncState(Gamepad* aOther) {
Gamepad_Binding::ClearCachedAxesValue(this);
}

if (StaticPrefs::dom_gamepad_extensions_enabled()) {
if (Preferences::GetBool(kGamepadExtEnabledPref)) {
MOZ_ASSERT(aOther->GetPose());
mPose->SetPoseState(aOther->GetPose()->GetPoseState());
mHand = aOther->Hand();
for (uint32_t i = 0; i < mHapticActuators.Length(); ++i) {
mHapticActuators[i]->Set(aOther->mHapticActuators[i]);
}

if (StaticPrefs::dom_gamepad_extensions_lightindicator()) {
for (uint32_t i = 0; i < mLightIndicators.Length(); ++i) {
mLightIndicators[i]->Set(aOther->mLightIndicators[i]);
}
}
if (StaticPrefs::dom_gamepad_extensions_multitouch()) {
for (uint32_t i = 0; i < mTouchEvents.Length(); ++i) {
mTouchEvents[i]->Set(aOther->mTouchEvents[i]);
}
}
}

UpdateTimestamp();
Expand All @@ -175,8 +129,7 @@ void Gamepad::SyncState(Gamepad* aOther) {
already_AddRefed<Gamepad> Gamepad::Clone(nsISupports* aParent) {
RefPtr<Gamepad> out =
new Gamepad(aParent, mID, mIndex, mHashKey, mMapping, mHand, mDisplayId,
mButtons.Length(), mAxes.Length(), mHapticActuators.Length(),
mLightIndicators.Length(), mTouchEvents.Length());
mButtons.Length(), mAxes.Length(), mHapticActuators.Length());
out->SyncState(this);
return out.forget();
}
Expand Down
21 changes: 1 addition & 20 deletions dom/gamepad/Gamepad.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#include "mozilla/dom/GamepadButton.h"
#include "mozilla/dom/GamepadPose.h"
#include "mozilla/dom/GamepadHapticActuator.h"
#include "mozilla/dom/GamepadLightIndicator.h"
#include "mozilla/dom/GamepadTouch.h"
#include "mozilla/dom/Performance.h"
#include <stdint.h>
#include "nsCOMPtr.h"
Expand Down Expand Up @@ -42,8 +40,7 @@ class Gamepad final : public nsISupports, public nsWrapperCache {
Gamepad(nsISupports* aParent, const nsAString& aID, uint32_t aIndex,
uint32_t aHashKey, GamepadMappingType aMapping, GamepadHand aHand,
uint32_t aDisplayID, uint32_t aNumButtons, uint32_t aNumAxes,
uint32_t aNumHaptics, uint32_t aNumLightIndicator,
uint32_t aNumTouchEvents);
uint32_t aNumHaptics);

NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Gamepad)
Expand All @@ -53,9 +50,6 @@ class Gamepad final : public nsISupports, public nsWrapperCache {
void SetAxis(uint32_t aAxis, double aValue);
void SetIndex(uint32_t aIndex);
void SetPose(const GamepadPoseState& aPose);
void SetLightIndicatorType(uint32_t aLightIndex,
GamepadLightIndicatorType aType);
void SetTouchEvent(uint32_t aTouchIndex, const GamepadTouchState& aTouch);
void SetHand(GamepadHand aHand);

// Make the state of this gamepad equivalent to other.
Expand Down Expand Up @@ -99,15 +93,6 @@ class Gamepad final : public nsISupports, public nsWrapperCache {
aHapticActuators = mHapticActuators;
}

void GetLightIndicators(
nsTArray<RefPtr<GamepadLightIndicator>>& aLightIndicators) const {
aLightIndicators = mLightIndicators;
}

void GetTouchEvents(nsTArray<RefPtr<GamepadTouch>>& aTouchEvents) const {
aTouchEvents = mTouchEvents;
}

private:
virtual ~Gamepad() {}
void UpdateTimestamp();
Expand All @@ -119,7 +104,6 @@ class Gamepad final : public nsISupports, public nsWrapperCache {
// the gamepad hash key in GamepadManager
uint32_t mHashKey;
uint32_t mDisplayId;
uint32_t mTouchIdHashValue;
// The mapping in use.
GamepadMappingType mMapping;
GamepadHand mHand;
Expand All @@ -133,9 +117,6 @@ class Gamepad final : public nsISupports, public nsWrapperCache {
DOMHighResTimeStamp mTimestamp;
RefPtr<GamepadPose> mPose;
nsTArray<RefPtr<GamepadHapticActuator>> mHapticActuators;
nsTArray<RefPtr<GamepadLightIndicator>> mLightIndicators;
nsTArray<RefPtr<GamepadTouch>> mTouchEvents;
nsDataHashtable<nsUint32HashKey, uint32_t> mTouchIdHash;
};

} // namespace dom
Expand Down
69 changes: 0 additions & 69 deletions dom/gamepad/GamepadLightIndicator.cpp

This file was deleted.

53 changes: 0 additions & 53 deletions dom/gamepad/GamepadLightIndicator.h

This file was deleted.

Loading

0 comments on commit b173205

Please sign in to comment.