mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge inbound to m-c.
This commit is contained in:
commit
d8a98c147e
@ -14,6 +14,7 @@ support-files = head.js
|
||||
[browser_toolbox_options_disablejs.js]
|
||||
[browser_toolbox_options_disablejs_iframe.html]
|
||||
[browser_toolbox_raise.js]
|
||||
skip-if = os == "win"
|
||||
[browser_toolbox_ready.js]
|
||||
[browser_toolbox_select_event.js]
|
||||
[browser_toolbox_sidebar.js]
|
||||
|
@ -392,6 +392,22 @@ TestRunner.expectChildProcessCrash = function() {
|
||||
TestRunner._expectingProcessCrash = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Statistics that we want to retrieve and display after every test is
|
||||
* done. The keys of this table are intended to be identical to the
|
||||
* relevant attributes of nsIMemoryReporterManager. However, since
|
||||
* nsIMemoryReporterManager doesn't necessarily support all these
|
||||
* statistics in all build configurations, we also use this table to
|
||||
* tell us whether statistics are supported or not.
|
||||
*/
|
||||
var MEM_STAT_UNKNOWN = 0;
|
||||
var MEM_STAT_UNSUPPORTED = 1;
|
||||
var MEM_STAT_SUPPORTED = 2;
|
||||
TestRunner._hasMemoryStatistics = {}
|
||||
TestRunner._hasMemoryStatistics.vsize = MEM_STAT_UNKNOWN;
|
||||
TestRunner._hasMemoryStatistics.heapAllocated = MEM_STAT_UNKNOWN;
|
||||
TestRunner._hasMemoryStatistics.largestContiguousVMBlock = MEM_STAT_UNKNOWN;
|
||||
|
||||
/**
|
||||
* This stub is called by SimpleTest when a test is finished.
|
||||
**/
|
||||
@ -409,6 +425,34 @@ TestRunner.testFinished = function(tests) {
|
||||
TestRunner._lastTestFinished = TestRunner._currentTest;
|
||||
TestRunner._loopIsRestarting = false;
|
||||
|
||||
var mrm;
|
||||
try {
|
||||
mrm = Cc["@mozilla.org/memory-reporter-manager;1"]
|
||||
.getService(Ci.nsIMemoryReporterManager);
|
||||
} catch (e) {
|
||||
mrm = SpecialPowers.Cc["@mozilla.org/memory-reporter-manager;1"]
|
||||
.getService(SpecialPowers.Ci.nsIMemoryReporterManager);
|
||||
}
|
||||
for (stat in TestRunner._hasMemoryStatistics) {
|
||||
var supported = TestRunner._hasMemoryStatistics[stat];
|
||||
var firstAccess = false;
|
||||
if (supported == MEM_STAT_UNKNOWN) {
|
||||
firstAccess = true;
|
||||
try {
|
||||
var value = mrm[stat];
|
||||
supported = MEM_STAT_SUPPORTED;
|
||||
} catch (e) {
|
||||
supported = MEM_STAT_UNSUPPORTED;
|
||||
}
|
||||
TestRunner._hasMemoryStatistics[stat] = supported;
|
||||
}
|
||||
if (supported == MEM_STAT_SUPPORTED) {
|
||||
TestRunner.log("TEST-INFO | MEMORY STAT " + stat + " after test: " + mrm[stat]);
|
||||
} else if (firstAccess) {
|
||||
TestRunner.log("TEST-INFO | MEMORY STAT " + stat + " not supported in this build configuration.");
|
||||
}
|
||||
}
|
||||
|
||||
function cleanUpCrashDumpFiles() {
|
||||
if (!SpecialPowers.removeExpectedCrashDumpFiles(TestRunner._expectingProcessCrash)) {
|
||||
TestRunner.error("TEST-UNEXPECTED-FAIL | " +
|
||||
|
@ -7,6 +7,16 @@
|
||||
-->
|
||||
<script>
|
||||
window.addEventListener("load", function() {
|
||||
(parent.TestRunner || parent.wrappedJSObject.TestRunner).testUnloaded();
|
||||
var runner = (parent.TestRunner || parent.wrappedJSObject.TestRunner);
|
||||
runner.testUnloaded();
|
||||
|
||||
if (SpecialPowers) {
|
||||
if (!runner.garbageCollectCount) {
|
||||
runner.garbageCollectCount = 0;
|
||||
}
|
||||
if (runner.garbageCollectCount++ % 10 == 0) {
|
||||
SpecialPowers.DOMWindowUtils.garbageCollect();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
@ -185,7 +185,7 @@ interface nsIFinishReportingCallback : nsISupports
|
||||
void callback(in nsISupports data);
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(a1292276-726b-4ef5-a017-5a455d6664dd)]
|
||||
[scriptable, builtinclass, uuid(2596fa26-495a-4827-a5f5-e34e7f4dd7b5)]
|
||||
interface nsIMemoryReporterManager : nsISupports
|
||||
{
|
||||
/*
|
||||
@ -300,6 +300,10 @@ interface nsIMemoryReporterManager : nsISupports
|
||||
*
|
||||
* |pageFaultsHard| (UNITS_COUNT_CUMULATIVE) The number of hard (a.k.a.
|
||||
* major) page faults that have occurred since the process started.
|
||||
*
|
||||
* |largestContiguousVMBlock| (UNITS_BYTES) The size of the largest
|
||||
* contiguous block of virtual memory. Only available on Windows; on all
|
||||
* other platforms, reading this value returns 0.
|
||||
*/
|
||||
readonly attribute int64_t explicit;
|
||||
readonly attribute int64_t vsize;
|
||||
@ -325,6 +329,8 @@ interface nsIMemoryReporterManager : nsISupports
|
||||
|
||||
readonly attribute int64_t pageFaultsHard;
|
||||
|
||||
readonly attribute int64_t largestContiguousVMBlock;
|
||||
|
||||
/*
|
||||
* This attribute indicates if moz_malloc_usable_size() works.
|
||||
*/
|
||||
|
@ -337,6 +337,7 @@ static nsresult GetResident(int64_t* aN)
|
||||
|
||||
#include <windows.h>
|
||||
#include <psapi.h>
|
||||
#include <algorithm>
|
||||
|
||||
#define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1
|
||||
static nsresult GetVsize(int64_t* aN)
|
||||
@ -370,6 +371,34 @@ static nsresult GetResidentFast(int64_t* aN)
|
||||
return GetResident(aN);
|
||||
}
|
||||
|
||||
#define HAVE_LARGEST_CONTIGUOUS_BLOCK_REPORTERS 1
|
||||
static nsresult LargestContiguousVMBlock(int64_t* aN)
|
||||
{
|
||||
SIZE_T biggestRegion = 0;
|
||||
MEMORY_BASIC_INFORMATION vmemInfo = {0};
|
||||
for (size_t currentAddress = 0; ; ) {
|
||||
if (!VirtualQuery((LPCVOID)currentAddress, &vmemInfo, sizeof(vmemInfo))) {
|
||||
// Something went wrong, just return whatever we've got already.
|
||||
break;
|
||||
}
|
||||
|
||||
if (vmemInfo.State == MEM_FREE) {
|
||||
biggestRegion = std::max(biggestRegion, vmemInfo.RegionSize);
|
||||
}
|
||||
|
||||
SIZE_T lastAddress = currentAddress;
|
||||
currentAddress += vmemInfo.RegionSize;
|
||||
|
||||
// If we overflow, we've examined all of the address space.
|
||||
if (currentAddress < lastAddress) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*aN = biggestRegion;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#define HAVE_PRIVATE_REPORTER
|
||||
class PrivateReporter MOZ_FINAL : public MemoryUniReporter
|
||||
{
|
||||
@ -1382,6 +1411,17 @@ nsMemoryReporterManager::GetPageFaultsHard(int64_t* aAmount)
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMemoryReporterManager::GetLargestContiguousVMBlock(int64_t* aAmount)
|
||||
{
|
||||
#ifdef HAVE_LARGEST_CONTIGUOUS_BLOCK_REPORTERS
|
||||
return LargestContiguousVMBlock(aAmount);
|
||||
#else
|
||||
*aAmount = 0;
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMemoryReporterManager::GetHasMozMallocUsableSize(bool* aHas)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user