summaryrefslogtreecommitdiffstats
path: root/widget
diff options
context:
space:
mode:
Diffstat (limited to 'widget')
-rw-r--r--widget/android/fennec/Telemetry.h3
-rw-r--r--widget/nsIdleService.cpp15
-rw-r--r--widget/windows/WinCompositorWidget.cpp8
-rw-r--r--widget/windows/WinCompositorWidget.h4
-rw-r--r--widget/windows/nsLookAndFeel.cpp3
-rw-r--r--widget/windows/nsWindow.cpp16
-rw-r--r--widget/windows/nsWindowGfx.cpp2
7 files changed, 31 insertions, 20 deletions
diff --git a/widget/android/fennec/Telemetry.h b/widget/android/fennec/Telemetry.h
index c72735496..458889ef0 100644
--- a/widget/android/fennec/Telemetry.h
+++ b/widget/android/fennec/Telemetry.h
@@ -44,7 +44,6 @@ public:
AddHistogram(jni::String::Param aName, int32_t aValue)
{
MOZ_ASSERT(aName);
- mozilla::Telemetry::Accumulate(aName->ToCString().get(), aValue);
}
static void
@@ -52,8 +51,6 @@ public:
int32_t aValue)
{
MOZ_ASSERT(aName && aKey);
- mozilla::Telemetry::Accumulate(aName->ToCString().get(),
- aKey->ToCString(), aValue);
}
static void
diff --git a/widget/nsIdleService.cpp b/widget/nsIdleService.cpp
index 6a2833081..f9904d39c 100644
--- a/widget/nsIdleService.cpp
+++ b/widget/nsIdleService.cpp
@@ -46,6 +46,10 @@ using namespace mozilla;
// Number of seconds in a day.
#define SECONDS_PER_DAY 86400
+// MAX_DELTA_SEC * 1000 should be less than UINT32_MAX to prevent overflow on
+// converting from sec to msec
+#define MAX_DELTA_SEC (SECONDS_PER_DAY * 10)
+
static PRLogModuleInfo *sLog = nullptr;
#define LOG_TAG "GeckoIdleService"
@@ -391,7 +395,7 @@ nsIdleService::GetInstance()
nsIdleService::nsIdleService() : mCurrentlySetToTimeoutAt(TimeStamp()),
mIdleObserverCount(0),
- mDeltaToNextIdleSwitchInS(UINT32_MAX),
+ mDeltaToNextIdleSwitchInS(MAX_DELTA_SEC),
mLastUserInteraction(TimeStamp::Now())
{
if (sLog == nullptr)
@@ -544,7 +548,7 @@ nsIdleService::ResetIdleTimeOut(uint32_t idleDeltaInMS)
// Mark all idle services as non-idle, and calculate the next idle timeout.
nsCOMArray<nsIObserver> notifyList;
- mDeltaToNextIdleSwitchInS = UINT32_MAX;
+ mDeltaToNextIdleSwitchInS = MAX_DELTA_SEC;
// Loop through all listeners, and find any that have detected idle.
for (uint32_t i = 0; i < mArrayListeners.Length(); i++) {
@@ -716,11 +720,8 @@ nsIdleService::IdleTimerCallback(void)
return;
}
- // Tell expired listeners they are expired,and find the next timeout
- Telemetry::AutoTimer<Telemetry::IDLE_NOTIFY_IDLE_MS> timer;
-
// We need to initialise the time to the next idle switch.
- mDeltaToNextIdleSwitchInS = UINT32_MAX;
+ mDeltaToNextIdleSwitchInS = MAX_DELTA_SEC;
// Create list of observers that should be notified.
nsCOMArray<nsIObserver> notifyList;
@@ -842,7 +843,7 @@ void
nsIdleService::ReconfigureTimer(void)
{
// Check if either someone is idle, or someone will become idle.
- if ((mIdleObserverCount == 0) && UINT32_MAX == mDeltaToNextIdleSwitchInS) {
+ if ((mIdleObserverCount == 0) && MAX_DELTA_SEC == mDeltaToNextIdleSwitchInS) {
// If not, just let any existing timers run to completion
// And bail out.
MOZ_LOG(sLog, LogLevel::Debug,
diff --git a/widget/windows/WinCompositorWidget.cpp b/widget/windows/WinCompositorWidget.cpp
index f660bd019..99ce67573 100644
--- a/widget/windows/WinCompositorWidget.cpp
+++ b/widget/windows/WinCompositorWidget.cpp
@@ -22,6 +22,7 @@ using namespace mozilla::gfx;
WinCompositorWidget::WinCompositorWidget(const CompositorWidgetInitData& aInitData)
: mWidgetKey(aInitData.widgetKey()),
mWnd(reinterpret_cast<HWND>(aInitData.hWnd())),
+ mTransparentSurfaceLock("mTransparentSurfaceLock"),
mTransparencyMode(static_cast<nsTransparencyMode>(aInitData.transparencyMode())),
mMemoryDC(nullptr),
mCompositeDC(nullptr),
@@ -39,6 +40,7 @@ WinCompositorWidget::WinCompositorWidget(const CompositorWidgetInitData& aInitDa
void
WinCompositorWidget::OnDestroyWindow()
{
+ MutexAutoLock lock(mTransparentSurfaceLock);
mTransparentSurface = nullptr;
mMemoryDC = nullptr;
}
@@ -75,6 +77,8 @@ WinCompositorWidget::GetClientSize()
already_AddRefed<gfx::DrawTarget>
WinCompositorWidget::StartRemoteDrawing()
{
+ MutexAutoLock lock(mTransparentSurfaceLock);
+
MOZ_ASSERT(!mCompositeDC);
RefPtr<gfxASurface> surf;
@@ -229,6 +233,7 @@ WinCompositorWidget::LeavePresentLock()
RefPtr<gfxASurface>
WinCompositorWidget::EnsureTransparentSurface()
{
+ mTransparentSurfaceLock.AssertCurrentThreadOwns();
MOZ_ASSERT(mTransparencyMode == eTransparencyTransparent);
IntSize size = GetClientSize().ToUnknownSize();
@@ -245,6 +250,7 @@ WinCompositorWidget::EnsureTransparentSurface()
void
WinCompositorWidget::CreateTransparentSurface(const gfx::IntSize& aSize)
{
+ mTransparentSurfaceLock.AssertCurrentThreadOwns();
MOZ_ASSERT(!mTransparentSurface && !mMemoryDC);
RefPtr<gfxWindowsSurface> surface = new gfxWindowsSurface(aSize, SurfaceFormat::A8R8G8B8_UINT32);
mTransparentSurface = surface;
@@ -254,6 +260,7 @@ WinCompositorWidget::CreateTransparentSurface(const gfx::IntSize& aSize)
void
WinCompositorWidget::UpdateTransparency(nsTransparencyMode aMode)
{
+ MutexAutoLock lock(mTransparentSurfaceLock);
if (mTransparencyMode == aMode) {
return;
}
@@ -270,6 +277,7 @@ WinCompositorWidget::UpdateTransparency(nsTransparencyMode aMode)
void
WinCompositorWidget::ClearTransparentWindow()
{
+ MutexAutoLock lock(mTransparentSurfaceLock);
if (!mTransparentSurface) {
return;
}
diff --git a/widget/windows/WinCompositorWidget.h b/widget/windows/WinCompositorWidget.h
index 9661cab45..1689a8641 100644
--- a/widget/windows/WinCompositorWidget.h
+++ b/widget/windows/WinCompositorWidget.h
@@ -10,6 +10,7 @@
#include "gfxASurface.h"
#include "mozilla/gfx/CriticalSection.h"
#include "mozilla/gfx/Point.h"
+#include "mozilla/Mutex.h"
#include "nsIWidget.h"
class nsWindow;
@@ -83,6 +84,8 @@ public:
return mWnd;
}
+ mozilla::Mutex& GetTransparentSurfaceLock() { return mTransparentSurfaceLock; }
+
private:
HDC GetWindowSurface();
void FreeWindowSurface(HDC dc);
@@ -95,6 +98,7 @@ private:
gfx::CriticalSection mPresentLock;
// Transparency handling.
+ mozilla::Mutex mTransparentSurfaceLock;
nsTransparencyMode mTransparencyMode;
RefPtr<gfxASurface> mTransparentSurface;
HDC mMemoryDC;
diff --git a/widget/windows/nsLookAndFeel.cpp b/widget/windows/nsLookAndFeel.cpp
index 97f81abfd..a907622d9 100644
--- a/widget/windows/nsLookAndFeel.cpp
+++ b/widget/windows/nsLookAndFeel.cpp
@@ -11,7 +11,6 @@
#include "nsUXThemeConstants.h"
#include "gfxFont.h"
#include "WinUtils.h"
-#include "mozilla/Telemetry.h"
#include "mozilla/WindowsVersion.h"
#include "gfxFontConstants.h"
@@ -65,8 +64,6 @@ nsLookAndFeel::nsLookAndFeel()
: nsXPLookAndFeel()
, mUseAccessibilityTheme(0)
{
- mozilla::Telemetry::Accumulate(mozilla::Telemetry::TOUCH_ENABLED_DEVICE,
- WinUtils::IsTouchDeviceSupportPresent());
}
nsLookAndFeel::~nsLookAndFeel()
diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp
index b2bb59bd3..122d18686 100644
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -366,6 +366,9 @@ static const int32_t kResizableBorderMinSize = 3;
// Cached pointer events enabler value, True if pointer events are enabled.
static bool gIsPointerEventsEnabled = false;
+// Cached scroll outside menu enabler value, True if scrolling is allowed.
+static bool gIsScrollingOutsideEnabled = false;
+
// We should never really try to accelerate windows bigger than this. In some
// cases this might lead to no D3D9 acceleration where we could have had it
// but D3D9 does not reliably report when it supports bigger windows. 8192
@@ -665,6 +668,10 @@ nsWindow::nsWindow()
Preferences::AddBoolVarCache(&gIsPointerEventsEnabled,
"dom.w3c_pointer_events.enabled",
gIsPointerEventsEnabled);
+ Preferences::AddBoolVarCache(&gIsScrollingOutsideEnabled,
+ "ui.menu.allow_content_scroll",
+ gIsScrollingOutsideEnabled);
+
} // !sInstanceCount
mIdleService = nullptr;
@@ -4225,10 +4232,6 @@ nsWindow::DispatchMouseEvent(EventMessage aEventMessage, WPARAM wParam,
}
if (WinUtils::GetIsMouseFromTouch(aEventMessage)) {
- if (aEventMessage == eMouseDown) {
- Telemetry::Accumulate(Telemetry::FX_TOUCH_USED, 1);
- }
-
if (mTouchWindow) {
// If mTouchWindow is true, then we must have APZ enabled and be
// feeding it raw touch events. In that case we don't need to
@@ -6743,8 +6746,6 @@ bool nsWindow::OnGesture(WPARAM wParam, LPARAM lParam)
bool endFeedback = true;
if (mGesture.PanDeltaToPixelScroll(wheelEvent)) {
- mozilla::Telemetry::Accumulate(mozilla::Telemetry::SCROLL_INPUT_METHODS,
- (uint32_t) ScrollInputMethod::MainThreadTouch);
DispatchEvent(&wheelEvent, status);
}
@@ -7703,7 +7704,8 @@ nsWindow::DealWithPopups(HWND aWnd, UINT aMessage,
break;
}
}
- return consumeRollupEvent;
+ // Consume event if appropriate unless overridden.
+ return consumeRollupEvent && !gIsScrollingOutsideEnabled;
case WM_ACTIVATEAPP:
break;
diff --git a/widget/windows/nsWindowGfx.cpp b/widget/windows/nsWindowGfx.cpp
index a88631f89..9b303a0f2 100644
--- a/widget/windows/nsWindowGfx.cpp
+++ b/widget/windows/nsWindowGfx.cpp
@@ -320,6 +320,8 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel)
#if defined(MOZ_XUL)
// don't support transparency for non-GDI rendering, for now
if (eTransparencyTransparent == mTransparencyMode) {
+ // This mutex needs to be held when EnsureTransparentSurface is called.
+ MutexAutoLock lock(mBasicLayersSurface->GetTransparentSurfaceLock());
targetSurface = mBasicLayersSurface->EnsureTransparentSurface();
}
#endif