Bug 1550757 - Create new DLL for sharing VR code r=kip

This change introduces a new dll, vrhost, to make it easier to share
VR code across multiple process.
An executable, vrtesthost, is also added for testing purposes to
validate the DLL loads in a minimal environment.

Differential Revision: https://phabricator.services.mozilla.com/D30653

--HG--
extra : moz-landing-system : lando
This commit is contained in:
thomasmo 2019-05-14 18:07:26 +00:00
Родитель 79279249fb
Коммит 67eb9799f5
9 изменённых файлов: 114 добавлений и 20 удалений

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

@ -69,6 +69,13 @@ else:
'service',
]
# Only target x64 for vrhost
if CONFIG['OS_ARCH'] == 'WINNT':
if CONFIG['HAVE_64BIT_BUILD']:
DIRS += [
'vrhost'
]
IPDL_SOURCES = [
'ipc/PVR.ipdl',
'ipc/PVRGPU.ipdl',

22
gfx/vr/vrhost/moz.build Normal file
Просмотреть файл

@ -0,0 +1,22 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
SOURCES += [
'vrhost.cpp'
]
EXPORTS.vrhost = [
'vrhostex.h'
]
DEFFILE = 'vrhost.def'
DIRS += [
'testhost'
]
# Use SharedLibrary to generate the dll
SharedLibrary('vrhost')

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

@ -0,0 +1,16 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
SOURCES += [
'testhost.cpp'
]
USE_LIBS += [
'vrhost'
]
# Use Progam to generate the executable
Program('vrtesthost')

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

@ -0,0 +1,23 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 <windows.h>
#include "vrhost/vrhostex.h"
int main() {
HINSTANCE hVR = ::LoadLibrary("vrhost.dll");
if (hVR != nullptr) {
PFN_SAMPLE lpfnSample = (PFN_SAMPLE)GetProcAddress(hVR, "SampleExport");
if (lpfnSample != nullptr) {
lpfnSample();
}
::FreeLibrary(hVR);
hVR = nullptr;
}
return 0;
}

13
gfx/vr/vrhost/vrhost.cpp Normal file
Просмотреть файл

@ -0,0 +1,13 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
// vrhost.cpp
// Definition of functions that are exported from this dll
#include "vrhostex.h"
#include <stdio.h>
void SampleExport() { printf("vrhost.cpp hello world"); }

7
gfx/vr/vrhost/vrhost.def Normal file
Просмотреть файл

@ -0,0 +1,7 @@
;+# 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/.
LIBRARY vrhost.dll
EXPORTS SampleExport PRIVATE

14
gfx/vr/vrhost/vrhostex.h Normal file
Просмотреть файл

@ -0,0 +1,14 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
// vrhostex.h
// This file declares the functions and their typedefs for functions exported
// by vrhost.dll
#pragma once
// void SampleExport();
typedef void (*PFN_SAMPLE)();

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

@ -3624,10 +3624,9 @@ bool Debugger::findSweepGroupEdges(JSRuntime* rt) {
continue;
}
if (!debuggerZone->addSweepGroupEdgeTo(debuggeeZone) ||
!debuggeeZone->addSweepGroupEdgeTo(debuggerZone)) {
return false;
return false;
}
}
}
@ -8920,8 +8919,7 @@ void ScriptedOnPopHandler::trace(JSTracer* tracer) {
}
bool ScriptedOnPopHandler::onPop(JSContext* cx, HandleDebuggerFrame frame,
ResumeMode& resumeMode,
MutableHandleValue vp,
ResumeMode& resumeMode, MutableHandleValue vp,
HandleSavedFrame exnStack) {
Debugger* dbg = frame->owner();
@ -9392,14 +9390,11 @@ static bool EvaluateInEnv(JSContext* cx, Handle<Env*> env,
return ExecuteKernel(cx, script, *env, NullValue(), frame, rval.address());
}
static bool DebuggerGenericEval(JSContext* cx,
const mozilla::Range<const char16_t> chars,
HandleObject bindings,
const EvalOptions& options,
ResumeMode& resumeMode,
MutableHandleValue value,
MutableHandleSavedFrame exnStack, Debugger* dbg,
HandleObject envArg, FrameIter* iter) {
static bool DebuggerGenericEval(
JSContext* cx, const mozilla::Range<const char16_t> chars,
HandleObject bindings, const EvalOptions& options, ResumeMode& resumeMode,
MutableHandleValue value, MutableHandleSavedFrame exnStack, Debugger* dbg,
HandleObject envArg, FrameIter* iter) {
// Either we're specifying the frame, or a global.
MOZ_ASSERT_IF(iter, !envArg);
MOZ_ASSERT_IF(!iter, envArg && IsGlobalLexicalEnvironment(envArg));

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

@ -1664,14 +1664,11 @@ class DebuggerObject : public NativeObject {
MutableHandleValue result);
static MOZ_MUST_USE bool forceLexicalInitializationByName(
JSContext* cx, HandleDebuggerObject object, HandleId id, bool& result);
static MOZ_MUST_USE bool executeInGlobal(JSContext* cx,
HandleDebuggerObject object,
mozilla::Range<const char16_t> chars,
HandleObject bindings,
const EvalOptions& options,
ResumeMode& resumeMode,
MutableHandleValue value,
MutableHandleSavedFrame exnStack);
static MOZ_MUST_USE bool executeInGlobal(
JSContext* cx, HandleDebuggerObject object,
mozilla::Range<const char16_t> chars, HandleObject bindings,
const EvalOptions& options, ResumeMode& resumeMode,
MutableHandleValue value, MutableHandleSavedFrame exnStack);
static MOZ_MUST_USE bool makeDebuggeeValue(JSContext* cx,
HandleDebuggerObject object,
HandleValue value,