Backed out changeset 70f93c9956fc (bug 1581855) for Windows MinGW build bustages CLOSED TREE

This commit is contained in:
Ciure Andrei 2019-09-26 06:42:46 +03:00
Родитель 2a5148d030
Коммит f4b3bef121
18 изменённых файлов: 32 добавлений и 357 удалений

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

@ -395,13 +395,7 @@ BrowserChild::BrowserChild(ContentChild* aManager, const TabId& aTabId,
mPendingLayersObserverEpoch{0},
mPendingDocShellBlockers(0),
mCancelContentJSEpoch(0),
mWidgetNativeData(0)
#ifdef XP_WIN
,
mWindowSupportsProtectedMedia(true),
mWindowSupportsProtectedMediaChecked(false)
#endif
{
mWidgetNativeData(0) {
mozilla::HoldJSObjects(this);
nsWeakPtr weakPtrThis(do_GetWeakReference(
@ -606,8 +600,7 @@ nsresult BrowserChild::Init(mozIDOMWindowProxy* aParent,
mPuppetWidget->CreateCompositor();
}
#if !defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_THUNDERBIRD) && \
!defined(MOZ_SUITE)
#if !defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_THUNDERBIRD) && !defined(MOZ_SUITE)
mSessionStoreListener = new TabListener(docShell, nullptr);
rv = mSessionStoreListener->Init();
NS_ENSURE_SUCCESS(rv, rv);
@ -3901,27 +3894,6 @@ bool BrowserChild::UpdateSessionStore(uint32_t aFlushId, bool aIsFinal) {
return true;
}
#ifdef XP_WIN
// Cache the response to the IPC call to IsWindowSupportingProtectedMedia,
// since it will not change for the lifetime of this object
void BrowserChild::UpdateIsWindowSupportingProtectedMedia(bool aIsSupported) {
mWindowSupportsProtectedMediaChecked = true;
mWindowSupportsProtectedMedia = aIsSupported;
}
// Reuse the cached response to the IPC call IsWindowSupportingProtectedMedia
// when available
bool BrowserChild::RequiresIsWindowSupportingProtectedMediaCheck(
bool& aIsSupported) {
if (mWindowSupportsProtectedMediaChecked) {
aIsSupported = mWindowSupportsProtectedMedia;
return false;
} else {
return true;
}
}
#endif
BrowserChildMessageManager::BrowserChildMessageManager(
BrowserChild* aBrowserChild)
: ContentFrameMessageManager(new nsFrameMessageManager(aBrowserChild)),

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

@ -663,11 +663,6 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
bool UpdateSessionStore(uint32_t aFlushId, bool aIsFinal = false);
#ifdef XP_WIN
void UpdateIsWindowSupportingProtectedMedia(bool aIsSupported);
bool RequiresIsWindowSupportingProtectedMediaCheck(bool& aIsSupported);
#endif
protected:
virtual ~BrowserChild();
@ -915,11 +910,6 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
Maybe<LayoutDeviceToLayoutDeviceMatrix4x4> mChildToParentConversionMatrix;
ScreenRect mRemoteDocumentRect;
#ifdef XP_WIN
bool mWindowSupportsProtectedMedia;
bool mWindowSupportsProtectedMediaChecked;
#endif
// This state is used to keep track of the current visible tabs (the ones
// rendering layers). There may be more than one if there are multiple browser
// windows open, or tabs are being warmed up. There may be none if this

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

@ -118,7 +118,6 @@
#ifdef XP_WIN
# include "mozilla/plugins/PluginWidgetParent.h"
# include "FxRWindowManager.h"
#endif
#if defined(XP_WIN) && defined(ACCESSIBILITY)
@ -3980,19 +3979,5 @@ void BrowserParent::OnSubFrameCrashed() {
}
}
mozilla::ipc::IPCResult BrowserParent::RecvIsWindowSupportingProtectedMedia(
const uint64_t& aOuterWindowID,
IsWindowSupportingProtectedMediaResolver&& aResolve) {
#ifdef XP_WIN
bool isFxrWindow =
FxRWindowManager::GetInstance()->IsFxRWindow(aOuterWindowID);
aResolve(!isFxrWindow);
#else
MOZ_CRASH("Should only be called on Windows");
#endif
return IPC_OK();
}
} // namespace dom
} // namespace mozilla

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

@ -500,10 +500,6 @@ class BrowserParent final : public PBrowserParent,
const nsString& aRemoteType, BrowsingContext* aBrowsingContext,
const uint32_t& aChromeFlags, const TabId& aTabId) override;
mozilla::ipc::IPCResult RecvIsWindowSupportingProtectedMedia(
const uint64_t& aOuterWindowID,
IsWindowSupportingProtectedMediaResolver&& aResolve);
void LoadURL(nsIURI* aURI);
void ResumeLoad(uint64_t aPendingSwitchID);

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

@ -1031,13 +1031,7 @@ child:
async GetContentBlockingLog() returns(IPCStream ipcStream, bool success);
async SkipBrowsingContextDetach() returns (bool success);
parent:
/**
* Fetches whether this window supports protected media, which is sent back in response.
*/
async IsWindowSupportingProtectedMedia(uint64_t aOuterWindowID) returns(bool isSupported);
/** Records a history visit. */
async VisitURI(URIParams aURI, URIParams? aLastVisitedURI,
uint32_t aFlags);

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

@ -22,7 +22,6 @@
#include "nsIScriptError.h"
#include "mozilla/Unused.h"
#include "nsDataHashtable.h"
#include "mozilla/dom/BrowserChild.h"
namespace mozilla {
namespace dom {
@ -73,51 +72,6 @@ void MediaKeySystemAccessManager::Request(
EME_LOG("MediaKeySystemAccessManager::Request %s",
NS_ConvertUTF16toUTF8(aKeySystem).get());
bool isSupported = true;
#ifdef XP_WIN
// In Windows OS, some Firefox windows that host content cannot support
// protected content, so check the status of support for this window.
RefPtr<BrowserChild> browser(BrowserChild::GetFrom(mWindow));
if (browser->RequiresIsWindowSupportingProtectedMediaCheck(isSupported)) {
int browserID = browser->ChromeOuterWindowID();
RefPtr<MediaKeySystemAccessManager> self(this);
nsString keySystem(aKeySystem);
RefPtr<DetailedPromise> promise(aPromise);
Sequence<MediaKeySystemConfiguration> configs(aConfigs);
browser->SendIsWindowSupportingProtectedMedia(browserID)->Then(
GetCurrentThreadSerialEventTarget(), __func__,
[self, browser, promise, keySystem, configs,
aType](bool isSupportedLambda) {
browser->UpdateIsWindowSupportingProtectedMedia(isSupportedLambda);
self->RequestCallback(isSupportedLambda, promise, keySystem, configs,
aType);
},
[](const mozilla::ipc::ResponseRejectReason) {
MOZ_CRASH(
"Failed to make IPC call to IsWindowSupportingProtectedMedia");
});
} else {
#endif
RequestCallback(isSupported, aPromise, aKeySystem, aConfigs, aType);
#ifdef XP_WIN
}
#endif
}
void MediaKeySystemAccessManager::RequestCallback(
bool aIsSupportedInWindow, DetailedPromise* aPromise,
const nsAString& aKeySystem,
const Sequence<MediaKeySystemConfiguration>& aConfigs, RequestType aType) {
if (!aIsSupportedInWindow) {
aPromise->MaybeReject(
NS_ERROR_DOM_NOT_SUPPORTED_ERR,
NS_LITERAL_CSTRING("EME is not supported in this window"));
return;
}
if (aKeySystem.IsEmpty()) {
aPromise->MaybeRejectWithTypeError(u"Key system string is empty");
// Don't notify DecoderDoctor, as there's nothing we or the user can

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

@ -53,11 +53,6 @@ class MediaKeySystemAccessManager final : public nsIObserver {
const Sequence<MediaKeySystemConfiguration>& aConfig,
RequestType aType);
void RequestCallback(bool aIsSupportedInWindow, DetailedPromise* aPromise,
const nsAString& aKeySystem,
const Sequence<MediaKeySystemConfiguration>& aConfigs,
RequestType aType);
~MediaKeySystemAccessManager();
bool EnsureObserversAdded();

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

@ -23,7 +23,6 @@
#include "TextureD3D11.h"
#include "gfxConfig.h"
#include "mozilla/StaticPrefs_layers.h"
#include "FxROutputHandler.h"
namespace mozilla {
namespace layers {
@ -416,17 +415,6 @@ void MLGSwapChainD3D11::Present() {
// See bug 1260611 comment #28 for why we do this.
mParent->InsertPresentWaitQuery();
if (mWidget->AsWindows()->HasFxrOutputHandler()) {
// There is a Firefox Reality handler for this swapchain. Update this
// window's contents to the VR window.
FxROutputHandler* fxrHandler = mWidget->AsWindows()->GetFxrOutputHandler();
if (fxrHandler->TryInitialize(mSwapChain, mDevice)) {
RefPtr<ID3D11DeviceContext> context;
mDevice->GetImmediateContext(getter_AddRefs(context));
fxrHandler->UpdateOutput(context);
}
}
HRESULT hr;
if (mCanUsePartialPresents && mSwapChain1) {
StackArray<RECT, 4> rects(mBackBufferInvalid.GetNumRects());

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

@ -1,96 +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/. */
#include "FxROutputHandler.h"
#include "mozilla/Assertions.h"
#include "moz_external_vr.h"
#include "VRShMem.h"
// TryInitialize is responsible for associating this output handler with the
// calling window's swapchain for subsequent updates. This also creates a
// texture that can be shared across processes and updates VRShMem with the
// shared texture handle.
// See nsFxrCommandLineHandler::Handle for more information about the
// bootstrap process.
bool FxROutputHandler::TryInitialize(IDXGISwapChain* aSwapChain,
ID3D11Device* aDevice) {
if (mSwapChain == nullptr) {
RefPtr<ID3D11Texture2D> texOrig = nullptr;
HRESULT hr =
aSwapChain->GetBuffer(0, __uuidof(&texOrig), getter_AddRefs(texOrig));
if (hr != S_OK) {
return false;
}
// Create shareable texture, which will be copied to
D3D11_TEXTURE2D_DESC descOrig = {0};
texOrig->GetDesc(&descOrig);
descOrig.MiscFlags |= D3D11_RESOURCE_MISC_SHARED;
hr = aDevice->CreateTexture2D(&descOrig, nullptr,
mTexCopy.StartAssignment());
if (hr != S_OK) {
return false;
}
// Now, share the texture to a handle that can be marshaled to another
// process
HANDLE hCopy = nullptr;
RefPtr<IDXGIResource> texResource;
hr = mTexCopy->QueryInterface(__uuidof(&texResource),
getter_AddRefs(texResource));
if (hr != S_OK) {
return false;
}
hr = texResource->GetSharedHandle(&hCopy);
if (hr != S_OK) {
return false;
}
// The texture is successfully created and shared, so cache a
// pointer to the swapchain to indicate this success.
mSwapChain = aSwapChain;
// Finally, marshal the shared texture handle via VRShMem
mozilla::gfx::VRShMem shmem(nullptr, true /*aRequiresMutex*/);
if (shmem.JoinShMem()) {
mozilla::gfx::VRWindowState windowState = {0};
shmem.PullWindowState(windowState);
// The CLH should have populated hwndFx first
MOZ_ASSERT(windowState.hwndFx != 0);
MOZ_ASSERT(windowState.textureFx == nullptr);
windowState.textureFx = (HANDLE)hCopy;
shmem.PushWindowState(windowState);
shmem.LeaveShMem();
// Notify the waiting host process that the data is now available
HANDLE hSignal = ::OpenEventA(EVENT_ALL_ACCESS, // dwDesiredAccess
FALSE, // bInheritHandle
windowState.signalName // lpName
);
::SetEvent(hSignal);
::CloseHandle(hSignal);
}
} else {
MOZ_ASSERT(aSwapChain == mSwapChain);
}
return mSwapChain != nullptr && aSwapChain == mSwapChain;
}
// Update the contents of the shared texture.
void FxROutputHandler::UpdateOutput(ID3D11DeviceContext* aCtx) {
MOZ_ASSERT(mSwapChain != nullptr);
ID3D11Texture2D* texOrig = nullptr;
HRESULT hr = mSwapChain->GetBuffer(0, IID_PPV_ARGS(&texOrig));
if (hr == S_OK) {
aCtx->CopyResource(mTexCopy, texOrig);
texOrig->Release();
}
}

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

@ -1,30 +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/. */
#pragma once
struct ID3D11Texture2D;
struct IDXGISwapChain;
struct ID3D11DeviceContext;
struct ID3D11Device;
#include <windows.h>
#include <d3d11_1.h>
#include "mozilla/RefPtr.h"
// FxROutputHandler is responsible for managing resources to share a Desktop
// browser window with a Firefox Reality VR window.
// Note: this object is created on the Compositor thread, but its usage should
// only be on the RenderThread.
class FxROutputHandler final {
public:
bool TryInitialize(IDXGISwapChain* aSwapChain, ID3D11Device* aDevice);
void UpdateOutput(ID3D11DeviceContext* aCtx);
private:
RefPtr<IDXGISwapChain> mSwapChain = nullptr;
RefPtr<ID3D11Texture2D> mTexCopy = nullptr;
};

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

@ -1,36 +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/. */
#include "FxRWindowManager.h"
#include "mozilla/Assertions.h"
#include "nsPIDOMWindow.h"
#include "mozilla/ClearOnShutdown.h"
static mozilla::StaticAutoPtr<FxRWindowManager> sFxrWinMgrInstance;
FxRWindowManager* FxRWindowManager::GetInstance() {
if (sFxrWinMgrInstance == nullptr) {
sFxrWinMgrInstance = new FxRWindowManager();
ClearOnShutdown(&sFxrWinMgrInstance);
}
return sFxrWinMgrInstance;
}
FxRWindowManager::FxRWindowManager() : mWindow(nullptr) {}
// Track this new Firefox Reality window instance
void FxRWindowManager::AddWindow(nsPIDOMWindowOuter* aWindow) {
if (mWindow != nullptr) {
MOZ_CRASH("Only one window is supported");
}
mWindow = aWindow;
}
// Returns true if the window at the provided ID was created for Firefox Reality
bool FxRWindowManager::IsFxRWindow(uint64_t aOuterWindowID) {
return (mWindow != nullptr) && (mWindow->WindowID() == aOuterWindowID);
}

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

@ -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/. */
#pragma once
#include <cstdint>
class nsPIDOMWindowOuter;
// FxRWindowManager is a singleton that is responsible for tracking all of
// the top-level windows created for Firefox Reality on Desktop. Only a
// single window is initially supported.
class FxRWindowManager final {
public:
static FxRWindowManager* GetInstance();
void AddWindow(nsPIDOMWindowOuter* aWindow);
bool IsFxRWindow(uint64_t aOuterWindowID);
private:
FxRWindowManager();
// Only a single window is supported for tracking. Support for multiple
// windows will require a data structure to collect windows as they are
// created.
nsPIDOMWindowOuter* mWindow;
};

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

@ -6,8 +6,6 @@
EXPORTS += [
'external_api/moz_external_vr.h',
'FxROutputHandler.h',
'FxRWindowManager.h',
'gfxVR.h',
'ipc/VRChild.h',
'ipc/VRGPUChild.h',
@ -92,12 +90,6 @@ if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['NIGHTLY_BUILD']:
'nsFxrCommandLineHandler.cpp',
]
if CONFIG['OS_ARCH'] == 'WINNT':
SOURCES += [
'FxROutputHandler.cpp',
'FxRWindowManager.cpp'
]
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
CXXFLAGS += CONFIG['TK_CFLAGS']
CFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']

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

@ -9,7 +9,6 @@
#endif
#include "nsFxrCommandLineHandler.h"
#include "FxRWindowManager.h"
#include "nsICommandLine.h"
#include "nsIWindowWatcher.h"
@ -52,12 +51,9 @@ NS_IMPL_ISUPPORTS(nsFxrCommandLineHandler, nsICommandLineHandler)
// | | share texture handle to
// | | VRShMem and set signal
// CreateVRWindow returns | |
// to host with relevant | |
// return data from VRShMem | |
// | Fx continues to run |
// | | Fx continues to render
// to host | |
// | | |
// ... ... ...
//
NS_IMETHODIMP
nsFxrCommandLineHandler::Handle(nsICommandLine* aCmdLine) {
@ -81,9 +77,6 @@ nsFxrCommandLineHandler::Handle(nsICommandLine* aCmdLine) {
MOZ_ASSERT(result == NS_OK);
nsPIDOMWindowOuter* newWindowOuter = nsPIDOMWindowOuter::From(newWindow);
FxRWindowManager::GetInstance()->AddWindow(newWindowOuter);
// Send the window's HWND to vrhost through VRShMem
mozilla::gfx::VRShMem shmem(nullptr, true /*aRequiresMutex*/);
if (shmem.JoinShMem()) {
@ -91,7 +84,8 @@ nsFxrCommandLineHandler::Handle(nsICommandLine* aCmdLine) {
shmem.PullWindowState(windowState);
nsCOMPtr<nsIWidget> newWidget =
mozilla::widget::WidgetUtils::DOMWindowToWidget(newWindowOuter);
mozilla::widget::WidgetUtils::DOMWindowToWidget(
nsPIDOMWindowOuter::From(newWindow));
HWND hwndWidget = (HWND)newWidget->GetNativeData(NS_NATIVE_WINDOW);
// The CLH should populate these members first
@ -106,9 +100,7 @@ nsFxrCommandLineHandler::Handle(nsICommandLine* aCmdLine) {
// after output data is set in VRShMem
newWidget->RequestFxrOutput();
} else {
#ifndef NIGHTLY_BUILD
MOZ_CRASH("failed to start with --fxr");
#endif
}
}

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

@ -19,7 +19,6 @@
#include "mozilla/widget/CompositorWidget.h"
#include "mozilla/widget/WinCompositorWidget.h"
#include "mozilla/WindowsVersion.h"
#include "FxROutputHandler.h"
#undef NTDDI_VERSION
#define NTDDI_VERSION NTDDI_WIN8
@ -337,15 +336,6 @@ bool RenderCompositorANGLE::BeginFrame(layers::NativeLayer* aNativeLayer) {
void RenderCompositorANGLE::EndFrame() {
InsertPresentWaitQuery();
if (mWidget->AsWindows()->HasFxrOutputHandler()) {
// There is a Firefox Reality handler for this swapchain. Update this
// window's contents to the VR window.
FxROutputHandler* fxrHandler = mWidget->AsWindows()->GetFxrOutputHandler();
if (fxrHandler->TryInitialize(mSwapChain, mDevice)) {
fxrHandler->UpdateOutput(mCtx);
}
}
mSwapChain->Present(0, 0);
}

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

@ -338,12 +338,33 @@ void WinCompositorWidget::UpdateCompositorWndSizeIfNecessary() {
mLastCompositorWndSize = size;
}
// Creates a new instance of FxROutputHandler so that this compositor widget
// can send its output to Firefox Reality for Desktop.
// TODO: Bug 1570128 - Forward request to swapchain
// For now, this simply validates that data can be passed to Firefox Reality
// host from the GPU process
void WinCompositorWidget::RequestFxrOutput() {
MOZ_ASSERT(mFxrHandler == nullptr);
mozilla::gfx::VRShMem shmem(nullptr, true /*aRequiresMutex*/);
if (shmem.JoinShMem()) {
mozilla::gfx::VRWindowState windowState = {0};
shmem.PullWindowState(windowState);
mFxrHandler.reset(new FxROutputHandler());
// The CLH should have populated hwndFx first
MOZ_ASSERT(windowState.hwndFx != 0);
MOZ_ASSERT(windowState.textureFx == nullptr);
windowState.textureFx = (HANDLE)0xFFFFFFFF;
shmem.PushWindowState(windowState);
shmem.LeaveShMem();
// Notify the waiting host process that the data is now available
HANDLE hSignal = ::OpenEventA(EVENT_ALL_ACCESS, // dwDesiredAccess
FALSE, // bInheritHandle
windowState.signalName // lpName
);
::SetEvent(hSignal);
::CloseHandle(hSignal);
}
}
} // namespace widget

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

@ -12,7 +12,6 @@
#include "mozilla/gfx/Point.h"
#include "mozilla/Mutex.h"
#include "mozilla/widget/WinCompositorWindowThread.h"
#include "FxROutputHandler.h"
#include "nsIWidget.h"
class nsWindow;
@ -106,8 +105,6 @@ class WinCompositorWidget : public CompositorWidget,
}
void RequestFxrOutput();
bool HasFxrOutputHandler() const { return mFxrHandler != nullptr; }
FxROutputHandler* GetFxrOutputHandler() const { return mFxrHandler.get(); }
protected:
private:
@ -136,8 +133,6 @@ class WinCompositorWidget : public CompositorWidget,
uint8_t* mLockedBackBufferData;
bool mNotDeferEndRemoteDrawing;
UniquePtr<FxROutputHandler> mFxrHandler;
};
} // namespace widget

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

@ -422,6 +422,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel) {
// call for RequesetFxrOutput as soon as the compositor for this widget is
// available.
void nsWindow::CreateCompositor() {
// there's no super??
nsWindowBase::CreateCompositor();
if (mRequestFxrOutputPending) {