mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1082554 (part 2) - Remove tools/performance/startup/, which is ancient and unused. r=jmaher.
--HG-- extra : rebase_source : e5236f362fc4829a3586789a85d02b994a80b4e5
This commit is contained in:
parent
d96aa7d2da
commit
edf9e14eb9
@ -1,77 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
# 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/.
|
||||
|
||||
#
|
||||
# Use high resolution routines if installed (on win32 or linux), using
|
||||
# eval as try/catch block around import of modules. Otherwise, just use 'time()'.
|
||||
#
|
||||
# 'Win32::API' <http://www.activestate.com/PPMPackages/zips/5xx-builds-only/Win32-API.zip>
|
||||
# 'Time::HiRes' <http://search.cpan.org/search?dist=Time-HiRes>
|
||||
# (also: http://rpmfind.net/linux/rpm2html/search.php?query=perl-Time-HiRes)
|
||||
#
|
||||
package Time::PossiblyHiRes;
|
||||
|
||||
use strict;
|
||||
|
||||
#use Time::HiRes qw(gettimeofday);
|
||||
|
||||
my $getLocalTime; # for win32
|
||||
my $lpSystemTime = pack("SSSSSSSS"); # for win32
|
||||
my $timesub; # code ref
|
||||
|
||||
# returns 12 char string "'s'x9.'m'x3" which is milliseconds since epoch,
|
||||
# although resolution may vary depending on OS and installed packages
|
||||
|
||||
sub getTime () {
|
||||
|
||||
return &$timesub
|
||||
if $timesub;
|
||||
|
||||
$timesub = sub { time() . "000"; }; # default
|
||||
|
||||
return &$timesub
|
||||
if $^O eq "MacOS"; # don't know a better way on Mac
|
||||
|
||||
if ($^O eq "MSWin32") {
|
||||
eval "use Win32::API;";
|
||||
$timesub = sub {
|
||||
# pass pointer to struct, void return
|
||||
$getLocalTime =
|
||||
eval "new Win32::API('kernel32', 'GetLocalTime', [qw{P}], qw{V});"
|
||||
unless $getLocalTime;
|
||||
$getLocalTime->Call($lpSystemTime);
|
||||
my @t = unpack("SSSSSSSS", $lpSystemTime);
|
||||
sprintf("%9s%03s", time(), pop @t);
|
||||
} if !$@;
|
||||
}
|
||||
|
||||
# ass-u-me if not mac/win32, then we're on a unix flavour
|
||||
else {
|
||||
eval "use Time::HiRes qw(gettimeofday);";
|
||||
$timesub = sub {
|
||||
my @t = gettimeofday();
|
||||
$t[0]*1000 + int($t[1]/1000);
|
||||
} if !$@;
|
||||
}
|
||||
|
||||
return &$timesub;
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#
|
||||
# Test script to compare with low-res time:
|
||||
#
|
||||
# require "gettime.pl";
|
||||
#
|
||||
# use POSIX qw(strftime);
|
||||
#
|
||||
# print "hires time = " . Time::PossiblyHiRes::getTime() . "\n";
|
||||
# print "lowres time = " . time() . "\n";
|
||||
#
|
||||
|
||||
|
||||
# end package
|
||||
1;
|
@ -1,5 +0,0 @@
|
||||
<!-- 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/. -->
|
||||
|
||||
<html><body onLoad="window.close();"></body></html>
|
@ -1,120 +0,0 @@
|
||||
/* -*- indent-tabs-mode: nil -*- */
|
||||
/* 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/. */
|
||||
|
||||
/*
|
||||
From mozilla/toolkit/content
|
||||
These files did not have a license
|
||||
*/
|
||||
|
||||
function quitHook()
|
||||
{
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "http://" + location.host + "/server/shutdown", true);
|
||||
xhr.onreadystatechange = function (event)
|
||||
{
|
||||
if (xhr.readyState == 4)
|
||||
goQuitApplication();
|
||||
};
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
function canQuitApplication()
|
||||
{
|
||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
if (!os)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsPRBool);
|
||||
os.notifyObservers(cancelQuit, "quit-application-requested", null);
|
||||
|
||||
// Something aborted the quit process.
|
||||
if (cancelQuit.data)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (ex)
|
||||
{
|
||||
}
|
||||
os.notifyObservers(null, "quit-application-granted", null);
|
||||
return true;
|
||||
}
|
||||
|
||||
function goQuitApplication()
|
||||
{
|
||||
const privs = 'UniversalXPConnect';
|
||||
|
||||
try
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege(privs);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
throw('goQuitApplication: privilege failure ' + ex);
|
||||
}
|
||||
|
||||
if (!canQuitApplication())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const kAppStartup = '@mozilla.org/toolkit/app-startup;1';
|
||||
const kAppShell = '@mozilla.org/appshell/appShellService;1';
|
||||
var appService;
|
||||
var forceQuit;
|
||||
|
||||
if (kAppStartup in Components.classes)
|
||||
{
|
||||
appService = Components.classes[kAppStartup].
|
||||
getService(Components.interfaces.nsIAppStartup);
|
||||
forceQuit = Components.interfaces.nsIAppStartup.eForceQuit;
|
||||
|
||||
}
|
||||
else if (kAppShell in Components.classes)
|
||||
{
|
||||
appService = Components.classes[kAppShell].
|
||||
getService(Components.interfaces.nsIAppShellService);
|
||||
forceQuit = Components.interfaces.nsIAppShellService.eForceQuit;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw 'goQuitApplication: no AppStartup/appShell';
|
||||
}
|
||||
|
||||
var windowManager = Components.
|
||||
classes['@mozilla.org/appshell/window-mediator;1'].getService();
|
||||
|
||||
var windowManagerInterface = windowManager.
|
||||
QueryInterface(Components.interfaces.nsIWindowMediator);
|
||||
|
||||
var enumerator = windowManagerInterface.getEnumerator(null);
|
||||
|
||||
while (enumerator.hasMoreElements())
|
||||
{
|
||||
var domWindow = enumerator.getNext();
|
||||
if (("tryToClose" in domWindow) && !domWindow.tryToClose())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
domWindow.close();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
appService.quit(forceQuit);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
throw('goQuitApplication: ' + ex);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<!-- 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/. -->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Use JS to quit the browser on Mac OS X</title>
|
||||
<script src="quit.js" type="text/javascript"></script>
|
||||
</head>
|
||||
|
||||
<body onload="goQuitApplication();">
|
||||
<p>This page uses <code>netscape.security.PrivilegeManager</code> JS calls to cleanly and completely exit the browser under Mac OSX.</p>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -1,21 +0,0 @@
|
||||
<!-- 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/. -->
|
||||
|
||||
<!-- Pick off begin time as a cgi argument and print it out -->
|
||||
<html>
|
||||
|
||||
<!-- call this with an arg, e.g. file://foo/startup-test.html?begin=12345678 -->
|
||||
|
||||
<!-- In-line this to avoid compilation. -->
|
||||
<body onload="
|
||||
var now = (new Date()).getTime();
|
||||
var begin = document.location.search.split('=')[1]; // ?begin=nnnnn
|
||||
var startupTime = now - begin;
|
||||
document.write('\n\nStartup time = ' + startupTime + ' ms<br>');
|
||||
if (window.dump) {
|
||||
dump('\n\n__startuptime,' + startupTime + '\n\n');
|
||||
}
|
||||
">
|
||||
</body>
|
||||
</html>
|
@ -1,55 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
# 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/.
|
||||
|
||||
|
||||
#
|
||||
# Script to time mozilla startup.
|
||||
# Feeds in start time as url argument, startup-test.html
|
||||
# takes this arg and computes the time difference.
|
||||
# So something like this happens:
|
||||
#
|
||||
# mozilla file:/foo/startup-test.html?begin=T
|
||||
# where T = ms since 1970, e.g.:
|
||||
# mozilla file:/foo/startup-test.html?begin=999456977124
|
||||
#
|
||||
# NOTE: You will get much better results if you install the
|
||||
# Time::HiRes perl module (urls in gettime.pl) and test
|
||||
# an optimized build.
|
||||
#
|
||||
# For optimized builds, startup-test.html will also dump
|
||||
# the time out to stdout if you set:
|
||||
# user_pref("browser.dom.window.dump.enabled", true);
|
||||
#
|
||||
|
||||
require 5.003;
|
||||
|
||||
require "gettime.pl";
|
||||
|
||||
use strict;
|
||||
use Cwd;
|
||||
|
||||
sub PrintUsage {
|
||||
die <<END_USAGE
|
||||
usage: startup-unix.pl <exe> [<args>]
|
||||
e.g
|
||||
startup-unix.pl ../../../dist/bin/mozilla
|
||||
startup-unix.pl ../../../dist/bin/mozilla -P \"Default User\"
|
||||
END_USAGE
|
||||
}
|
||||
|
||||
{
|
||||
PrintUsage() unless $#ARGV >= 0;
|
||||
# Build up command string.
|
||||
my $cwd = Cwd::getcwd();
|
||||
|
||||
my $cmd = join(' ', map {/\s/ ? qq("$_") : $_} @ARGV);
|
||||
my $time = Time::PossiblyHiRes::getTime();
|
||||
$cmd .= qq( -url "file:$cwd/startup-test.html?begin=$time");
|
||||
print "cmd = $cmd\n";
|
||||
|
||||
# Run the command.
|
||||
exec $cmd;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user