static void StartAllowingD3D9(nsITimer *aTimer, void *aClosure) { if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Desktop) { nsWindow::StartAllowingD3D9(true); } }
void nsToolkit::StartAllowingD3D9() { if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Desktop) { nsToolkit::GetToolkit()->mD3D9Timer->Cancel(); nsWindow::StartAllowingD3D9(false); } }
/* static */ bool WinUtils::ShouldHideScrollbars() { #ifdef MOZ_METRO if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) { return widget::winrt::MetroInput::IsInputModeImprecise(); } #endif // MOZ_METRO return false; }
/* static */ double WinUtils::LogToPhysFactor() { // dpi / 96.0 if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) { #ifdef MOZ_METRO return MetroUtils::LogToPhysFactor(); #else return 1.0; #endif } else { HDC hdc = ::GetDC(nullptr); double result = ::GetDeviceCaps(hdc, LOGPIXELSY) / 96.0; ::ReleaseDC(nullptr, hdc); return result; } }
//------------------------------------------------------------------------- // // constructor // //------------------------------------------------------------------------- nsToolkit::nsToolkit() { MOZ_COUNT_CTOR(nsToolkit); #if defined(MOZ_STATIC_COMPONENT_LIBS) nsToolkit::Startup(GetModuleHandle(NULL)); #endif gMouseTrailer = &mMouseTrailer; if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Desktop) { mD3D9Timer = do_CreateInstance("@mozilla.org/timer;1"); mD3D9Timer->InitWithFuncCallback(::StartAllowingD3D9, NULL, kD3DUsageDelay, nsITimer::TYPE_ONE_SHOT); } }
void mozilla_sampler_init(void* stackTop) { sInitCount++; if (stack_key_initialized) return; LOG("BEGIN mozilla_sampler_init"); if (!tlsPseudoStack.init() || !tlsTicker.init() || !tlsStackTop.init()) { LOG("Failed to init."); return; } stack_key_initialized = true; Sampler::Startup(); PseudoStack *stack = new PseudoStack(); tlsPseudoStack.set(stack); bool isMainThread = true; #ifdef XP_WIN // For metrofx, we'll register the main thread once it's created. isMainThread = !(XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro); #endif Sampler::RegisterCurrentThread(isMainThread ? gGeckoThreadName : "Application Thread", stack, isMainThread, stackTop); // Read mode settings from MOZ_PROFILER_MODE and interval // settings from MOZ_PROFILER_INTERVAL and stack-scan threshhold // from MOZ_PROFILER_STACK_SCAN. read_profiler_env_vars(); // Allow the profiler to be started using signals OS::RegisterStartHandler(); // Initialize I/O interposing mozilla::IOInterposer::Init(); // Initialize NSPR I/O Interposing mozilla::InitNSPRIOInterposing(); // We can't open pref so we use an environment variable // to know if we should trigger the profiler on startup // NOTE: Default const char *val = PR_GetEnv("MOZ_PROFILER_STARTUP"); if (!val || !*val) { return; } const char* features[] = {"js" , "leaf" #if defined(XP_WIN) || defined(XP_MACOSX) || (defined(SPS_ARCH_arm) && defined(linux)) , "stackwalk" #endif #if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK) , "java" #endif }; profiler_start(PROFILE_DEFAULT_ENTRY, PROFILE_DEFAULT_INTERVAL, features, sizeof(features)/sizeof(const char*), // TODO Add env variable to select threads nullptr, 0); LOG("END mozilla_sampler_init"); }