Backed out changeset 6ff5cc310486 (bug 1328066) for asserting in browser/components/sessionstore/test/browser_477657.js at widget/cocoa/nsChildView.mm:3668. r=backout

This commit is contained in:
Sebastian Hengst 2017-01-31 00:52:51 +01:00
Родитель 84b323d81e
Коммит 5ac9f38bfa
11 изменённых файлов: 53 добавлений и 130 удалений

Просмотреть файл

@ -92,6 +92,9 @@
<field name="mProgressListeners">
[]
</field>
<field name="mActiveResizeDisplayportSuppression">
null
</field>
<field name="mTabsProgressListeners">
[]
</field>
@ -4923,7 +4926,28 @@
<parameter name="aTopic"/>
<parameter name="aData"/>
<body><![CDATA[
let browser;
switch (aTopic) {
case "live-resize-start": {
browser = this.mCurrentTab.linkedBrowser;
let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
if (fl && fl.tabParent && !this.mActiveResizeDisplayportSuppression) {
fl.tabParent.suppressDisplayport(true);
this.mActiveResizeDisplayportSuppression = browser;
}
break;
}
case "live-resize-end": {
browser = this.mActiveResizeDisplayportSuppression;
if (browser) {
let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
if (fl && fl.tabParent) {
fl.tabParent.suppressDisplayport(false);
this.mActiveResizeDisplayportSuppression = null;
}
}
break;
}
case "contextual-identity-updated": {
for (let tab of this.tabs) {
if (tab.getAttribute("usercontextid") == aData) {
@ -4946,6 +4970,8 @@
this.mCurrentBrowser = document.getAnonymousElementByAttribute(this, "anonid", "initialBrowser");
this.mCurrentBrowser.permanentKey = {};
Services.obs.addObserver(this, "live-resize-start", false);
Services.obs.addObserver(this, "live-resize-end", false);
Services.obs.addObserver(this, "contextual-identity-updated", false);
this.mCurrentTab = this.tabContainer.firstChild;
@ -5048,6 +5074,8 @@
<destructor>
<![CDATA[
Services.obs.removeObserver(this, "live-resize-start");
Services.obs.removeObserver(this, "live-resize-end");
Services.obs.removeObserver(this, "contextual-identity-updated");
for (let tab of this.tabs) {

Просмотреть файл

@ -3296,18 +3296,6 @@ TabParent::RecvRequestCrossBrowserNavigation(const uint32_t& aGlobalIndex)
return IPC_OK();
}
void
TabParent::LiveResizeStarted()
{
SuppressDisplayport(true);
}
void
TabParent::LiveResizeStopped()
{
SuppressDisplayport(false);
}
NS_IMETHODIMP
FakeChannel::OnAuthAvailable(nsISupports *aContext, nsIAuthInformation *aAuthInfo)
{

Просмотреть файл

@ -8,7 +8,6 @@
#define mozilla_tabs_TabParent_h
#include "js/TypeDecls.h"
#include "LiveResizeListener.h"
#include "mozilla/ContentCache.h"
#include "mozilla/dom/AudioChannelBinding.h"
#include "mozilla/dom/ipc/IdType.h"
@ -92,7 +91,6 @@ class TabParent final : public PBrowserParent
, public TabContext
, public nsAPostRefreshObserver
, public nsIWebBrowserPersistable
, public LiveResizeListener
{
typedef mozilla::dom::ClonedMessageData ClonedMessageData;
@ -595,10 +593,6 @@ public:
mozilla::ipc::IPCResult RecvEnsureLayersConnected() override;
// LiveResizeListener implementation
void LiveResizeStarted() override;
void LiveResizeStopped() override;
protected:
bool ReceiveMessage(const nsString& aMessage,
bool aSync,

Просмотреть файл

@ -3653,20 +3653,24 @@ NSEvent* gLastDragMouseDownEvent = nil;
- (void)viewWillStartLiveResize
{
nsCocoaWindow* windowWidget = mGeckoChild ? mGeckoChild->GetXULWindowWidget() : nullptr;
if (windowWidget) {
windowWidget->NotifyLiveResizeStarted();
nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
if (!observerService) {
return;
}
observerService->NotifyObservers(nullptr, "live-resize-start", nullptr);
}
- (void)viewDidEndLiveResize
{
// If windowWidget is null here then we need to find some other way to
// unsuppress the displayport, or we might get stuck with a content process
// that has the displayport permanently suppressed, which would be bad.
nsCocoaWindow* windowWidget = mGeckoChild ? mGeckoChild->GetXULWindowWidget() : nullptr;
MOZ_ASSERT(windowWidget);
windowWidget->NotifyLiveResizeStopped();
nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
if (!observerService) {
return;
}
observerService->NotifyObservers(nullptr, "live-resize-end", nullptr);
}
- (NSColor*)vibrancyFillColorForThemeGeometryType:(nsITheme::ThemeGeometryType)aThemeGeometryType

Просмотреть файл

@ -12,7 +12,6 @@
#include "mozilla/layers/CompositorBridgeChild.h"
#include "mozilla/layers/CompositorBridgeParent.h"
#include "mozilla/layers/ImageBridgeChild.h"
#include "LiveResizeListener.h"
#include "nsBaseWidget.h"
#include "nsDeviceContext.h"
#include "nsCOMPtr.h"
@ -250,7 +249,6 @@ WidgetShutdownObserver::Unregister()
void
nsBaseWidget::Shutdown()
{
NotifyLiveResizeStopped();
RevokeTransactionIdAllocator();
DestroyCompositor();
FreeShutdownObserver();
@ -2095,41 +2093,6 @@ nsBaseWidget::UpdateSynthesizedTouchState(MultiTouchInput* aState,
return inputToDispatch;
}
void
nsBaseWidget::NotifyLiveResizeStarted()
{
// If we have mLiveResizeListeners already non-empty, we should notify those
// listeners that the resize stopped before starting anew. In theory this
// should never happen because we shouldn't get nested live resize actions.
NotifyLiveResizeStopped();
MOZ_ASSERT(mLiveResizeListeners.IsEmpty());
// If we can get the active tab parent for the current widget, suppress
// the displayport on it during the live resize.
if (!mWidgetListener) {
return;
}
nsCOMPtr<nsIXULWindow> xulWindow = mWidgetListener->GetXULWindow();
if (!xulWindow) {
return;
}
mLiveResizeListeners = xulWindow->GetLiveResizeListeners();
for (uint32_t i = 0; i < mLiveResizeListeners.Length(); i++) {
mLiveResizeListeners[i]->LiveResizeStarted();
}
}
void
nsBaseWidget::NotifyLiveResizeStopped()
{
if (!mLiveResizeListeners.IsEmpty()) {
for (uint32_t i = 0; i < mLiveResizeListeners.Length(); i++) {
mLiveResizeListeners[i]->LiveResizeStopped();
}
mLiveResizeListeners.Clear();
}
}
void
nsBaseWidget::RegisterPluginWindowForRemoteUpdates()
{

Просмотреть файл

@ -37,8 +37,6 @@ class gfxContext;
namespace mozilla {
class CompositorVsyncDispatcher;
class LiveResizeListener;
#ifdef ACCESSIBILITY
namespace a11y {
class Accessible;
@ -400,13 +398,6 @@ public:
uint64_t CreateScrollCaptureContainer() override;
#endif
// These functions should be called at the start and end of a "live" widget
// resize (i.e. when the window contents are repainting during the resize,
// such as when the user drags a window border). It will suppress the
// displayport during the live resize to avoid unneccessary overpainting.
void NotifyLiveResizeStarted();
void NotifyLiveResizeStopped();
protected:
// These are methods for CompositorWidgetWrapper, and should only be
// accessed from that class. Derived widgets can choose which methods to
@ -718,11 +709,6 @@ protected:
mozilla::Maybe<InitialZoomConstraints> mInitialZoomConstraints;
// This points to the resize listeners who have been notified that a live
// resize is in progress. This should always be empty when a live-resize is
// not in progress.
nsTArray<RefPtr<mozilla::LiveResizeListener>> mLiveResizeListeners;
#ifdef DEBUG
protected:
static nsAutoString debug_GuiEventToString(mozilla::WidgetGUIEvent* aGuiEvent);

Просмотреть файл

@ -5644,7 +5644,13 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
// within a ENTERSIZEMOVE to consider this a live resize event.
if (mResizeState == IN_SIZEMOVE) {
mResizeState = RESIZING;
NotifyLiveResizeStarted();
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
if (observerService) {
observerService->NotifyObservers(nullptr, "live-resize-start",
nullptr);
}
}
break;
}
@ -6071,7 +6077,10 @@ void
nsWindow::FinishLiveResizing(ResizeState aNewState)
{
if (mResizeState == RESIZING) {
NotifyLiveResizeStopped();
nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
if (observerService) {
observerService->NotifyObservers(nullptr, "live-resize-end", nullptr);
}
}
mResizeState = aNewState;
ForcePresent();

Просмотреть файл

@ -1,28 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_LiveResizeListener_h
#define mozilla_LiveResizeListener_h
#include "nscore.h"
namespace mozilla {
class LiveResizeListener {
public:
virtual void LiveResizeStarted() = 0;
virtual void LiveResizeStopped() = 0;
NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0;
NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0;
protected:
virtual ~LiveResizeListener() {}
};
} // namespace mozilla
#endif // mozilla_LiveResizeListener_h

Просмотреть файл

@ -19,7 +19,6 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'appshell'
EXPORTS += [
'LiveResizeListener.h',
'nsAppShellCID.h',
]
@ -40,4 +39,4 @@ LOCAL_INCLUDES += [
FINAL_LIBRARY = 'xul'
include('/ipc/chromium/chromium-config.mozbuild')
include('/ipc/chromium/chromium-config.mozbuild')

Просмотреть файл

@ -13,19 +13,12 @@
* notification through the global observer service.
*/
%{C++
#include "LiveResizeListener.h"
#include "nsTArray.h"
%}
interface nsIDocShell;
interface nsIDocShellTreeItem;
interface nsIXULBrowserWindow;
interface nsITabParent;
interface mozIDOMWindowProxy;
native LiveResizeListenerArray(nsTArray<RefPtr<mozilla::LiveResizeListener>>);
[scriptable, uuid(d6d7a014-e28d-4c9d-8727-1cf6d870619b)]
interface nsIXULWindow : nsISupports
{
@ -58,8 +51,6 @@ interface nsIXULWindow : nsISupports
void tabParentAdded(in nsITabParent aTab, in boolean aPrimary);
void tabParentRemoved(in nsITabParent aTab);
[noscript,notxpcom] LiveResizeListenerArray getLiveResizeListeners();
/**
* Tell this window that it has picked up a child XUL window
* @param aChild the child window being added

Просмотреть файл

@ -344,17 +344,6 @@ nsXULWindow::GetPrimaryTabParent(nsITabParent** aTab)
return NS_OK;
}
nsTArray<RefPtr<mozilla::LiveResizeListener>>
nsXULWindow::GetLiveResizeListeners()
{
nsTArray<RefPtr<mozilla::LiveResizeListener>> listeners;
if (mPrimaryTabParent) {
TabParent* parent = static_cast<TabParent*>(mPrimaryTabParent.get());
listeners.AppendElement(parent);
}
return listeners;
}
NS_IMETHODIMP nsXULWindow::AddChildWindow(nsIXULWindow *aChild)
{
// we're not really keeping track of this right now