Bug 845571 - Turn on console debug logging when running in Metro. r=jimm

This commit is contained in:
Brian R. Bondy 2013-02-28 16:10:17 -05:00
Родитель 7f46d4198e
Коммит dcff5c97c5
5 изменённых файлов: 50 добавлений и 35 удалений

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

@ -27,6 +27,7 @@
#include "gfxCrashReporterUtils.h"
#ifdef MOZ_METRO
#include "DXGI1_2.h"
#include "nsWindowsHelpers.h"
#endif
using namespace std;
@ -216,7 +217,7 @@ LayerManagerD3D10::Initialize(bool force)
dxgiDevice->GetAdapter(getter_AddRefs(dxgiAdapter));
#ifdef MOZ_METRO
if (gfxWindowsPlatform::IsRunningInWindows8Metro()) {
if (IsRunningInWindowsMetro()) {
nsRefPtr<IDXGIFactory2> dxgiFactory;
dxgiAdapter->GetParent(IID_PPV_ARGS(dxgiFactory.StartAssignment()));
@ -654,10 +655,12 @@ LayerManagerD3D10::VerifyBufferSize()
mSwapChain->ResizeBuffers(1, rect.width, rect.height,
DXGI_FORMAT_B8G8R8A8_UNORM,
0);
} else if (gfxWindowsPlatform::IsRunningInWindows8Metro()) {
#ifdef MOZ_METRO
} else if (IsRunningInWindowsMetro()) {
mSwapChain->ResizeBuffers(2, rect.width, rect.height,
DXGI_FORMAT_B8G8R8A8_UNORM,
0);
#endif
} else {
mSwapChain->ResizeBuffers(1, rect.width, rect.height,
DXGI_FORMAT_B8G8R8A8_UNORM,

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

@ -36,6 +36,9 @@
#endif
#include "gfxUserFontSet.h"
#ifdef MOZ_METRO
#include "nsWindowsHelpers.h"
#endif
#include <string>
@ -393,36 +396,6 @@ gfxWindowsPlatform::~gfxWindowsPlatform()
CoUninitialize();
}
/* static */ bool
gfxWindowsPlatform::IsRunningInWindows8Metro()
{
static bool alreadyChecked = false;
static bool isMetro = false;
if (alreadyChecked) {
return isMetro;
}
HMODULE user32DLL = LoadLibraryW(L"user32.dll");
if (!user32DLL) {
return false;
}
typedef BOOL (WINAPI* IsImmersiveProcessFunc)(HANDLE process);
IsImmersiveProcessFunc IsImmersiveProcessPtr =
(IsImmersiveProcessFunc)GetProcAddress(user32DLL,
"IsImmersiveProcess");
FreeLibrary(user32DLL);
if (!IsImmersiveProcessPtr) {
// isMetro is already set to false.
alreadyChecked = true;
return false;
}
isMetro = IsImmersiveProcessPtr(GetCurrentProcess());
alreadyChecked = true;
return isMetro;
}
void
gfxWindowsPlatform::UpdateRenderMode()
{
@ -461,8 +434,10 @@ gfxWindowsPlatform::UpdateRenderMode()
d2dDisabled = Preferences::GetBool("gfx.direct2d.disabled", false);
d2dForceEnabled = Preferences::GetBool("gfx.direct2d.force-enabled", false);
#ifdef MOZ_METRO
// In Metro mode there is no fallback available
d2dForceEnabled |= IsRunningInWindows8Metro();
d2dForceEnabled |= IsRunningInWindowsMetro();
#endif
bool tryD2D = !d2dBlocked || d2dForceEnabled;

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

@ -240,7 +240,6 @@ public:
#endif
static bool IsOptimus();
static bool IsRunningInWindows8Metro();
protected:
RenderMode mRenderMode;

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

@ -41,6 +41,9 @@
#if defined(XP_WIN)
#include <tchar.h>
#include "nsString.h"
#ifdef MOZ_METRO
#include "nsWindowsHelpers.h"
#endif
#endif
#if defined(XP_MACOSX)
@ -214,7 +217,12 @@ static nsAssertBehavior GetAssertBehavior()
if (gAssertBehavior != NS_ASSERT_UNINITIALIZED)
return gAssertBehavior;
#if defined(XP_WIN) || defined(XP_OS2)
#if defined(XP_WIN) && defined(MOZ_METRO)
if (IsRunningInWindowsMetro())
gAssertBehavior = NS_ASSERT_WARN;
else
gAssertBehavior = NS_ASSERT_TRAP;
#elif defined(XP_WIN) || defined(XP_OS2)
gAssertBehavior = NS_ASSERT_TRAP;
#else
gAssertBehavior = NS_ASSERT_WARN;

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

@ -94,6 +94,36 @@ namespace
GetVersionEx(&info);
return info.dwMajorVersion >= 6;
}
bool
IsRunningInWindowsMetro()
{
static bool alreadyChecked = false;
static bool isMetro = false;
if (alreadyChecked) {
return isMetro;
}
HMODULE user32DLL = LoadLibraryW(L"user32.dll");
if (!user32DLL) {
return false;
}
typedef BOOL (WINAPI* IsImmersiveProcessFunc)(HANDLE process);
IsImmersiveProcessFunc IsImmersiveProcessPtr =
(IsImmersiveProcessFunc)GetProcAddress(user32DLL,
"IsImmersiveProcess");
FreeLibrary(user32DLL);
if (!IsImmersiveProcessPtr) {
// isMetro is already set to false.
alreadyChecked = true;
return false;
}
isMetro = IsImmersiveProcessPtr(GetCurrentProcess());
alreadyChecked = true;
return isMetro;
}
}
#endif