Merge inbound and m-c. IGNORE BAD COMMIT MESSAGES

This commit is contained in:
Ryan VanderMeulen 2013-06-25 17:02:45 -04:00
Родитель 3a1ceb6c1f 67599314dd
Коммит d13c9361a4
300 изменённых файлов: 2025 добавлений и 1523 удалений

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

@ -830,6 +830,10 @@ already_AddRefed<nsFrameSelection>
XULTextFieldAccessible::FrameSelection() XULTextFieldAccessible::FrameSelection()
{ {
nsCOMPtr<nsIContent> inputContent(GetInputField()); nsCOMPtr<nsIContent> inputContent(GetInputField());
NS_ASSERTION(inputContent, "No input content");
if (!inputContent)
return nullptr;
nsIFrame* frame = inputContent->GetPrimaryFrame(); nsIFrame* frame = inputContent->GetPrimaryFrame();
return frame ? frame->GetFrameSelection() : nullptr; return frame ? frame->GetFrameSelection() : nullptr;
} }

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

@ -632,7 +632,7 @@ pref("plugins.hide_infobar_for_outdated_plugin", false);
pref("plugins.update.url", "https://www.mozilla.org/%LOCALE%/plugincheck/"); pref("plugins.update.url", "https://www.mozilla.org/%LOCALE%/plugincheck/");
pref("plugins.update.notifyUser", false); pref("plugins.update.notifyUser", false);
pref("plugins.click_to_play", false); pref("plugins.click_to_play", true);
// display door hanger if flash not installed // display door hanger if flash not installed
pref("plugins.notifyMissingFlash", true); pref("plugins.notifyMissingFlash", true);

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

@ -48,6 +48,14 @@ function test() {
function installListener(next, aManifest) { function installListener(next, aManifest) {
let expectEvent = "onInstalling"; let expectEvent = "onInstalling";
let prefname = getManifestPrefname(aManifest); let prefname = getManifestPrefname(aManifest);
// wait for the actual removal to call next
SocialService.registerProviderListener(function providerListener(topic, data) {
if (topic == "provider-removed") {
SocialService.unregisterProviderListener(providerListener);
executeSoon(next);
}
});
return { return {
onInstalling: function(addon) { onInstalling: function(addon) {
is(expectEvent, "onInstalling", "install started"); is(expectEvent, "onInstalling", "install started");
@ -73,7 +81,6 @@ function installListener(next, aManifest) {
is(addon.manifest.origin, aManifest.origin, "provider uninstalled"); is(addon.manifest.origin, aManifest.origin, "provider uninstalled");
ok(!Services.prefs.prefHasUserValue(prefname), "manifest is not in user-prefs"); ok(!Services.prefs.prefHasUserValue(prefname), "manifest is not in user-prefs");
AddonManager.removeAddonListener(this); AddonManager.removeAddonListener(this);
next();
} }
}; };
} }

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

@ -55,17 +55,18 @@ var tests = {
setAndUpdateBlocklist(blocklistURL, function() { setAndUpdateBlocklist(blocklistURL, function() {
try { try {
SocialService.addProvider(manifest, function(provider) { SocialService.addProvider(manifest, function(provider) {
if (provider) { try {
SocialService.removeProvider(provider.origin, function() { SocialService.removeProvider(provider.origin, function() {
ok(true, "added and removed provider"); ok(true, "added and removed provider");
finish(true); finish(true);
}); });
} else { } catch(e) {
ok(false, "SocialService.removeProvider threw exception: " + e);
finish(false); finish(false);
} }
}); });
} catch(e) { } catch(e) {
dump(e+" - "+e.stack+"\n"); ok(false, "SocialService.addProvider threw exception: " + e);
finish(false); finish(false);
} }
}); });
@ -80,15 +81,11 @@ var tests = {
setAndUpdateBlocklist(blocklistURL, function() { setAndUpdateBlocklist(blocklistURL, function() {
try { try {
SocialService.addProvider(manifest_bad, function(provider) { SocialService.addProvider(manifest_bad, function(provider) {
if (provider) { ok(false, "SocialService.addProvider should throw blocklist exception");
SocialService.removeProvider(provider.origin, function() { finish(false);
finish(false);
});
} else {
finish(true);
}
}); });
} catch(e) { } catch(e) {
ok(true, "SocialService.addProvider should throw blocklist exception");
finish(true); finish(true);
} }
}); });

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

@ -149,6 +149,7 @@ function runSocialTestWithProvider(manifest, callback, finishcallback) {
function runSocialTests(tests, cbPreTest, cbPostTest, cbFinish) { function runSocialTests(tests, cbPreTest, cbPostTest, cbFinish) {
let testIter = Iterator(tests); let testIter = Iterator(tests);
let providersAtStart = Social.providers.length; let providersAtStart = Social.providers.length;
info("runSocialTests: start test run with " + providersAtStart + " providers");
if (cbPreTest === undefined) { if (cbPreTest === undefined) {
cbPreTest = function(cb) {cb()}; cbPreTest = function(cb) {cb()};
@ -164,6 +165,7 @@ function runSocialTests(tests, cbPreTest, cbPostTest, cbFinish) {
} catch (err if err instanceof StopIteration) { } catch (err if err instanceof StopIteration) {
// out of items: // out of items:
(cbFinish || defaultFinishChecks)(); (cbFinish || defaultFinishChecks)();
info("runSocialTests: finish test run with " + Social.providers.length + " providers");
return; return;
} }
// We run on a timeout as the frameworker also makes use of timeouts, so // We run on a timeout as the frameworker also makes use of timeouts, so
@ -174,7 +176,7 @@ function runSocialTests(tests, cbPreTest, cbPostTest, cbFinish) {
cbPostTest(runNextTest); cbPostTest(runNextTest);
} }
cbPreTest(function() { cbPreTest(function() {
is(providersAtStart, Social.providers.length, "no new providers left enabled"); is(providersAtStart, Social.providers.length, "pre-test: no new providers left enabled");
info("sub-test " + name + " starting"); info("sub-test " + name + " starting");
try { try {
func.call(tests, cleanupAndRunNextTest); func.call(tests, cleanupAndRunNextTest);

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

@ -321,17 +321,6 @@ let PermissionDefaults = {
Services.prefs.setBoolPref("dom.disable_open_during_load", value); Services.prefs.setBoolPref("dom.disable_open_during_load", value);
}, },
get plugins() {
if (Services.prefs.getBoolPref("plugins.click_to_play")) {
return this.UNKNOWN;
}
return this.ALLOW;
},
set plugins(aValue) {
let value = (aValue != this.ALLOW);
Services.prefs.setBoolPref("plugins.click_to_play", value);
},
get fullscreen() { get fullscreen() {
if (!Services.prefs.getBoolPref("full-screen-api.enabled")) { if (!Services.prefs.getBoolPref("full-screen-api.enabled")) {
return this.DENY; return this.DENY;
@ -380,7 +369,7 @@ let AboutPermissions = {
* *
* Potential future additions: "sts/use", "sts/subd" * Potential future additions: "sts/use", "sts/subd"
*/ */
_supportedPermissions: ["password", "cookie", "geo", "indexedDB", "popup", "plugins", "fullscreen"], _supportedPermissions: ["password", "cookie", "geo", "indexedDB", "popup", "fullscreen"],
/** /**
* Permissions that don't have a global "Allow" option. * Permissions that don't have a global "Allow" option.
@ -390,7 +379,7 @@ let AboutPermissions = {
/** /**
* Permissions that don't have a global "Deny" option. * Permissions that don't have a global "Deny" option.
*/ */
_noGlobalDeny: ["plugins"], _noGlobalDeny: [],
_stringBundle: Services.strings. _stringBundle: Services.strings.
createBundle("chrome://browser/locale/preferences/aboutPermissions.properties"), createBundle("chrome://browser/locale/preferences/aboutPermissions.properties"),
@ -412,7 +401,6 @@ let AboutPermissions = {
Services.prefs.addObserver("geo.enabled", this, false); Services.prefs.addObserver("geo.enabled", this, false);
Services.prefs.addObserver("dom.indexedDB.enabled", this, false); Services.prefs.addObserver("dom.indexedDB.enabled", this, false);
Services.prefs.addObserver("dom.disable_open_during_load", this, false); Services.prefs.addObserver("dom.disable_open_during_load", this, false);
Services.prefs.addObserver("plugins.click_to_play", this, false);
Services.prefs.addObserver("full-screen-api.enabled", this, false); Services.prefs.addObserver("full-screen-api.enabled", this, false);
Services.obs.addObserver(this, "perm-changed", false); Services.obs.addObserver(this, "perm-changed", false);
@ -434,7 +422,6 @@ let AboutPermissions = {
Services.prefs.removeObserver("geo.enabled", this, false); Services.prefs.removeObserver("geo.enabled", this, false);
Services.prefs.removeObserver("dom.indexedDB.enabled", this, false); Services.prefs.removeObserver("dom.indexedDB.enabled", this, false);
Services.prefs.removeObserver("dom.disable_open_during_load", this, false); Services.prefs.removeObserver("dom.disable_open_during_load", this, false);
Services.prefs.removeObserver("plugins.click_to_play", this, false);
Services.prefs.removeObserver("full-screen-api.enabled", this, false); Services.prefs.removeObserver("full-screen-api.enabled", this, false);
Services.obs.removeObserver(this, "perm-changed"); Services.obs.removeObserver(this, "perm-changed");
@ -758,18 +745,11 @@ let AboutPermissions = {
if (!this._selectedSite) { if (!this._selectedSite) {
// If there is no selected site, we are updating the default permissions interface. // If there is no selected site, we are updating the default permissions interface.
permissionValue = PermissionDefaults[aType]; permissionValue = PermissionDefaults[aType];
if (aType == "plugins") if (aType == "cookie")
document.getElementById("plugins-pref-item").hidden = false;
else if (aType == "cookie")
// cookie-9 corresponds to ALLOW_FIRST_PARTY_ONLY, which is reserved // cookie-9 corresponds to ALLOW_FIRST_PARTY_ONLY, which is reserved
// for site-specific preferences only. // for site-specific preferences only.
document.getElementById("cookie-9").hidden = true; document.getElementById("cookie-9").hidden = true;
} else { } else {
if (aType == "plugins") {
document.getElementById("plugins-pref-item").hidden =
!Services.prefs.getBoolPref("plugins.click_to_play");
return;
}
if (aType == "cookie") if (aType == "cookie")
document.getElementById("cookie-9").hidden = false; document.getElementById("cookie-9").hidden = false;
let result = {}; let result = {};

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

@ -191,27 +191,6 @@
</vbox> </vbox>
</hbox> </hbox>
<!-- Opt-in activation of Plug-ins -->
<hbox id="plugins-pref-item"
class="pref-item" align="top">
<image class="pref-icon" type="plugins"/>
<vbox>
<label class="pref-title" value="&plugins.label;"/>
<hbox>
<menulist id="plugins-menulist"
class="pref-menulist"
type="plugins"
oncommand="AboutPermissions.onPermissionCommand(event);">
<menupopup>
<menuitem id="plugins-0" value="0" label="&permission.alwaysAsk;"/>
<menuitem id="plugins-1" value="1" label="&permission.allow;"/>
<menuitem id="plugins-2" value="2" label="&permission.block;"/>
</menupopup>
</menulist>
</hbox>
</vbox>
</hbox>
<!-- Fullscreen --> <!-- Fullscreen -->
<hbox id="fullscreen-pref-item" <hbox id="fullscreen-pref-item"
class="pref-item" align="top"> class="pref-item" align="top">

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

@ -26,7 +26,6 @@ const TEST_PERMS = {
"geo": PERM_UNKNOWN, "geo": PERM_UNKNOWN,
"indexedDB": PERM_UNKNOWN, "indexedDB": PERM_UNKNOWN,
"popup": PERM_DENY, "popup": PERM_DENY,
"plugins" : PERM_ALLOW,
"fullscreen" : PERM_UNKNOWN, "fullscreen" : PERM_UNKNOWN,
}; };
@ -37,7 +36,7 @@ const NO_GLOBAL_ALLOW = [
]; ];
// number of managed permissions in the interface // number of managed permissions in the interface
const TEST_PERMS_COUNT = 7; const TEST_PERMS_COUNT = 6;
function test() { function test() {
waitForExplicitFinish(); waitForExplicitFinish();

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

@ -113,7 +113,7 @@ crashedpluginsMessage.submitButton.accesskey=S
crashedpluginsMessage.learnMore=Learn More… crashedpluginsMessage.learnMore=Learn More…
## Plugin doorhanger strings ## Plugin doorhanger strings
# LOCALIZATION NOTE (pluginActivateNw.message): Used for newly-installed # LOCALIZATION NOTE (pluginActivateNew.message): Used for newly-installed
# plugins which are not known to be unsafe. %1$S is the plugin name and %2$S # plugins which are not known to be unsafe. %1$S is the plugin name and %2$S
# is the site domain. # is the site domain.
pluginActivateNew.message=Allow %2$S to run "%1$S"? pluginActivateNew.message=Allow %2$S to run "%1$S"?
@ -160,7 +160,7 @@ pluginContinue.accesskey=C
# in-page UI # in-page UI
PluginClickToActivate=Activate %S. PluginClickToActivate=Activate %S.
PluginVulnerableUpdatable=Thus plugin is vulnerable and should be updated. PluginVulnerableUpdatable=This plugin is vulnerable and should be updated.
PluginVulnerableNoUpdate=This plugin has security vulnerabilities. PluginVulnerableNoUpdate=This plugin has security vulnerabilities.
# Sanitize # Sanitize

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

@ -1,69 +1,69 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public <!-- 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 - 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/. --> - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<?xml-stylesheet href="chrome://browser/skin/platform.css" type="text/css"?> <?xml-stylesheet href="chrome://browser/skin/platform.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/skin/browser.css" type="text/css"?> <?xml-stylesheet href="chrome://browser/skin/browser.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?> <?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>
<!DOCTYPE window []> <!DOCTYPE window []>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<vbox flex="1"> <vbox flex="1">
<hbox> <hbox>
<richgrid id="grid1" seltype="single" flex="1"> <richgrid id="grid1" seltype="single" flex="1">
<richgriditem value="about:blank" id="grid1_item1" label="First item"/> <richgriditem value="about:blank" id="grid1_item1" label="First item"/>
</richgrid> </richgrid>
</hbox> </hbox>
<hbox> <hbox>
<richgrid id="emptygrid" seltype="single" flex="1"/> <richgrid id="emptygrid" seltype="single" flex="1"/>
</hbox> </hbox>
<hbox> <hbox>
<richgrid id="grid2" seltype="single" flex="1"> <richgrid id="grid2" seltype="single" flex="1">
<richgriditem value="about:blank" id="grid2_item1" label="First item"/> <richgriditem value="about:blank" id="grid2_item1" label="First item"/>
<richgriditem value="about:blank" id="grid2_item2" label="2nd item"/> <richgriditem value="about:blank" id="grid2_item2" label="2nd item"/>
</richgrid> </richgrid>
</hbox> </hbox>
<hbox> <hbox>
<richgrid id="grid3" seltype="single" flex="1"> <richgrid id="grid3" seltype="single" flex="1">
<richgriditem value="about:blank" id="grid3_item1" label="First item"/> <richgriditem value="about:blank" id="grid3_item1" label="First item"/>
<richgriditem value="about:blank" id="grid3_item2" label="2nd item"/> <richgriditem value="about:blank" id="grid3_item2" label="2nd item"/>
</richgrid> </richgrid>
</hbox> </hbox>
<hbox> <hbox>
<richgrid id="grid4" seltype="single" flex="1"> <richgrid id="grid4" seltype="single" flex="1">
<richgriditem value="about:blank" id="grid4_item1" label="First item"/> <richgriditem value="about:blank" id="grid4_item1" label="First item"/>
<richgriditem value="about:blank" id="grid4_item2" label="2nd item"/> <richgriditem value="about:blank" id="grid4_item2" label="2nd item"/>
</richgrid> </richgrid>
</hbox> </hbox>
<hbox> <hbox>
<richgrid id="grid5" seltype="single" flex="1"> <richgrid id="grid5" seltype="single" flex="1">
<richgriditem value="about:blank" id="grid5_item1" label="First item"/> <richgriditem value="about:blank" id="grid5_item1" label="First item"/>
<richgriditem value="http://bugzilla.mozilla.org/" id="grid5_item2" label="2nd item"/> <richgriditem value="http://bugzilla.mozilla.org/" id="grid5_item2" label="2nd item"/>
<richgriditem value="about:blank" id="grid5_item3" label="3rd item"/> <richgriditem value="about:blank" id="grid5_item3" label="3rd item"/>
<richgriditem value="http://bugzilla.mozilla.org/" id="grid5_item4" label="4th item"/> <richgriditem value="http://bugzilla.mozilla.org/" id="grid5_item4" label="4th item"/>
</richgrid> </richgrid>
</hbox> </hbox>
<hbox> <hbox>
<richgrid id="grid6" seltype="single" flex="1"> <richgrid id="grid6" seltype="single" flex="1">
<richgriditem value="about:blank" id="grid6_item1" label="First item"/> <richgriditem value="about:blank" id="grid6_item1" label="First item"/>
</richgrid> </richgrid>
</hbox> </hbox>
<hbox> <hbox>
<richgrid id="grid-select1" seltype="single" flex="1"> <richgrid id="grid-select1" seltype="single" flex="1">
<richgriditem value="about:blank" id="grid-select1_item1" label="First item"/> <richgriditem value="about:blank" id="grid-select1_item1" label="First item"/>
<richgriditem value="about:blank" id="grid-select1_item2" label="2nd item"/> <richgriditem value="about:blank" id="grid-select1_item2" label="2nd item"/>
</richgrid> </richgrid>
</hbox> </hbox>
<hbox> <hbox>
<richgrid id="grid-select2" seltype="multiple" flex="1"> <richgrid id="grid-select2" seltype="multiple" flex="1">
<richgriditem value="about:blank" id="grid-select2_item1" label="First item"/> <richgriditem value="about:blank" id="grid-select2_item1" label="First item"/>
<richgriditem value="about:blank" id="grid-select2_item2" label="2nd item"/> <richgriditem value="about:blank" id="grid-select2_item2" label="2nd item"/>
</richgrid> </richgrid>
</hbox> </hbox>
</vbox> </vbox>
</window> </window>

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

@ -1,349 +1,349 @@
let doc; let doc;
function test() { function test() {
waitForExplicitFinish(); waitForExplicitFinish();
Task.spawn(function(){ Task.spawn(function(){
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
info(chromeRoot + "browser_tilegrid.xul"); info(chromeRoot + "browser_tilegrid.xul");
yield addTab(chromeRoot + "browser_tilegrid.xul"); yield addTab(chromeRoot + "browser_tilegrid.xul");
doc = Browser.selectedTab.browser.contentWindow.document; doc = Browser.selectedTab.browser.contentWindow.document;
}).then(runTests); }).then(runTests);
} }
gTests.push({ gTests.push({
desc: "richgrid binding is applied", desc: "richgrid binding is applied",
run: function() { run: function() {
ok(doc, "doc got defined"); ok(doc, "doc got defined");
let grid = doc.querySelector("#grid1"); let grid = doc.querySelector("#grid1");
ok(grid, "#grid1 is found"); ok(grid, "#grid1 is found");
is(typeof grid.clearSelection, "function", "#grid1 has the binding applied"); is(typeof grid.clearSelection, "function", "#grid1 has the binding applied");
is(grid.children.length, 1, "#grid1 has a single item"); is(grid.children.length, 1, "#grid1 has a single item");
is(grid.children[0].control, grid, "#grid1 item's control points back at #grid1'"); is(grid.children[0].control, grid, "#grid1 item's control points back at #grid1'");
} }
}); });
gTests.push({ gTests.push({
desc: "item clicks are handled", desc: "item clicks are handled",
run: function() { run: function() {
let grid = doc.querySelector("#grid1"); let grid = doc.querySelector("#grid1");
is(typeof grid.handleItemClick, "function", "grid.handleItemClick is a function"); is(typeof grid.handleItemClick, "function", "grid.handleItemClick is a function");
let handleStub = stubMethod(grid, 'handleItemClick'); let handleStub = stubMethod(grid, 'handleItemClick');
let itemId = "grid1_item1"; // grid.children[0].getAttribute("id"); let itemId = "grid1_item1"; // grid.children[0].getAttribute("id");
// send click to item and wait for next tick; // send click to item and wait for next tick;
EventUtils.sendMouseEvent({type: 'click'}, itemId, doc.defaultView); EventUtils.sendMouseEvent({type: 'click'}, itemId, doc.defaultView);
yield waitForMs(0); yield waitForMs(0);
is(handleStub.callCount, 1, "handleItemClick was called when we clicked an item"); is(handleStub.callCount, 1, "handleItemClick was called when we clicked an item");
handleStub.restore(); handleStub.restore();
// if the grid has a controller, it should be called too // if the grid has a controller, it should be called too
let gridController = { let gridController = {
handleItemClick: function() {} handleItemClick: function() {}
}; };
let controllerHandleStub = stubMethod(gridController, "handleItemClick"); let controllerHandleStub = stubMethod(gridController, "handleItemClick");
let origController = grid.controller; let origController = grid.controller;
grid.controller = gridController; grid.controller = gridController;
// send click to item and wait for next tick; // send click to item and wait for next tick;
EventUtils.sendMouseEvent({type: 'click'}, itemId, doc.defaultView); EventUtils.sendMouseEvent({type: 'click'}, itemId, doc.defaultView);
yield waitForMs(0); yield waitForMs(0);
is(controllerHandleStub.callCount, 1, "controller.handleItemClick was called when we clicked an item"); is(controllerHandleStub.callCount, 1, "controller.handleItemClick was called when we clicked an item");
is(controllerHandleStub.calledWith[0], doc.getElementById(itemId), "controller.handleItemClick was passed the grid item"); is(controllerHandleStub.calledWith[0], doc.getElementById(itemId), "controller.handleItemClick was passed the grid item");
grid.controller = origController; grid.controller = origController;
} }
}); });
gTests.push({ gTests.push({
desc: "arrangeItems", desc: "arrangeItems",
run: function() { run: function() {
// implements an arrangeItems method, with optional cols, rows signature // implements an arrangeItems method, with optional cols, rows signature
let grid = doc.querySelector("#grid1"); let grid = doc.querySelector("#grid1");
is(typeof grid.arrangeItems, "function", "arrangeItems is a function on the grid"); is(typeof grid.arrangeItems, "function", "arrangeItems is a function on the grid");
todo(false, "Test outcome of arrangeItems with cols and rows arguments"); todo(false, "Test outcome of arrangeItems with cols and rows arguments");
} }
}); });
gTests.push({ gTests.push({
desc: "appendItem", desc: "appendItem",
run: function() { run: function() {
// implements an appendItem with signature title, uri, returns item element // implements an appendItem with signature title, uri, returns item element
// appendItem triggers arrangeItems // appendItem triggers arrangeItems
let grid = doc.querySelector("#emptygrid"); let grid = doc.querySelector("#emptygrid");
is(grid.itemCount, 0, "0 itemCount when empty"); is(grid.itemCount, 0, "0 itemCount when empty");
is(grid.children.length, 0, "0 children when empty"); is(grid.children.length, 0, "0 children when empty");
is(typeof grid.appendItem, "function", "appendItem is a function on the grid"); is(typeof grid.appendItem, "function", "appendItem is a function on the grid");
let arrangeStub = stubMethod(grid, "arrangeItems"); let arrangeStub = stubMethod(grid, "arrangeItems");
let newItem = grid.appendItem("test title", "about:blank"); let newItem = grid.appendItem("test title", "about:blank");
ok(newItem && grid.children[0]==newItem, "appendItem gives back the item"); ok(newItem && grid.children[0]==newItem, "appendItem gives back the item");
is(grid.itemCount, 1, "itemCount is incremented when we appendItem"); is(grid.itemCount, 1, "itemCount is incremented when we appendItem");
is(newItem.getAttribute("label"), "test title", "title ends up on label attribute"); is(newItem.getAttribute("label"), "test title", "title ends up on label attribute");
is(newItem.getAttribute("value"), "about:blank", "url ends up on value attribute"); is(newItem.getAttribute("value"), "about:blank", "url ends up on value attribute");
is(arrangeStub.callCount, 1, "arrangeItems is called when we appendItem"); is(arrangeStub.callCount, 1, "arrangeItems is called when we appendItem");
arrangeStub.restore(); arrangeStub.restore();
} }
}); });
gTests.push({ gTests.push({
desc: "getItemAtIndex", desc: "getItemAtIndex",
run: function() { run: function() {
// implements a getItemAtIndex method // implements a getItemAtIndex method
let grid = doc.querySelector("#grid2"); let grid = doc.querySelector("#grid2");
is(typeof grid.getItemAtIndex, "function", "getItemAtIndex is a function on the grid"); is(typeof grid.getItemAtIndex, "function", "getItemAtIndex is a function on the grid");
is(grid.getItemAtIndex(0).getAttribute("id"), "grid2_item1", "getItemAtIndex retrieves the first item"); is(grid.getItemAtIndex(0).getAttribute("id"), "grid2_item1", "getItemAtIndex retrieves the first item");
is(grid.getItemAtIndex(1).getAttribute("id"), "grid2_item2", "getItemAtIndex item at index 2"); is(grid.getItemAtIndex(1).getAttribute("id"), "grid2_item2", "getItemAtIndex item at index 2");
ok(!grid.getItemAtIndex(5), "getItemAtIndex out-of-bounds index returns falsy"); ok(!grid.getItemAtIndex(5), "getItemAtIndex out-of-bounds index returns falsy");
} }
}); });
gTests.push({ gTests.push({
desc: "removeItemAt", desc: "removeItemAt",
run: function() { run: function() {
// implements a removeItemAt method, with 'index' signature // implements a removeItemAt method, with 'index' signature
// removeItemAt triggers arrangeItems // removeItemAt triggers arrangeItems
let grid = doc.querySelector("#grid2"); let grid = doc.querySelector("#grid2");
is(grid.itemCount, 2, "2 items initially"); is(grid.itemCount, 2, "2 items initially");
is(typeof grid.removeItemAt, "function", "removeItemAt is a function on the grid"); is(typeof grid.removeItemAt, "function", "removeItemAt is a function on the grid");
let arrangeStub = stubMethod(grid, "arrangeItems"); let arrangeStub = stubMethod(grid, "arrangeItems");
let removedItem = grid.removeItemAt(0); let removedItem = grid.removeItemAt(0);
ok(removedItem, "removeItemAt gives back an item"); ok(removedItem, "removeItemAt gives back an item");
is(removedItem.getAttribute("id"), "grid2_item1", "removeItemAt gives back the correct item"); is(removedItem.getAttribute("id"), "grid2_item1", "removeItemAt gives back the correct item");
is(grid.children[0].getAttribute("id"), "grid2_item2", "2nd item becomes the first item"); is(grid.children[0].getAttribute("id"), "grid2_item2", "2nd item becomes the first item");
is(grid.itemCount, 1, "itemCount is decremented when we removeItemAt"); is(grid.itemCount, 1, "itemCount is decremented when we removeItemAt");
is(arrangeStub.callCount, 1, "arrangeItems is called when we removeItemAt"); is(arrangeStub.callCount, 1, "arrangeItems is called when we removeItemAt");
arrangeStub.restore(); arrangeStub.restore();
} }
}); });
gTests.push({ gTests.push({
desc: "insertItemAt", desc: "insertItemAt",
run: function() { run: function() {
// implements an insertItemAt method, with index, title, uri.spec signature // implements an insertItemAt method, with index, title, uri.spec signature
// insertItemAt triggers arrangeItems // insertItemAt triggers arrangeItems
let grid = doc.querySelector("#grid3"); let grid = doc.querySelector("#grid3");
is(grid.itemCount, 2, "2 items initially"); is(grid.itemCount, 2, "2 items initially");
is(typeof grid.insertItemAt, "function", "insertItemAt is a function on the grid"); is(typeof grid.insertItemAt, "function", "insertItemAt is a function on the grid");
let arrangeStub = stubMethod(grid, "arrangeItems"); let arrangeStub = stubMethod(grid, "arrangeItems");
let insertedItem = grid.insertItemAt(1, "inserted item", "http://example.com/inserted"); let insertedItem = grid.insertItemAt(1, "inserted item", "http://example.com/inserted");
ok(insertedItem, "insertItemAt gives back an item"); ok(insertedItem, "insertItemAt gives back an item");
is(grid.children[1], insertedItem, "item is inserted at the correct index"); is(grid.children[1], insertedItem, "item is inserted at the correct index");
is(insertedItem.getAttribute("label"), "inserted item", "insertItemAt creates item with the correct label"); is(insertedItem.getAttribute("label"), "inserted item", "insertItemAt creates item with the correct label");
is(insertedItem.getAttribute("value"), "http://example.com/inserted", "insertItemAt creates item with the correct url value"); is(insertedItem.getAttribute("value"), "http://example.com/inserted", "insertItemAt creates item with the correct url value");
is(grid.children[2].getAttribute("id"), "grid3_item2", "following item ends up at the correct index"); is(grid.children[2].getAttribute("id"), "grid3_item2", "following item ends up at the correct index");
is(grid.itemCount, 3, "itemCount is incremented when we insertItemAt"); is(grid.itemCount, 3, "itemCount is incremented when we insertItemAt");
is(arrangeStub.callCount, 1, "arrangeItems is called when we insertItemAt"); is(arrangeStub.callCount, 1, "arrangeItems is called when we insertItemAt");
arrangeStub.restore(); arrangeStub.restore();
} }
}); });
gTests.push({ gTests.push({
desc: "getIndexOfItem", desc: "getIndexOfItem",
run: function() { run: function() {
// implements a getIndexOfItem method, with item (element) signature // implements a getIndexOfItem method, with item (element) signature
// insertItemAt triggers arrangeItems // insertItemAt triggers arrangeItems
let grid = doc.querySelector("#grid4"); let grid = doc.querySelector("#grid4");
is(grid.itemCount, 2, "2 items initially"); is(grid.itemCount, 2, "2 items initially");
is(typeof grid.getIndexOfItem, "function", "getIndexOfItem is a function on the grid"); is(typeof grid.getIndexOfItem, "function", "getIndexOfItem is a function on the grid");
let item = doc.getElementById("grid4_item2"); let item = doc.getElementById("grid4_item2");
let badItem = doc.createElement("richgriditem"); let badItem = doc.createElement("richgriditem");
is(grid.getIndexOfItem(item), 1, "getIndexOfItem returns the correct value for an item"); is(grid.getIndexOfItem(item), 1, "getIndexOfItem returns the correct value for an item");
is(grid.getIndexOfItem(badItem), -1, "getIndexOfItem returns -1 for items it doesn't contain"); is(grid.getIndexOfItem(badItem), -1, "getIndexOfItem returns -1 for items it doesn't contain");
} }
}); });
gTests.push({ gTests.push({
desc: "getItemsByUrl", desc: "getItemsByUrl",
run: function() { run: function() {
let grid = doc.querySelector("#grid5"); let grid = doc.querySelector("#grid5");
is(grid.itemCount, 4, "4 items total"); is(grid.itemCount, 4, "4 items total");
is(typeof grid.getItemsByUrl, "function", "getItemsByUrl is a function on the grid"); is(typeof grid.getItemsByUrl, "function", "getItemsByUrl is a function on the grid");
['about:blank', 'http://bugzilla.mozilla.org/'].forEach(function(testUrl) { ['about:blank', 'http://bugzilla.mozilla.org/'].forEach(function(testUrl) {
let items = grid.getItemsByUrl(testUrl); let items = grid.getItemsByUrl(testUrl);
is(items.length, 2, "2 matching items in the test grid"); is(items.length, 2, "2 matching items in the test grid");
is(items.item(0).url, testUrl, "Matched item has correct url property"); is(items.item(0).url, testUrl, "Matched item has correct url property");
is(items.item(1).url, testUrl, "Matched item has correct url property"); is(items.item(1).url, testUrl, "Matched item has correct url property");
}); });
let badUrl = 'http://gopher.well.com:70/'; let badUrl = 'http://gopher.well.com:70/';
let items = grid.getItemsByUrl(badUrl); let items = grid.getItemsByUrl(badUrl);
is(items.length, 0, "0 items matched url: "+badUrl); is(items.length, 0, "0 items matched url: "+badUrl);
} }
}); });
gTests.push({ gTests.push({
desc: "removeItem", desc: "removeItem",
run: function() { run: function() {
let grid = doc.querySelector("#grid5"); let grid = doc.querySelector("#grid5");
is(grid.itemCount, 4, "4 items total"); is(grid.itemCount, 4, "4 items total");
is(typeof grid.removeItem, "function", "removeItem is a function on the grid"); is(typeof grid.removeItem, "function", "removeItem is a function on the grid");
let arrangeStub = stubMethod(grid, "arrangeItems"); let arrangeStub = stubMethod(grid, "arrangeItems");
let removedFirst = grid.removeItem( grid.children[0] ); let removedFirst = grid.removeItem( grid.children[0] );
is(arrangeStub.callCount, 1, "arrangeItems is called when we removeItem"); is(arrangeStub.callCount, 1, "arrangeItems is called when we removeItem");
let removed2nd = grid.removeItem( grid.children[0], true); let removed2nd = grid.removeItem( grid.children[0], true);
is(removed2nd.getAttribute("label"), "2nd item", "the next item was returned"); is(removed2nd.getAttribute("label"), "2nd item", "the next item was returned");
is(grid.itemCount, 2, "2 items remain"); is(grid.itemCount, 2, "2 items remain");
// callCount should still be at 1 // callCount should still be at 1
is(arrangeStub.callCount, 1, "arrangeItems is not called when we pass the truthy skipArrange param"); is(arrangeStub.callCount, 1, "arrangeItems is not called when we pass the truthy skipArrange param");
let otherItem = grid.ownerDocument.querySelector("#grid6_item1"); let otherItem = grid.ownerDocument.querySelector("#grid6_item1");
let removedFail = grid.removeItem(otherItem); let removedFail = grid.removeItem(otherItem);
ok(!removedFail, "Falsy value returned when non-child item passed"); ok(!removedFail, "Falsy value returned when non-child item passed");
is(grid.itemCount, 2, "2 items remain"); is(grid.itemCount, 2, "2 items remain");
// callCount should still be at 1 // callCount should still be at 1
is(arrangeStub.callCount, 1, "arrangeItems is not called when nothing is matched"); is(arrangeStub.callCount, 1, "arrangeItems is not called when nothing is matched");
arrangeStub.restore(); arrangeStub.restore();
} }
}); });
gTests.push({ gTests.push({
desc: "selections (single)", desc: "selections (single)",
run: function() { run: function() {
// when seltype is single, // when seltype is single,
// maintains a selectedItem property // maintains a selectedItem property
// maintains a selectedIndex property // maintains a selectedIndex property
// clearSelection, selectItem, toggleItemSelection methods are implemented // clearSelection, selectItem, toggleItemSelection methods are implemented
// 'select' events are implemented // 'select' events are implemented
let grid = doc.querySelector("#grid-select1"); let grid = doc.querySelector("#grid-select1");
is(typeof grid.clearSelection, "function", "clearSelection is a function on the grid"); is(typeof grid.clearSelection, "function", "clearSelection is a function on the grid");
is(typeof grid.selectedItems, "object", "selectedItems is a property on the grid"); is(typeof grid.selectedItems, "object", "selectedItems is a property on the grid");
is(typeof grid.toggleItemSelection, "function", "toggleItemSelection is function on the grid"); is(typeof grid.toggleItemSelection, "function", "toggleItemSelection is function on the grid");
is(typeof grid.selectItem, "function", "selectItem is a function on the grid"); is(typeof grid.selectItem, "function", "selectItem is a function on the grid");
is(grid.itemCount, 2, "2 items initially"); is(grid.itemCount, 2, "2 items initially");
is(grid.selectedItems.length, 0, "nothing selected initially"); is(grid.selectedItems.length, 0, "nothing selected initially");
grid.toggleItemSelection(grid.children[1]); grid.toggleItemSelection(grid.children[1]);
ok(grid.children[1].selected, "toggleItemSelection sets truthy selected prop on previously-unselected item"); ok(grid.children[1].selected, "toggleItemSelection sets truthy selected prop on previously-unselected item");
is(grid.selectedIndex, 1, "selectedIndex is correct"); is(grid.selectedIndex, 1, "selectedIndex is correct");
grid.toggleItemSelection(grid.children[1]); grid.toggleItemSelection(grid.children[1]);
ok(!grid.children[1].selected, "toggleItemSelection sets falsy selected prop on previously-selected item"); ok(!grid.children[1].selected, "toggleItemSelection sets falsy selected prop on previously-selected item");
is(grid.selectedIndex, -1, "selectedIndex reports correctly with nothing selected"); is(grid.selectedIndex, -1, "selectedIndex reports correctly with nothing selected");
// item selection // item selection
grid.selectItem(grid.children[1]); grid.selectItem(grid.children[1]);
ok(grid.children[1].selected, "Item selected property is truthy after grid.selectItem"); ok(grid.children[1].selected, "Item selected property is truthy after grid.selectItem");
ok(grid.children[1].getAttribute("selected"), "Item selected attribute is truthy after grid.selectItem"); ok(grid.children[1].getAttribute("selected"), "Item selected attribute is truthy after grid.selectItem");
ok(grid.selectedItems.length, "There are selectedItems after grid.selectItem"); ok(grid.selectedItems.length, "There are selectedItems after grid.selectItem");
// clearSelection // clearSelection
grid.selectItem(grid.children[0]); grid.selectItem(grid.children[0]);
grid.selectItem(grid.children[1]); grid.selectItem(grid.children[1]);
grid.clearSelection(); grid.clearSelection();
is(grid.selectedItems.length, 0, "Nothing selected when we clearSelection"); is(grid.selectedItems.length, 0, "Nothing selected when we clearSelection");
is(grid.selectedIndex, -1, "selectedIndex resets after clearSelection"); is(grid.selectedIndex, -1, "selectedIndex resets after clearSelection");
// select events // select events
// in seltype=single mode, select is like the default action for the tile // in seltype=single mode, select is like the default action for the tile
// (think <a>, not <select multiple>) // (think <a>, not <select multiple>)
let handler = { let handler = {
handleEvent: function(aEvent) {} handleEvent: function(aEvent) {}
}; };
let handlerStub = stubMethod(handler, "handleEvent"); let handlerStub = stubMethod(handler, "handleEvent");
doc.defaultView.addEventListener("select", handler, false); doc.defaultView.addEventListener("select", handler, false);
info("select listener added"); info("select listener added");
info("calling selectItem, currently it is:" + grid.children[0].selected); info("calling selectItem, currently it is:" + grid.children[0].selected);
// Note: A richgrid in seltype=single mode fires "select" events from selectItem // Note: A richgrid in seltype=single mode fires "select" events from selectItem
grid.selectItem(grid.children[0]); grid.selectItem(grid.children[0]);
info("calling selectItem, now it is:" + grid.children[0].selected); info("calling selectItem, now it is:" + grid.children[0].selected);
yield waitForMs(0); yield waitForMs(0);
is(handlerStub.callCount, 1, "select event handler was called when we selected an item"); is(handlerStub.callCount, 1, "select event handler was called when we selected an item");
is(handlerStub.calledWith[0].type, "select", "handler got a select event"); is(handlerStub.calledWith[0].type, "select", "handler got a select event");
is(handlerStub.calledWith[0].target, grid, "select event had the originating grid as the target"); is(handlerStub.calledWith[0].target, grid, "select event had the originating grid as the target");
handlerStub.restore(); handlerStub.restore();
doc.defaultView.removeEventListener("select", handler, false); doc.defaultView.removeEventListener("select", handler, false);
} }
}); });
gTests.push({ gTests.push({
desc: "selections (multiple)", desc: "selections (multiple)",
run: function() { run: function() {
// when seltype is multiple, // when seltype is multiple,
// maintains a selectedItems property // maintains a selectedItems property
// clearSelection, selectItem, toggleItemSelection methods are implemented // clearSelection, selectItem, toggleItemSelection methods are implemented
// 'selectionchange' events are implemented // 'selectionchange' events are implemented
let grid = doc.querySelector("#grid-select2"); let grid = doc.querySelector("#grid-select2");
is(typeof grid.clearSelection, "function", "clearSelection is a function on the grid"); is(typeof grid.clearSelection, "function", "clearSelection is a function on the grid");
is(typeof grid.selectedItems, "object", "selectedItems is a property on the grid"); is(typeof grid.selectedItems, "object", "selectedItems is a property on the grid");
is(typeof grid.toggleItemSelection, "function", "toggleItemSelection is function on the grid"); is(typeof grid.toggleItemSelection, "function", "toggleItemSelection is function on the grid");
is(typeof grid.selectItem, "function", "selectItem is a function on the grid"); is(typeof grid.selectItem, "function", "selectItem is a function on the grid");
is(grid.itemCount, 2, "2 items initially"); is(grid.itemCount, 2, "2 items initially");
is(grid.selectedItems.length, 0, "nothing selected initially"); is(grid.selectedItems.length, 0, "nothing selected initially");
grid.toggleItemSelection(grid.children[1]); grid.toggleItemSelection(grid.children[1]);
ok(grid.children[1].selected, "toggleItemSelection sets truthy selected prop on previously-unselected item"); ok(grid.children[1].selected, "toggleItemSelection sets truthy selected prop on previously-unselected item");
is(grid.selectedItems.length, 1, "1 item selected when we first toggleItemSelection"); is(grid.selectedItems.length, 1, "1 item selected when we first toggleItemSelection");
is(grid.selectedItems[0], grid.children[1], "the right item is selected"); is(grid.selectedItems[0], grid.children[1], "the right item is selected");
is(grid.selectedIndex, 1, "selectedIndex is correct"); is(grid.selectedIndex, 1, "selectedIndex is correct");
grid.toggleItemSelection(grid.children[1]); grid.toggleItemSelection(grid.children[1]);
is(grid.selectedItems.length, 0, "Nothing selected when we toggleItemSelection again"); is(grid.selectedItems.length, 0, "Nothing selected when we toggleItemSelection again");
// clearSelection // clearSelection
grid.children[0].selected=true; grid.children[0].selected=true;
grid.children[1].selected=true; grid.children[1].selected=true;
is(grid.selectedItems.length, 2, "Both items are selected before calling clearSelection"); is(grid.selectedItems.length, 2, "Both items are selected before calling clearSelection");
grid.clearSelection(); grid.clearSelection();
is(grid.selectedItems.length, 0, "Nothing selected when we clearSelection"); is(grid.selectedItems.length, 0, "Nothing selected when we clearSelection");
ok(!(grid.children[0].selected || grid.children[1].selected), "selected properties all falsy when we clearSelection"); ok(!(grid.children[0].selected || grid.children[1].selected), "selected properties all falsy when we clearSelection");
// selectionchange events // selectionchange events
// in seltype=multiple mode, we track selected state on all items // in seltype=multiple mode, we track selected state on all items
// (think <select multiple> not <a>) // (think <select multiple> not <a>)
let handler = { let handler = {
handleEvent: function(aEvent) {} handleEvent: function(aEvent) {}
}; };
let handlerStub = stubMethod(handler, "handleEvent"); let handlerStub = stubMethod(handler, "handleEvent");
doc.defaultView.addEventListener("selectionchange", handler, false); doc.defaultView.addEventListener("selectionchange", handler, false);
info("selectionchange listener added"); info("selectionchange listener added");
info("calling toggleItemSelection, currently it is:" + grid.children[0].selected); info("calling toggleItemSelection, currently it is:" + grid.children[0].selected);
// Note: A richgrid in seltype=single mode fires "select" events from selectItem // Note: A richgrid in seltype=single mode fires "select" events from selectItem
grid.toggleItemSelection(grid.children[0]); grid.toggleItemSelection(grid.children[0]);
info("/calling toggleItemSelection, now it is:" + grid.children[0].selected); info("/calling toggleItemSelection, now it is:" + grid.children[0].selected);
yield waitForMs(0); yield waitForMs(0);
is(handlerStub.callCount, 1, "selectionchange event handler was called when we selected an item"); is(handlerStub.callCount, 1, "selectionchange event handler was called when we selected an item");
is(handlerStub.calledWith[0].type, "selectionchange", "handler got a selectionchange event"); is(handlerStub.calledWith[0].type, "selectionchange", "handler got a selectionchange event");
is(handlerStub.calledWith[0].target, grid, "select event had the originating grid as the target"); is(handlerStub.calledWith[0].target, grid, "select event had the originating grid as the target");
handlerStub.restore(); handlerStub.restore();
doc.defaultView.removeEventListener("selectionchange", handler, false); doc.defaultView.removeEventListener("selectionchange", handler, false);
} }
}); });
// implements a getItemAtIndex method (or grid.children[idx] ?) // implements a getItemAtIndex method (or grid.children[idx] ?)

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

@ -4,6 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/MemoryReporting.h"
#include "nsNullPrincipalURI.h" #include "nsNullPrincipalURI.h"
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsEscape.h" #include "nsEscape.h"
@ -272,14 +273,14 @@ nsNullPrincipalURI::SchemeIs(const char *aScheme, bool *_schemeIs)
//// nsISizeOf //// nsISizeOf
size_t size_t
nsNullPrincipalURI::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const nsNullPrincipalURI::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
{ {
return mScheme.SizeOfExcludingThisIfUnshared(aMallocSizeOf) + return mScheme.SizeOfExcludingThisIfUnshared(aMallocSizeOf) +
mPath.SizeOfExcludingThisIfUnshared(aMallocSizeOf); mPath.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
} }
size_t size_t
nsNullPrincipalURI::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const { nsNullPrincipalURI::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
} }

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

@ -16,6 +16,7 @@
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
#include "nsString.h" #include "nsString.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
// {51fcd543-3b52-41f7-b91b-6b54102236e6} // {51fcd543-3b52-41f7-b91b-6b54102236e6}
#define NS_NULLPRINCIPALURI_IMPLEMENTATION_CID \ #define NS_NULLPRINCIPALURI_IMPLEMENTATION_CID \
@ -30,8 +31,8 @@ public:
NS_DECL_NSIURI NS_DECL_NSIURI
// nsISizeOf // nsISizeOf
virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
nsNullPrincipalURI(const nsCString &aSpec); nsNullPrincipalURI(const nsCString &aSpec);

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

@ -13,6 +13,7 @@
#define FragmentOrElement_h___ #define FragmentOrElement_h___
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
#include "nsAttrAndChildArray.h" // member #include "nsAttrAndChildArray.h" // member
#include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_* #include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_*
#include "nsIContent.h" // base class #include "nsIContent.h" // base class
@ -298,7 +299,7 @@ public:
void Traverse(nsCycleCollectionTraversalCallback &cb, bool aIsXUL); void Traverse(nsCycleCollectionTraversalCallback &cb, bool aIsXUL);
void Unlink(bool aIsXUL); void Unlink(bool aIsXUL);
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
/** /**
* The .style attribute (an interface that forwards to the actual * The .style attribute (an interface that forwards to the actual

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

@ -17,6 +17,7 @@
#include "nsPropertyTable.h" // for typedefs #include "nsPropertyTable.h" // for typedefs
#include "nsTObserverArray.h" // for member #include "nsTObserverArray.h" // for member
#include "nsWindowMemoryReporter.h" // for NS_DECL_SIZEOF_EXCLUDING_THIS #include "nsWindowMemoryReporter.h" // for NS_DECL_SIZEOF_EXCLUDING_THIS
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/EventTarget.h" // for base class #include "mozilla/dom/EventTarget.h" // for base class
// Including 'windows.h' will #define GetClassInfo to something else. // Including 'windows.h' will #define GetClassInfo to something else.
@ -299,7 +300,7 @@ public:
// way that |this| points to the start of the allocated object, even in // way that |this| points to the start of the allocated object, even in
// methods of nsINode's sub-classes, and so |aMallocSizeOf(this)| is always // methods of nsINode's sub-classes, and so |aMallocSizeOf(this)| is always
// safe to call no matter which object it was invoked on. // safe to call no matter which object it was invoked on.
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const { virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
} }

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

@ -10,6 +10,7 @@
* utility methods for subclasses, and so forth. * utility methods for subclasses, and so forth.
*/ */
#include "mozilla/MemoryReporting.h"
#include "mozilla/Util.h" #include "mozilla/Util.h"
#include "mozilla/Likely.h" #include "mozilla/Likely.h"
@ -593,7 +594,7 @@ FragmentOrElement::nsDOMSlots::Unlink(bool aIsXUL)
} }
size_t size_t
FragmentOrElement::nsDOMSlots::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const FragmentOrElement::nsDOMSlots::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{ {
size_t n = aMallocSizeOf(this); size_t n = aMallocSizeOf(this);
@ -1834,7 +1835,7 @@ FragmentOrElement::FireNodeRemovedForChildren()
} }
size_t size_t
FragmentOrElement::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const FragmentOrElement::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{ {
size_t n = 0; size_t n = 0;
n += nsIContent::SizeOfExcludingThis(aMallocSizeOf); n += nsIContent::SizeOfExcludingThis(aMallocSizeOf);

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

@ -6,6 +6,7 @@
#include "Link.h" #include "Link.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
#include "nsEventStates.h" #include "nsEventStates.h"
#include "nsIURL.h" #include "nsIURL.h"
@ -500,7 +501,7 @@ Link::SetHrefAttribute(nsIURI *aURI)
} }
size_t size_t
Link::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const Link::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
{ {
size_t n = 0; size_t n = 0;

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

@ -12,6 +12,7 @@
#define mozilla_dom_Link_h__ #define mozilla_dom_Link_h__
#include "mozilla/IHistory.h" #include "mozilla/IHistory.h"
#include "mozilla/MemoryReporting.h"
#include "nsIContent.h" #include "nsIContent.h"
namespace mozilla { namespace mozilla {
@ -98,7 +99,7 @@ public:
virtual bool HasDeferredDNSPrefetchRequest() { return true; } virtual bool HasDeferredDNSPrefetchRequest() { return true; }
virtual size_t virtual size_t
SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
bool ElementHasHref() const; bool ElementHasHref() const;

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

@ -8,6 +8,7 @@
* the two is unified to minimize footprint. * the two is unified to minimize footprint.
*/ */
#include "mozilla/MemoryReporting.h"
#include "nsAttrAndChildArray.h" #include "nsAttrAndChildArray.h"
#include "nsMappedAttributeElement.h" #include "nsMappedAttributeElement.h"
#include "prbit.h" #include "prbit.h"
@ -836,7 +837,7 @@ nsAttrAndChildArray::SetChildAtPos(void** aPos, nsIContent* aChild,
} }
size_t size_t
nsAttrAndChildArray::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const nsAttrAndChildArray::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
{ {
size_t n = 0; size_t n = 0;
if (mImpl) { if (mImpl) {

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

@ -12,6 +12,7 @@
#define nsAttrAndChildArray_h___ #define nsAttrAndChildArray_h___
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
#include "nscore.h" #include "nscore.h"
#include "nsAttrName.h" #include "nsAttrName.h"
@ -116,7 +117,7 @@ public:
!AttrSlotIsTaken(ATTRCHILD_ARRAY_MAX_ATTR_COUNT - 1); !AttrSlotIsTaken(ATTRCHILD_ARRAY_MAX_ATTR_COUNT - 1);
} }
size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
bool HasMappedAttrs() const bool HasMappedAttrs() const
{ {
return MappedAttrCount(); return MappedAttrCount();

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

@ -15,6 +15,7 @@
#include "nsAttrValueInlines.h" #include "nsAttrValueInlines.h"
#include "nsIAtom.h" #include "nsIAtom.h"
#include "nsUnicharUtils.h" #include "nsUnicharUtils.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/css/StyleRule.h" #include "mozilla/css/StyleRule.h"
#include "mozilla/css/Declaration.h" #include "mozilla/css/Declaration.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
@ -1949,7 +1950,7 @@ nsAttrValue::StringToInteger(const nsAString& aValue, bool* aStrict,
} }
size_t size_t
nsAttrValue::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const nsAttrValue::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{ {
size_t n = 0; size_t n = 0;

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

@ -21,6 +21,7 @@
#include "SVGAttrValueWrapper.h" #include "SVGAttrValueWrapper.h"
#include "nsTArrayForwardDeclare.h" #include "nsTArrayForwardDeclare.h"
#include "nsIAtom.h" #include "nsIAtom.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/BindingDeclarations.h" #include "mozilla/dom/BindingDeclarations.h"
class nsAString; class nsAString;
@ -371,7 +372,7 @@ public:
bool ParseStyleAttribute(const nsAString& aString, bool ParseStyleAttribute(const nsAString& aString,
nsStyledElementNotElementCSSInlineStyle* aElement); nsStyledElementNotElementCSSInlineStyle* aElement);
size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
private: private:
// These have to be the same as in ValueType // These have to be the same as in ValueType

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

@ -9,6 +9,7 @@
#include "nsDOMAttributeMap.h" #include "nsDOMAttributeMap.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/Attr.h" #include "mozilla/dom/Attr.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
#include "mozilla/dom/MozNamedAttrMapBinding.h" #include "mozilla/dom/MozNamedAttrMapBinding.h"
@ -533,14 +534,14 @@ nsDOMAttributeMap::Enumerate(AttrCache::EnumReadFunction aFunc,
size_t size_t
AttrCacheSizeEnumerator(const nsAttrKey& aKey, AttrCacheSizeEnumerator(const nsAttrKey& aKey,
const nsRefPtr<Attr>& aValue, const nsRefPtr<Attr>& aValue,
nsMallocSizeOfFun aMallocSizeOf, MallocSizeOf aMallocSizeOf,
void* aUserArg) void* aUserArg)
{ {
return aMallocSizeOf(aValue.get()); return aMallocSizeOf(aValue.get());
} }
size_t size_t
nsDOMAttributeMap::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const nsDOMAttributeMap::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{ {
size_t n = aMallocSizeOf(this); size_t n = aMallocSizeOf(this);
n += mAttributeCache.SizeOfExcludingThis(AttrCacheSizeEnumerator, n += mAttributeCache.SizeOfExcludingThis(AttrCacheSizeEnumerator,

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

@ -10,6 +10,7 @@
#ifndef nsDOMAttributeMap_h #ifndef nsDOMAttributeMap_h
#define nsDOMAttributeMap_h #define nsDOMAttributeMap_h
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/Attr.h" #include "mozilla/dom/Attr.h"
#include "mozilla/ErrorResult.h" #include "mozilla/ErrorResult.h"
#include "nsCycleCollectionParticipant.h" #include "nsCycleCollectionParticipant.h"
@ -181,7 +182,7 @@ public:
// No supported names we want to show up in iteration. // No supported names we want to show up in iteration.
} }
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
private: private:
nsCOMPtr<Element> mContent; nsCOMPtr<Element> mContent;

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

@ -9,6 +9,7 @@
*/ */
#include "mozilla/DebugOnly.h" #include "mozilla/DebugOnly.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Util.h" #include "mozilla/Util.h"
#include "mozilla/Likely.h" #include "mozilla/Likely.h"
#include <algorithm> #include <algorithm>
@ -452,7 +453,7 @@ nsIdentifierMapEntry::HasIdElementExposedAsHTMLDocumentProperty()
// static // static
size_t size_t
nsIdentifierMapEntry::SizeOfExcludingThis(nsIdentifierMapEntry* aEntry, nsIdentifierMapEntry::SizeOfExcludingThis(nsIdentifierMapEntry* aEntry,
nsMallocSizeOfFun aMallocSizeOf, MallocSizeOf aMallocSizeOf,
void*) void*)
{ {
return aEntry->GetKey().SizeOfExcludingThisIfUnshared(aMallocSizeOf); return aEntry->GetKey().SizeOfExcludingThisIfUnshared(aMallocSizeOf);
@ -11066,14 +11067,14 @@ nsIDocument::DocSizeOfIncludingThis(nsWindowSizes* aWindowSizes) const
static size_t static size_t
SizeOfStyleSheetsElementIncludingThis(nsIStyleSheet* aStyleSheet, SizeOfStyleSheetsElementIncludingThis(nsIStyleSheet* aStyleSheet,
nsMallocSizeOfFun aMallocSizeOf, MallocSizeOf aMallocSizeOf,
void* aData) void* aData)
{ {
return aStyleSheet->SizeOfIncludingThis(aMallocSizeOf); return aStyleSheet->SizeOfIncludingThis(aMallocSizeOf);
} }
size_t size_t
nsDocument::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const nsDocument::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{ {
// This SizeOfExcludingThis() overrides the one from nsINode. But // This SizeOfExcludingThis() overrides the one from nsINode. But
// nsDocuments can only appear at the top of the DOM tree, and we use the // nsDocuments can only appear at the top of the DOM tree, and we use the

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

@ -62,6 +62,7 @@
#include "nsISecurityEventSink.h" #include "nsISecurityEventSink.h"
#include "nsIChannelEventSink.h" #include "nsIChannelEventSink.h"
#include "imgIRequest.h" #include "imgIRequest.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/DOMImplementation.h" #include "mozilla/dom/DOMImplementation.h"
#include "nsIDOMTouchEvent.h" #include "nsIDOMTouchEvent.h"
#include "nsIInlineEventHandlers.h" #include "nsIInlineEventHandlers.h"
@ -224,7 +225,7 @@ public:
}; };
static size_t SizeOfExcludingThis(nsIdentifierMapEntry* aEntry, static size_t SizeOfExcludingThis(nsIdentifierMapEntry* aEntry,
nsMallocSizeOfFun aMallocSizeOf, mozilla::MallocSizeOf aMallocSizeOf,
void* aArg); void* aArg);
private: private:

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

@ -11,6 +11,7 @@
#include "mozilla/DebugOnly.h" #include "mozilla/DebugOnly.h"
#include "nsGenericDOMDataNode.h" #include "nsGenericDOMDataNode.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsEventListenerManager.h" #include "nsEventListenerManager.h"
@ -920,7 +921,7 @@ nsGenericDOMDataNode::GetClassAttributeName() const
} }
size_t size_t
nsGenericDOMDataNode::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const nsGenericDOMDataNode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{ {
size_t n = nsIContent::SizeOfExcludingThis(aMallocSizeOf); size_t n = nsIContent::SizeOfExcludingThis(aMallocSizeOf);
n += mText.SizeOfExcludingThis(aMallocSizeOf); n += mText.SizeOfExcludingThis(aMallocSizeOf);

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

@ -15,6 +15,7 @@
#include "mozAutoDocUpdate.h" #include "mozAutoDocUpdate.h"
#include "mozilla/CORSMode.h" #include "mozilla/CORSMode.h"
#include "mozilla/Likely.h" #include "mozilla/Likely.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Telemetry.h" #include "mozilla/Telemetry.h"
#include "mozilla/Util.h" #include "mozilla/Util.h"
#include "nsAsyncDOMEvent.h" #include "nsAsyncDOMEvent.h"
@ -2074,7 +2075,7 @@ nsINode::UnbindObject(nsISupports* aObject)
} }
size_t size_t
nsINode::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const nsINode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{ {
size_t n = 0; size_t n = 0;
nsEventListenerManager* elm = nsEventListenerManager* elm =

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

@ -12,6 +12,7 @@
#include "nsHTMLStyleSheet.h" #include "nsHTMLStyleSheet.h"
#include "nsRuleWalker.h" #include "nsRuleWalker.h"
#include "mozilla/HashFunctions.h" #include "mozilla/HashFunctions.h"
#include "mozilla/MemoryReporting.h"
using namespace mozilla; using namespace mozilla;
@ -248,7 +249,7 @@ nsMappedAttributes::IndexOfAttr(nsIAtom* aLocalName) const
} }
size_t size_t
nsMappedAttributes::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const nsMappedAttributes::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{ {
NS_ASSERTION(mAttrCount == mBufferSize, NS_ASSERTION(mAttrCount == mBufferSize,
"mBufferSize and mAttrCount are expected to be the same."); "mBufferSize and mAttrCount are expected to be the same.");

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

@ -15,6 +15,7 @@
#include "nsMappedAttributeElement.h" #include "nsMappedAttributeElement.h"
#include "nsIStyleRule.h" #include "nsIStyleRule.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
class nsIAtom; class nsIAtom;
class nsHTMLStyleSheet; class nsHTMLStyleSheet;
@ -77,7 +78,7 @@ public:
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE; virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE;
#endif #endif
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
private: private:
nsMappedAttributes(const nsMappedAttributes& aCopy); nsMappedAttributes(const nsMappedAttributes& aCopy);

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

@ -20,6 +20,7 @@
* nsIAtom pointers, and the values are void pointers. * nsIAtom pointers, and the values are void pointers.
*/ */
#include "mozilla/MemoryReporting.h"
#include "nsPropertyTable.h" #include "nsPropertyTable.h"
#include "pldhash.h" #include "pldhash.h"
#include "nsError.h" #include "nsError.h"
@ -52,7 +53,7 @@ public:
return mName == aPropertyName; return mName == aPropertyName;
} }
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf); size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf);
nsCOMPtr<nsIAtom> mName; // property name nsCOMPtr<nsIAtom> mName; // property name
PLDHashTable mObjectValueMap; // map of object/value pairs PLDHashTable mObjectValueMap; // map of object/value pairs
@ -340,7 +341,7 @@ nsPropertyTable::PropertyList::DeletePropertyFor(nsPropertyOwner aObject)
} }
size_t size_t
nsPropertyTable::PropertyList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) nsPropertyTable::PropertyList::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
{ {
size_t n = aMallocSizeOf(this); size_t n = aMallocSizeOf(this);
n += PL_DHashTableSizeOfExcludingThis(&mObjectValueMap, nullptr, aMallocSizeOf); n += PL_DHashTableSizeOfExcludingThis(&mObjectValueMap, nullptr, aMallocSizeOf);
@ -348,7 +349,7 @@ nsPropertyTable::PropertyList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSize
} }
size_t size_t
nsPropertyTable::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const nsPropertyTable::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
{ {
size_t n = 0; size_t n = 0;

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

@ -23,6 +23,7 @@
#ifndef nsPropertyTable_h_ #ifndef nsPropertyTable_h_
#define nsPropertyTable_h_ #define nsPropertyTable_h_
#include "mozilla/MemoryReporting.h"
#include "nscore.h" #include "nscore.h"
class nsIAtom; class nsIAtom;
@ -176,7 +177,7 @@ class nsPropertyTable
class PropertyList; class PropertyList;
size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
private: private:
NS_HIDDEN_(void) DestroyPropertyList(); NS_HIDDEN_(void) DestroyPropertyList();

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

@ -16,6 +16,7 @@
#include "nsBidiUtils.h" #include "nsBidiUtils.h"
#include "nsUnicharUtils.h" #include "nsUnicharUtils.h"
#include "nsUTF8Utils.h" #include "nsUTF8Utils.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/SSE.h" #include "mozilla/SSE.h"
#include "nsTextFragmentImpl.h" #include "nsTextFragmentImpl.h"
#include <algorithm> #include <algorithm>
@ -392,7 +393,7 @@ nsTextFragment::Append(const PRUnichar* aBuffer, uint32_t aLength, bool aUpdateB
} }
/* virtual */ size_t /* virtual */ size_t
nsTextFragment::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const nsTextFragment::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
{ {
if (Is2b()) { if (Is2b()) {
return aMallocSizeOf(m2b); return aMallocSizeOf(m2b);

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

@ -12,6 +12,7 @@
#define nsTextFragment_h___ #define nsTextFragment_h___
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
#include "nsString.h" #include "nsString.h"
#include "nsReadableUtils.h" #include "nsReadableUtils.h"
@ -174,7 +175,7 @@ public:
uint32_t mLength : 29; uint32_t mLength : 29;
}; };
size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
private: private:
void ReleaseText(); void ReleaseText();

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

@ -4,6 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/MemoryReporting.h"
#include "mozilla/Util.h" #include "mozilla/Util.h"
#include "nsXMLHttpRequest.h" #include "nsXMLHttpRequest.h"
@ -534,7 +535,7 @@ nsXMLHttpRequest::DisconnectFromOwner()
size_t size_t
nsXMLHttpRequest::SizeOfEventTargetIncludingThis( nsXMLHttpRequest::SizeOfEventTargetIncludingThis(
nsMallocSizeOfFun aMallocSizeOf) const MallocSizeOf aMallocSizeOf) const
{ {
size_t n = aMallocSizeOf(this); size_t n = aMallocSizeOf(this);
n += mResponseBody.SizeOfExcludingThisIfUnshared(aMallocSizeOf); n += mResponseBody.SizeOfExcludingThisIfUnshared(aMallocSizeOf);

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

@ -37,6 +37,7 @@
#include "nsISizeOfEventTarget.h" #include "nsISizeOfEventTarget.h"
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/TypedArray.h" #include "mozilla/dom/TypedArray.h"
#include "mozilla/dom/XMLHttpRequestBinding.h" #include "mozilla/dom/XMLHttpRequestBinding.h"
@ -227,7 +228,7 @@ public:
// nsISizeOfEventTarget // nsISizeOfEventTarget
virtual size_t virtual size_t
SizeOfEventTargetIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; SizeOfEventTargetIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(nsXHREventTarget) NS_REALLY_FORWARD_NSIDOMEVENTTARGET(nsXHREventTarget)

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

@ -13,6 +13,7 @@
#include "nsWrapperCache.h" #include "nsWrapperCache.h"
#include "mozilla/LinkedList.h" #include "mozilla/LinkedList.h"
#include "mozilla/MemoryReporting.h"
namespace mozilla { namespace mozilla {
@ -32,7 +33,7 @@ public:
void Delete(); void Delete();
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const { size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
size_t sizeOfCache = mCache ? mCache->SizeOfIncludingThis(aMallocSizeOf) : 0; size_t sizeOfCache = mCache ? mCache->SizeOfIncludingThis(aMallocSizeOf) : 0;
return aMallocSizeOf(this) + sizeOfCache; return aMallocSizeOf(this) + sizeOfCache;
} }

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

@ -7,6 +7,7 @@
#include "nsTArray.h" #include "nsTArray.h"
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/MemoryReporting.h"
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
@ -306,7 +307,7 @@ public:
void Update(); void Update();
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
{ {
return aMallocSizeOf(this) + mTreeData.SizeOfExcludingThis(aMallocSizeOf); return aMallocSizeOf(this) + mTreeData.SizeOfExcludingThis(aMallocSizeOf);
} }
@ -558,7 +559,7 @@ bool WebGLElementArrayCache::Validate(GLenum type, uint32_t maxAllowed, size_t f
return false; return false;
} }
size_t WebGLElementArrayCache::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const { size_t WebGLElementArrayCache::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
size_t uint8TreeSize = mUint8Tree ? mUint8Tree->SizeOfIncludingThis(aMallocSizeOf) : 0; size_t uint8TreeSize = mUint8Tree ? mUint8Tree->SizeOfIncludingThis(aMallocSizeOf) : 0;
size_t uint16TreeSize = mUint16Tree ? mUint16Tree->SizeOfIncludingThis(aMallocSizeOf) : 0; size_t uint16TreeSize = mUint16Tree ? mUint16Tree->SizeOfIncludingThis(aMallocSizeOf) : 0;
size_t uint32TreeSize = mUint32Tree ? mUint32Tree->SizeOfIncludingThis(aMallocSizeOf) : 0; size_t uint32TreeSize = mUint32Tree ? mUint32Tree->SizeOfIncludingThis(aMallocSizeOf) : 0;

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

@ -6,6 +6,7 @@
#ifndef WEBGLELEMENTARRAYCACHE_H #ifndef WEBGLELEMENTARRAYCACHE_H
#define WEBGLELEMENTARRAYCACHE_H #define WEBGLELEMENTARRAYCACHE_H
#include "mozilla/MemoryReporting.h"
#include "mozilla/StandardInteger.h" #include "mozilla/StandardInteger.h"
#include "nscore.h" #include "nscore.h"
#include "GLDefs.h" #include "GLDefs.h"
@ -47,7 +48,7 @@ public:
~WebGLElementArrayCache(); ~WebGLElementArrayCache();
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
private: private:

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

@ -6,6 +6,7 @@
#include "WebGLObjectModel.h" #include "WebGLObjectModel.h"
#include "WebGLShader.h" #include "WebGLShader.h"
#include "WebGLContext.h" #include "WebGLContext.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h" #include "mozilla/dom/WebGLRenderingContextBinding.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
@ -39,7 +40,7 @@ WebGLShader::Delete() {
} }
size_t size_t
WebGLShader::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const { WebGLShader::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const {
return aMallocSizeOf(this) + return aMallocSizeOf(this) +
mSource.SizeOfExcludingThisIfUnshared(aMallocSizeOf) + mSource.SizeOfExcludingThisIfUnshared(aMallocSizeOf) +
mTranslationLog.SizeOfExcludingThisIfUnshared(aMallocSizeOf); mTranslationLog.SizeOfExcludingThisIfUnshared(aMallocSizeOf);

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

@ -14,6 +14,7 @@
#include "angle/ShaderLang.h" #include "angle/ShaderLang.h"
#include "mozilla/LinkedList.h" #include "mozilla/LinkedList.h"
#include "mozilla/MemoryReporting.h"
namespace mozilla { namespace mozilla {
@ -39,7 +40,7 @@ public:
DeleteOnce(); DeleteOnce();
} }
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
WebGLuint GLName() { return mGLName; } WebGLuint GLName() { return mGLName; }
WebGLenum ShaderType() { return mType; } WebGLenum ShaderType() { return mType; }

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

@ -24,6 +24,7 @@
#include "nsLayoutUtils.h" #include "nsLayoutUtils.h"
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
#include "nsIFrame.h" #include "nsIFrame.h"
#include "nsView.h" #include "nsView.h"
@ -1275,7 +1276,7 @@ nsEventListenerManager::GetEventHandlerInternal(nsIAtom *aEventName)
} }
size_t size_t
nsEventListenerManager::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) nsEventListenerManager::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf)
const const
{ {
size_t n = aMallocSizeOf(this); size_t n = aMallocSizeOf(this);

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

@ -18,6 +18,7 @@
#include "nsTObserverArray.h" #include "nsTObserverArray.h"
#include "nsGUIEvent.h" #include "nsGUIEvent.h"
#include "nsIJSEventListener.h" #include "nsIJSEventListener.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/EventTarget.h" #include "mozilla/dom/EventTarget.h"
#include "mozilla/dom/EventListenerBinding.h" #include "mozilla/dom/EventListenerBinding.h"
@ -400,7 +401,7 @@ public:
bool MayHaveMouseEnterLeaveEventListener() { return mMayHaveMouseEnterLeaveEventListener; } bool MayHaveMouseEnterLeaveEventListener() { return mMayHaveMouseEnterLeaveEventListener; }
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
void MarkForCC(); void MarkForCC();

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

@ -4,6 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/HTMLAnchorElement.h" #include "mozilla/dom/HTMLAnchorElement.h"
#include "mozilla/dom/HTMLAnchorElementBinding.h" #include "mozilla/dom/HTMLAnchorElementBinding.h"
@ -413,7 +414,7 @@ HTMLAnchorElement::IntrinsicState() const
} }
size_t size_t
HTMLAnchorElement::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const HTMLAnchorElement::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
{ {
return nsGenericHTMLElement::SizeOfExcludingThis(aMallocSizeOf) + return nsGenericHTMLElement::SizeOfExcludingThis(aMallocSizeOf) +
Link::SizeOfExcludingThis(aMallocSizeOf); Link::SizeOfExcludingThis(aMallocSizeOf);

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

@ -4,6 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/HTMLAreaElement.h" #include "mozilla/dom/HTMLAreaElement.h"
#include "mozilla/dom/HTMLAreaElementBinding.h" #include "mozilla/dom/HTMLAreaElementBinding.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
@ -232,7 +233,7 @@ HTMLAreaElement::IntrinsicState() const
} }
size_t size_t
HTMLAreaElement::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const HTMLAreaElement::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
{ {
return nsGenericHTMLElement::SizeOfExcludingThis(aMallocSizeOf) + return nsGenericHTMLElement::SizeOfExcludingThis(aMallocSizeOf) +
Link::SizeOfExcludingThis(aMallocSizeOf); Link::SizeOfExcludingThis(aMallocSizeOf);

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

@ -3,6 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/HTMLLinkElement.h" #include "mozilla/dom/HTMLLinkElement.h"
#include "mozilla/dom/HTMLLinkElementBinding.h" #include "mozilla/dom/HTMLLinkElementBinding.h"
@ -404,7 +405,7 @@ HTMLLinkElement::IntrinsicState() const
} }
size_t size_t
HTMLLinkElement::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const HTMLLinkElement::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
{ {
return nsGenericHTMLElement::SizeOfExcludingThis(aMallocSizeOf) + return nsGenericHTMLElement::SizeOfExcludingThis(aMallocSizeOf) +
Link::SizeOfExcludingThis(aMallocSizeOf); Link::SizeOfExcludingThis(aMallocSizeOf);

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

@ -11,6 +11,7 @@
#include "nsIXULAppInfo.h" #include "nsIXULAppInfo.h"
#include "nsPluginArray.h" #include "nsPluginArray.h"
#include "nsMimeTypeArray.h" #include "nsMimeTypeArray.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/DesktopNotification.h" #include "mozilla/dom/DesktopNotification.h"
#include "nsGeolocation.h" #include "nsGeolocation.h"
#include "nsIHttpProtocolHandler.h" #include "nsIHttpProtocolHandler.h"
@ -1536,7 +1537,7 @@ Navigator::GetMozCameras(nsISupports** aCameraManager)
} }
size_t size_t
Navigator::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const Navigator::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
{ {
size_t n = aMallocSizeOf(this); size_t n = aMallocSizeOf(this);

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

@ -7,6 +7,7 @@
#ifndef mozilla_dom_Navigator_h #ifndef mozilla_dom_Navigator_h
#define mozilla_dom_Navigator_h #define mozilla_dom_Navigator_h
#include "mozilla/MemoryReporting.h"
#include "nsIDOMNavigator.h" #include "nsIDOMNavigator.h"
#include "nsIDOMNavigatorGeolocation.h" #include "nsIDOMNavigatorGeolocation.h"
#include "nsIDOMNavigatorDeviceStorage.h" #include "nsIDOMNavigatorDeviceStorage.h"
@ -200,7 +201,7 @@ public:
static bool HasDesktopNotificationSupport(); static bool HasDesktopNotificationSupport();
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
/** /**
* For use during document.write where our inner window changes. * For use during document.write where our inner window changes.

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

@ -8,6 +8,7 @@
#include <algorithm> #include <algorithm>
/* This must occur *after* base/basictypes.h to avoid typedefs conflicts. */ /* This must occur *after* base/basictypes.h to avoid typedefs conflicts. */
#include "mozilla/MemoryReporting.h"
#include "mozilla/Util.h" #include "mozilla/Util.h"
// Local Includes // Local Includes
@ -11224,7 +11225,7 @@ nsGlobalWindow::HasIndexedDBSupport()
static size_t static size_t
SizeOfEventTargetObjectsEntryExcludingThisFun( SizeOfEventTargetObjectsEntryExcludingThisFun(
nsPtrHashKey<nsDOMEventTargetHelper> *aEntry, nsPtrHashKey<nsDOMEventTargetHelper> *aEntry,
nsMallocSizeOfFun aMallocSizeOf, MallocSizeOf aMallocSizeOf,
void *arg) void *arg)
{ {
nsISupports *supports = aEntry->GetKey(); nsISupports *supports = aEntry->GetKey();

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

@ -11,6 +11,7 @@
#include "xpcpublic.h" #include "xpcpublic.h"
#include "nsIDOMEventListener.h" #include "nsIDOMEventListener.h"
#include "nsIAtom.h" #include "nsIAtom.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/EventHandlerBinding.h" #include "mozilla/dom/EventHandlerBinding.h"
#define NS_IJSEVENTLISTENER_IID \ #define NS_IJSEVENTLISTENER_IID \
@ -236,7 +237,7 @@ public:
mHandler.SetHandler(aHandler); mHandler.SetHandler(aHandler);
} }
virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
{ {
return 0; return 0;
@ -252,7 +253,7 @@ public:
// - mEventName: shared with others // - mEventName: shared with others
} }
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
{ {
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
} }

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

@ -7,6 +7,7 @@
#ifndef nsISizeOfEventTarget_h___ #ifndef nsISizeOfEventTarget_h___
#define nsISizeOfEventTarget_h___ #define nsISizeOfEventTarget_h___
#include "mozilla/MemoryReporting.h"
#include "nsISupports.h" #include "nsISupports.h"
#define NS_ISIZEOFEVENTTARGET_IID \ #define NS_ISIZEOFEVENTTARGET_IID \
@ -31,7 +32,7 @@ public:
* itself. * itself.
*/ */
virtual size_t virtual size_t
SizeOfEventTargetIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const = 0; SizeOfEventTargetIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const = 0;
}; };
NS_DEFINE_STATIC_IID_ACCESSOR(nsISizeOfEventTarget, NS_ISIZEOFEVENTTARGET_IID) NS_DEFINE_STATIC_IID_ACCESSOR(nsISizeOfEventTarget, NS_ISIZEOFEVENTTARGET_IID)

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

@ -27,6 +27,7 @@
#include "nsCRT.h" #include "nsCRT.h"
#include "nsIObserverService.h" #include "nsIObserverService.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/Services.h" #include "mozilla/Services.h"
@ -43,7 +44,7 @@ public:
nsString mKey; nsString mKey;
nsGlobalNameStruct mGlobalName; nsGlobalNameStruct mGlobalName;
size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) { size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) {
// Measurement of the following members may be added later if DMD finds it // Measurement of the following members may be added later if DMD finds it
// is worthwhile: // is worthwhile:
// - mGlobalName // - mGlobalName
@ -877,7 +878,7 @@ nsScriptNameSpaceManager::EnumerateGlobalNames(GlobalNameEnumerator aEnumerator,
} }
static size_t static size_t
SizeOfEntryExcludingThis(PLDHashEntryHdr *aHdr, nsMallocSizeOfFun aMallocSizeOf, SizeOfEntryExcludingThis(PLDHashEntryHdr *aHdr, MallocSizeOf aMallocSizeOf,
void *aArg) void *aArg)
{ {
GlobalNameMapEntry* entry = static_cast<GlobalNameMapEntry*>(aHdr); GlobalNameMapEntry* entry = static_cast<GlobalNameMapEntry*>(aHdr);
@ -885,7 +886,7 @@ SizeOfEntryExcludingThis(PLDHashEntryHdr *aHdr, nsMallocSizeOfFun aMallocSizeOf,
} }
size_t size_t
nsScriptNameSpaceManager::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) nsScriptNameSpaceManager::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf)
{ {
size_t n = 0; size_t n = 0;
n += PL_DHashTableSizeOfExcludingThis(&mGlobalNames, n += PL_DHashTableSizeOfExcludingThis(&mGlobalNames,

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

@ -21,6 +21,7 @@
#ifndef nsScriptNameSpaceManager_h__ #ifndef nsScriptNameSpaceManager_h__
#define nsScriptNameSpaceManager_h__ #define nsScriptNameSpaceManager_h__
#include "mozilla/MemoryReporting.h"
#include "nsIScriptNameSpaceManager.h" #include "nsIScriptNameSpaceManager.h"
#include "nsString.h" #include "nsString.h"
#include "nsID.h" #include "nsID.h"
@ -156,7 +157,7 @@ public:
void EnumerateGlobalNames(GlobalNameEnumerator aEnumerator, void EnumerateGlobalNames(GlobalNameEnumerator aEnumerator,
void* aClosure); void* aClosure);
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf); size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf);
private: private:
// Adds a new entry to the hash and returns the nsGlobalNameStruct // Adds a new entry to the hash and returns the nsGlobalNameStruct

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

@ -12,6 +12,7 @@
#include "nsDataHashtable.h" #include "nsDataHashtable.h"
#include "nsWeakReference.h" #include "nsWeakReference.h"
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/TimeStamp.h" #include "mozilla/TimeStamp.h"
#include "nsArenaMemoryStats.h" #include "nsArenaMemoryStats.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
@ -21,15 +22,15 @@
// SizeOfExcludingThis from its super-class. SizeOfIncludingThis() need not be // SizeOfExcludingThis from its super-class. SizeOfIncludingThis() need not be
// defined, it is inherited from nsINode. // defined, it is inherited from nsINode.
#define NS_DECL_SIZEOF_EXCLUDING_THIS \ #define NS_DECL_SIZEOF_EXCLUDING_THIS \
virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
class nsWindowSizes { class nsWindowSizes {
public: public:
nsWindowSizes(nsMallocSizeOfFun aMallocSizeOf) { nsWindowSizes(mozilla::MallocSizeOf aMallocSizeOf) {
memset(this, 0, sizeof(nsWindowSizes)); memset(this, 0, sizeof(nsWindowSizes));
mMallocSizeOf = aMallocSizeOf; mMallocSizeOf = aMallocSizeOf;
} }
nsMallocSizeOfFun mMallocSizeOf; mozilla::MallocSizeOf mMallocSizeOf;
nsArenaMemoryStats mArenaStats; nsArenaMemoryStats mArenaStats;
size_t mDOMElementNodes; size_t mDOMElementNodes;
size_t mDOMTextNodes; size_t mDOMTextNodes;

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

@ -7,6 +7,7 @@
#define nsJSEventListener_h__ #define nsJSEventListener_h__
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
#include "nsIDOMKeyEvent.h" #include "nsIDOMKeyEvent.h"
#include "nsIJSEventListener.h" #include "nsIJSEventListener.h"
#include "nsIDOMEventListener.h" #include "nsIDOMEventListener.h"
@ -33,7 +34,7 @@ public:
// nsIJSEventListener // nsIJSEventListener
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE
{ {
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
} }

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

@ -701,49 +701,63 @@ NS_IMETHODIMP nsWebBrowser::SetProperty(uint32_t aId, uint32_t aValue)
case nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS: case nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS:
{ {
NS_ENSURE_STATE(mDocShell); NS_ENSURE_STATE(mDocShell);
NS_ENSURE_TRUE((aValue == true || aValue == false), NS_ERROR_INVALID_ARG); NS_ENSURE_TRUE((aValue == static_cast<uint32_t>(true) ||
aValue == static_cast<uint32_t>(false)),
NS_ERROR_INVALID_ARG);
mDocShell->SetAllowPlugins(!!aValue); mDocShell->SetAllowPlugins(!!aValue);
} }
break; break;
case nsIWebBrowserSetup::SETUP_ALLOW_JAVASCRIPT: case nsIWebBrowserSetup::SETUP_ALLOW_JAVASCRIPT:
{ {
NS_ENSURE_STATE(mDocShell); NS_ENSURE_STATE(mDocShell);
NS_ENSURE_TRUE((aValue == true || aValue == false), NS_ERROR_INVALID_ARG); NS_ENSURE_TRUE((aValue == static_cast<uint32_t>(true) ||
aValue == static_cast<uint32_t>(false)),
NS_ERROR_INVALID_ARG);
mDocShell->SetAllowJavascript(!!aValue); mDocShell->SetAllowJavascript(!!aValue);
} }
break; break;
case nsIWebBrowserSetup::SETUP_ALLOW_META_REDIRECTS: case nsIWebBrowserSetup::SETUP_ALLOW_META_REDIRECTS:
{ {
NS_ENSURE_STATE(mDocShell); NS_ENSURE_STATE(mDocShell);
NS_ENSURE_TRUE((aValue == true || aValue == false), NS_ERROR_INVALID_ARG); NS_ENSURE_TRUE((aValue == static_cast<uint32_t>(true) ||
aValue == static_cast<uint32_t>(false)),
NS_ERROR_INVALID_ARG);
mDocShell->SetAllowMetaRedirects(!!aValue); mDocShell->SetAllowMetaRedirects(!!aValue);
} }
break; break;
case nsIWebBrowserSetup::SETUP_ALLOW_SUBFRAMES: case nsIWebBrowserSetup::SETUP_ALLOW_SUBFRAMES:
{ {
NS_ENSURE_STATE(mDocShell); NS_ENSURE_STATE(mDocShell);
NS_ENSURE_TRUE((aValue == true || aValue == false), NS_ERROR_INVALID_ARG); NS_ENSURE_TRUE((aValue == static_cast<uint32_t>(true) ||
aValue == static_cast<uint32_t>(false)),
NS_ERROR_INVALID_ARG);
mDocShell->SetAllowSubframes(!!aValue); mDocShell->SetAllowSubframes(!!aValue);
} }
break; break;
case nsIWebBrowserSetup::SETUP_ALLOW_IMAGES: case nsIWebBrowserSetup::SETUP_ALLOW_IMAGES:
{ {
NS_ENSURE_STATE(mDocShell); NS_ENSURE_STATE(mDocShell);
NS_ENSURE_TRUE((aValue == true || aValue == false), NS_ERROR_INVALID_ARG); NS_ENSURE_TRUE((aValue == static_cast<uint32_t>(true) ||
aValue == static_cast<uint32_t>(false)),
NS_ERROR_INVALID_ARG);
mDocShell->SetAllowImages(!!aValue); mDocShell->SetAllowImages(!!aValue);
} }
break; break;
case nsIWebBrowserSetup::SETUP_ALLOW_DNS_PREFETCH: case nsIWebBrowserSetup::SETUP_ALLOW_DNS_PREFETCH:
{ {
NS_ENSURE_STATE(mDocShell); NS_ENSURE_STATE(mDocShell);
NS_ENSURE_TRUE((aValue == true || aValue == false), NS_ERROR_INVALID_ARG); NS_ENSURE_TRUE((aValue == static_cast<uint32_t>(true) ||
aValue == static_cast<uint32_t>(false)),
NS_ERROR_INVALID_ARG);
mDocShell->SetAllowDNSPrefetch(!!aValue); mDocShell->SetAllowDNSPrefetch(!!aValue);
} }
break; break;
case nsIWebBrowserSetup::SETUP_USE_GLOBAL_HISTORY: case nsIWebBrowserSetup::SETUP_USE_GLOBAL_HISTORY:
{ {
NS_ENSURE_STATE(mDocShell); NS_ENSURE_STATE(mDocShell);
NS_ENSURE_TRUE((aValue == true || aValue == false), NS_ERROR_INVALID_ARG); NS_ENSURE_TRUE((aValue == static_cast<uint32_t>(true) ||
aValue == static_cast<uint32_t>(false)),
NS_ERROR_INVALID_ARG);
rv = EnableGlobalHistory(!!aValue); rv = EnableGlobalHistory(!!aValue);
mShouldEnableHistory = aValue; mShouldEnableHistory = aValue;
} }
@ -755,7 +769,9 @@ NS_IMETHODIMP nsWebBrowser::SetProperty(uint32_t aId, uint32_t aValue)
break; break;
case nsIWebBrowserSetup::SETUP_IS_CHROME_WRAPPER: case nsIWebBrowserSetup::SETUP_IS_CHROME_WRAPPER:
{ {
NS_ENSURE_TRUE((aValue == true || aValue == false), NS_ERROR_INVALID_ARG); NS_ENSURE_TRUE((aValue == static_cast<uint32_t>(true) ||
aValue == static_cast<uint32_t>(false)),
NS_ERROR_INVALID_ARG);
SetItemType(aValue ? static_cast<int32_t>(typeChromeWrapper) SetItemType(aValue ? static_cast<int32_t>(typeChromeWrapper)
: static_cast<int32_t>(typeContentWrapper)); : static_cast<int32_t>(typeContentWrapper));
} }

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

@ -8,6 +8,7 @@
#include "mozilla/Base64.h" #include "mozilla/Base64.h"
#include "mozilla/CheckedInt.h" #include "mozilla/CheckedInt.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
#include "gfxASurface.h" #include "gfxASurface.h"
#include "gfxContext.h" #include "gfxContext.h"
@ -671,14 +672,14 @@ gfxASurface::RecordMemoryFreed()
} }
size_t size_t
gfxASurface::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const gfxASurface::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{ {
// We don't measure mSurface because cairo doesn't allow it. // We don't measure mSurface because cairo doesn't allow it.
return 0; return 0;
} }
size_t size_t
gfxASurface::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const gfxASurface::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{ {
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
} }

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

@ -10,6 +10,7 @@
#define MOZ_DUMP_IMAGES #define MOZ_DUMP_IMAGES
#endif #endif
#include "mozilla/MemoryReporting.h"
#include "gfxTypes.h" #include "gfxTypes.h"
#include "gfxRect.h" #include "gfxRect.h"
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
@ -210,8 +211,8 @@ public:
virtual int32_t KnownMemoryUsed() { return mBytesRecorded; } virtual int32_t KnownMemoryUsed() { return mBytesRecorded; }
virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
// gfxASurface has many sub-classes. This method indicates if a sub-class // gfxASurface has many sub-classes. This method indicates if a sub-class
// is capable of measuring its own size accurately. If not, the caller // is capable of measuring its own size accurately. If not, the caller
// must fall back to a computed size. (Note that gfxASurface can actually // must fall back to a computed size. (Note that gfxASurface can actually

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

@ -3,6 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/MemoryReporting.h"
#include "mozilla/Util.h" #include "mozilla/Util.h"
#ifdef MOZ_LOGGING #ifdef MOZ_LOGGING
@ -213,7 +214,7 @@ gfxDWriteFontFamily::LocalizedName(nsAString &aLocalizedName)
} }
void void
gfxDWriteFontFamily::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxDWriteFontFamily::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const FontListSizes* aSizes) const
{ {
gfxFontFamily::SizeOfExcludingThis(aMallocSizeOf, aSizes); gfxFontFamily::SizeOfExcludingThis(aMallocSizeOf, aSizes);
@ -222,7 +223,7 @@ gfxDWriteFontFamily::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf,
} }
void void
gfxDWriteFontFamily::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxDWriteFontFamily::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const FontListSizes* aSizes) const
{ {
aSizes->mFontListSize += aMallocSizeOf(this); aSizes->mFontListSize += aMallocSizeOf(this);
@ -555,7 +556,7 @@ gfxDWriteFontEntry::IsCJKFont()
} }
void void
gfxDWriteFontEntry::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxDWriteFontEntry::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const FontListSizes* aSizes) const
{ {
gfxFontEntry::SizeOfExcludingThis(aMallocSizeOf, aSizes); gfxFontEntry::SizeOfExcludingThis(aMallocSizeOf, aSizes);
@ -564,7 +565,7 @@ gfxDWriteFontEntry::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf,
} }
void void
gfxDWriteFontEntry::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxDWriteFontEntry::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const FontListSizes* aSizes) const
{ {
aSizes->mFontListSize += aMallocSizeOf(this); aSizes->mFontListSize += aMallocSizeOf(this);
@ -1218,7 +1219,7 @@ gfxDWriteFontList::ResolveFontName(const nsAString& aFontName,
} }
void void
gfxDWriteFontList::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxDWriteFontList::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const FontListSizes* aSizes) const
{ {
gfxPlatformFontList::SizeOfExcludingThis(aMallocSizeOf, aSizes); gfxPlatformFontList::SizeOfExcludingThis(aMallocSizeOf, aSizes);
@ -1236,7 +1237,7 @@ gfxDWriteFontList::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf,
} }
void void
gfxDWriteFontList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxDWriteFontList::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const FontListSizes* aSizes) const
{ {
aSizes->mFontListSize += aMallocSizeOf(this); aSizes->mFontListSize += aMallocSizeOf(this);

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

@ -6,6 +6,7 @@
#ifndef GFX_DWRITEFONTLIST_H #ifndef GFX_DWRITEFONTLIST_H
#define GFX_DWRITEFONTLIST_H #define GFX_DWRITEFONTLIST_H
#include "mozilla/MemoryReporting.h"
#include "gfxDWriteCommon.h" #include "gfxDWriteCommon.h"
#include "gfxFont.h" #include "gfxFont.h"
@ -48,9 +49,9 @@ public:
void SetForceGDIClassic(bool aForce) { mForceGDIClassic = aForce; } void SetForceGDIClassic(bool aForce) { mForceGDIClassic = aForce; }
virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const; FontListSizes* aSizes) const;
virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const; FontListSizes* aSizes) const;
protected: protected:
@ -152,9 +153,9 @@ public:
void SetForceGDIClassic(bool aForce) { mForceGDIClassic = aForce; } void SetForceGDIClassic(bool aForce) { mForceGDIClassic = aForce; }
bool GetForceGDIClassic() { return mForceGDIClassic; } bool GetForceGDIClassic() { return mForceGDIClassic; }
virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const; FontListSizes* aSizes) const;
virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const; FontListSizes* aSizes) const;
protected: protected:
@ -365,9 +366,9 @@ public:
gfxFloat GetForceGDIClassicMaxFontSize() { return mForceGDIClassicMaxFontSize; } gfxFloat GetForceGDIClassicMaxFontSize() { return mForceGDIClassicMaxFontSize; }
virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const; FontListSizes* aSizes) const;
virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const; FontListSizes* aSizes) const;
private: private:

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

@ -3,6 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/MemoryReporting.h"
#include "gfxDWriteFonts.h" #include "gfxDWriteFonts.h"
#include "gfxDWriteShaper.h" #include "gfxDWriteShaper.h"
#include "gfxHarfBuzzShaper.h" #include "gfxHarfBuzzShaper.h"
@ -668,7 +669,7 @@ gfxDWriteFont::MeasureGlyphWidth(uint16_t aGlyph)
} }
void void
gfxDWriteFont::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxDWriteFont::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const FontCacheSizes* aSizes) const
{ {
gfxFont::SizeOfExcludingThis(aMallocSizeOf, aSizes); gfxFont::SizeOfExcludingThis(aMallocSizeOf, aSizes);
@ -677,7 +678,7 @@ gfxDWriteFont::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf,
} }
void void
gfxDWriteFont::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxDWriteFont::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const FontCacheSizes* aSizes) const
{ {
aSizes->mFontInstances += aMallocSizeOf(this); aSizes->mFontInstances += aMallocSizeOf(this);

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

@ -6,6 +6,7 @@
#ifndef GFX_WINDOWSDWRITEFONTS_H #ifndef GFX_WINDOWSDWRITEFONTS_H
#define GFX_WINDOWSDWRITEFONTS_H #define GFX_WINDOWSDWRITEFONTS_H
#include "mozilla/MemoryReporting.h"
#include <dwrite.h> #include <dwrite.h>
#include "gfxFont.h" #include "gfxFont.h"
@ -58,9 +59,9 @@ public:
virtual mozilla::TemporaryRef<mozilla::gfx::GlyphRenderingOptions> GetGlyphRenderingOptions(); virtual mozilla::TemporaryRef<mozilla::gfx::GlyphRenderingOptions> GetGlyphRenderingOptions();
virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const; FontCacheSizes* aSizes) const;
virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const; FontCacheSizes* aSizes) const;
virtual FontType GetType() const { return FONT_TYPE_DWRITE; } virtual FontType GetType() const { return FONT_TYPE_DWRITE; }

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

@ -3,6 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/MemoryReporting.h"
#include "mozilla/Util.h" #include "mozilla/Util.h"
#if defined(MOZ_WIDGET_GTK2) #if defined(MOZ_WIDGET_GTK2)
@ -464,7 +465,7 @@ FT2FontEntry::CopyFontTable(uint32_t aTableTag,
} }
void void
FT2FontEntry::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, FT2FontEntry::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const FontListSizes* aSizes) const
{ {
gfxFontEntry::SizeOfExcludingThis(aMallocSizeOf, aSizes); gfxFontEntry::SizeOfExcludingThis(aMallocSizeOf, aSizes);
@ -473,7 +474,7 @@ FT2FontEntry::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf,
} }
void void
FT2FontEntry::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, FT2FontEntry::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const FontListSizes* aSizes) const
{ {
aSizes->mFontListSize += aMallocSizeOf(this); aSizes->mFontListSize += aMallocSizeOf(this);

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

@ -6,6 +6,8 @@
#ifndef GFX_FT2FONTLIST_H #ifndef GFX_FT2FONTLIST_H
#define GFX_FT2FONTLIST_H #define GFX_FT2FONTLIST_H
#include "mozilla/MemoryReporting.h"
#ifdef XP_WIN #ifdef XP_WIN
#include "gfxWindowsPlatform.h" #include "gfxWindowsPlatform.h"
#include <windows.h> #include <windows.h>
@ -74,9 +76,9 @@ public:
// accordingly so that we avoid using bad font tables // accordingly so that we avoid using bad font tables
void CheckForBrokenFont(gfxFontFamily *aFamily); void CheckForBrokenFont(gfxFontFamily *aFamily);
virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const; FontListSizes* aSizes) const;
virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const; FontListSizes* aSizes) const;
FT_Face mFTFace; FT_Face mFTFace;

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

@ -35,6 +35,7 @@
#include "prlog.h" #include "prlog.h"
#include "prinit.h" #include "prinit.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
// rounding and truncation functions for a Freetype floating point number // rounding and truncation functions for a Freetype floating point number
@ -642,7 +643,7 @@ gfxFT2Font::FillGlyphDataForChar(uint32_t ch, CachedGlyphData *gd)
} }
void void
gfxFT2Font::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxFT2Font::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const FontCacheSizes* aSizes) const
{ {
gfxFont::SizeOfExcludingThis(aMallocSizeOf, aSizes); gfxFont::SizeOfExcludingThis(aMallocSizeOf, aSizes);
@ -651,7 +652,7 @@ gfxFT2Font::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf,
} }
void void
gfxFT2Font::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxFT2Font::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const FontCacheSizes* aSizes) const
{ {
aSizes->mFontInstances += aMallocSizeOf(this); aSizes->mFontInstances += aMallocSizeOf(this);

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

@ -6,6 +6,7 @@
#ifndef GFX_FT2FONTS_H #ifndef GFX_FT2FONTS_H
#define GFX_FT2FONTS_H #define GFX_FT2FONTS_H
#include "mozilla/MemoryReporting.h"
#include "cairo.h" #include "cairo.h"
#include "gfxTypes.h" #include "gfxTypes.h"
#include "gfxFont.h" #include "gfxFont.h"
@ -63,9 +64,9 @@ public: // new functions
return &entry->mData; return &entry->mData;
} }
virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const; FontCacheSizes* aSizes) const;
virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const; FontCacheSizes* aSizes) const;
protected: protected:

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

@ -35,6 +35,7 @@
#include "nsStyleConsts.h" #include "nsStyleConsts.h"
#include "mozilla/FloatingPoint.h" #include "mozilla/FloatingPoint.h"
#include "mozilla/Likely.h" #include "mozilla/Likely.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/Services.h" #include "mozilla/Services.h"
#include "mozilla/Telemetry.h" #include "mozilla/Telemetry.h"
@ -325,10 +326,10 @@ public:
mHashKey = 0; mHashKey = 0;
} }
size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const { size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const {
return mTableData.SizeOfExcludingThis(aMallocSizeOf); return mTableData.SizeOfExcludingThis(aMallocSizeOf);
} }
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const { size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const {
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
} }
@ -576,7 +577,7 @@ gfxFontEntry::CheckForGraphiteTables()
/* static */ size_t /* static */ size_t
gfxFontEntry::FontTableHashEntry::SizeOfEntryExcludingThis gfxFontEntry::FontTableHashEntry::SizeOfEntryExcludingThis
(FontTableHashEntry *aEntry, (FontTableHashEntry *aEntry,
nsMallocSizeOfFun aMallocSizeOf, MallocSizeOf aMallocSizeOf,
void* aUserArg) void* aUserArg)
{ {
FontListSizes *sizes = static_cast<FontListSizes*>(aUserArg); FontListSizes *sizes = static_cast<FontListSizes*>(aUserArg);
@ -594,7 +595,7 @@ gfxFontEntry::FontTableHashEntry::SizeOfEntryExcludingThis
} }
void void
gfxFontEntry::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxFontEntry::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const FontListSizes* aSizes) const
{ {
aSizes->mFontListSize += mName.SizeOfExcludingThisIfUnshared(aMallocSizeOf); aSizes->mFontListSize += mName.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
@ -611,7 +612,7 @@ gfxFontEntry::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf,
} }
void void
gfxFontEntry::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxFontEntry::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const FontListSizes* aSizes) const
{ {
aSizes->mFontListSize += aMallocSizeOf(this); aSizes->mFontListSize += aMallocSizeOf(this);
@ -1197,7 +1198,7 @@ gfxFontFamily::FindFont(const nsAString& aPostscriptName)
} }
void void
gfxFontFamily::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxFontFamily::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const FontListSizes* aSizes) const
{ {
aSizes->mFontListSize += aSizes->mFontListSize +=
@ -1216,7 +1217,7 @@ gfxFontFamily::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf,
} }
void void
gfxFontFamily::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxFontFamily::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const FontListSizes* aSizes) const
{ {
aSizes->mFontListSize += aMallocSizeOf(this); aSizes->mFontListSize += aMallocSizeOf(this);
@ -1476,7 +1477,7 @@ gfxFontCache::ClearCachedWordsForFont(HashEntry* aHashEntry, void* aUserData)
/*static*/ /*static*/
size_t size_t
gfxFontCache::SizeOfFontEntryExcludingThis(HashEntry* aHashEntry, gfxFontCache::SizeOfFontEntryExcludingThis(HashEntry* aHashEntry,
nsMallocSizeOfFun aMallocSizeOf, MallocSizeOf aMallocSizeOf,
void* aUserArg) void* aUserArg)
{ {
HashEntry *entry = static_cast<HashEntry*>(aHashEntry); HashEntry *entry = static_cast<HashEntry*>(aHashEntry);
@ -1489,7 +1490,7 @@ gfxFontCache::SizeOfFontEntryExcludingThis(HashEntry* aHashEntry,
} }
void void
gfxFontCache::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxFontCache::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const FontCacheSizes* aSizes) const
{ {
// TODO: add the overhead of the expiration tracker (generation arrays) // TODO: add the overhead of the expiration tracker (generation arrays)
@ -1499,7 +1500,7 @@ gfxFontCache::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf,
} }
void void
gfxFontCache::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxFontCache::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const FontCacheSizes* aSizes) const
{ {
aSizes->mFontInstances += aMallocSizeOf(this); aSizes->mFontInstances += aMallocSizeOf(this);
@ -3671,14 +3672,14 @@ gfxFont::SynthesizeSpaceWidth(uint32_t aCh)
/*static*/ size_t /*static*/ size_t
gfxFont::WordCacheEntrySizeOfExcludingThis(CacheHashEntry* aHashEntry, gfxFont::WordCacheEntrySizeOfExcludingThis(CacheHashEntry* aHashEntry,
nsMallocSizeOfFun aMallocSizeOf, MallocSizeOf aMallocSizeOf,
void* aUserArg) void* aUserArg)
{ {
return aMallocSizeOf(aHashEntry->mShapedWord.get()); return aMallocSizeOf(aHashEntry->mShapedWord.get());
} }
void void
gfxFont::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxFont::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const FontCacheSizes* aSizes) const
{ {
for (uint32_t i = 0; i < mGlyphExtentsArray.Length(); ++i) { for (uint32_t i = 0; i < mGlyphExtentsArray.Length(); ++i) {
@ -3691,7 +3692,7 @@ gfxFont::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf,
} }
void void
gfxFont::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxFont::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const FontCacheSizes* aSizes) const
{ {
aSizes->mFontInstances += aMallocSizeOf(this); aSizes->mFontInstances += aMallocSizeOf(this);
@ -3748,7 +3749,7 @@ gfxGlyphExtents::GlyphWidths::~GlyphWidths()
} }
uint32_t uint32_t
gfxGlyphExtents::GlyphWidths::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const gfxGlyphExtents::GlyphWidths::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{ {
uint32_t i; uint32_t i;
uint32_t size = mBlocks.SizeOfExcludingThis(aMallocSizeOf); uint32_t size = mBlocks.SizeOfExcludingThis(aMallocSizeOf);
@ -3812,14 +3813,14 @@ gfxGlyphExtents::SetTightGlyphExtents(uint32_t aGlyphID, const gfxRect& aExtents
} }
size_t size_t
gfxGlyphExtents::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const gfxGlyphExtents::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{ {
return mContainedGlyphWidths.SizeOfExcludingThis(aMallocSizeOf) + return mContainedGlyphWidths.SizeOfExcludingThis(aMallocSizeOf) +
mTightGlyphExtents.SizeOfExcludingThis(nullptr, aMallocSizeOf); mTightGlyphExtents.SizeOfExcludingThis(nullptr, aMallocSizeOf);
} }
size_t size_t
gfxGlyphExtents::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const gfxGlyphExtents::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{ {
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
} }
@ -6547,7 +6548,7 @@ gfxTextRun::ClusterIterator::ClusterAdvance(PropertyProvider *aProvider) const
} }
size_t size_t
gfxTextRun::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) gfxTextRun::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf)
{ {
// The second arg is how much gfxTextRun::AllocateStorage would have // The second arg is how much gfxTextRun::AllocateStorage would have
// allocated. // allocated.
@ -6561,7 +6562,7 @@ gfxTextRun::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf)
} }
size_t size_t
gfxTextRun::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) gfxTextRun::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf)
{ {
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
} }

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

@ -25,6 +25,7 @@
#include "mozilla/HashFunctions.h" #include "mozilla/HashFunctions.h"
#include "nsIMemoryReporter.h" #include "nsIMemoryReporter.h"
#include "gfxFontFeatures.h" #include "gfxFontFeatures.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/gfx/Types.h" #include "mozilla/gfx/Types.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include <algorithm> #include <algorithm>
@ -196,7 +197,7 @@ public:
void CalcHash() { mHash = GetChecksum(); } void CalcHash() { mHash = GetChecksum(); }
size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const { size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
return gfxSparseBitSet::SizeOfExcludingThis(aMallocSizeOf); return gfxSparseBitSet::SizeOfExcludingThis(aMallocSizeOf);
} }
@ -411,9 +412,9 @@ public:
virtual void ReleaseGrFace(gr_face* aFace); virtual void ReleaseGrFace(gr_face* aFace);
// For memory reporting // For memory reporting
virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const; FontListSizes* aSizes) const;
virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const; FontListSizes* aSizes) const;
nsString mName; nsString mName;
@ -620,7 +621,7 @@ private:
static size_t static size_t
SizeOfEntryExcludingThis(FontTableHashEntry *aEntry, SizeOfEntryExcludingThis(FontTableHashEntry *aEntry,
nsMallocSizeOfFun aMallocSizeOf, mozilla::MallocSizeOf aMallocSizeOf,
void* aUserArg); void* aUserArg);
private: private:
@ -781,9 +782,9 @@ public:
void CheckForSimpleFamily(); void CheckForSimpleFamily();
// For memory reporter // For memory reporter
virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const; FontListSizes* aSizes) const;
virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const; FontListSizes* aSizes) const;
// Only used for debugging checks - does a linear search // Only used for debugging checks - does a linear search
@ -949,9 +950,9 @@ public:
mFonts.EnumerateEntries(ClearCachedWordsForFont, nullptr); mFonts.EnumerateEntries(ClearCachedWordsForFont, nullptr);
} }
void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const; FontCacheSizes* aSizes) const;
void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const; FontCacheSizes* aSizes) const;
protected: protected:
@ -996,7 +997,7 @@ protected:
}; };
static size_t SizeOfFontEntryExcludingThis(HashEntry* aHashEntry, static size_t SizeOfFontEntryExcludingThis(HashEntry* aHashEntry,
nsMallocSizeOfFun aMallocSizeOf, mozilla::MallocSizeOf aMallocSizeOf,
void* aUserArg); void* aUserArg);
nsTHashtable<HashEntry> mFonts; nsTHashtable<HashEntry> mFonts;
@ -1170,8 +1171,8 @@ public:
int32_t GetAppUnitsPerDevUnit() { return mAppUnitsPerDevUnit; } int32_t GetAppUnitsPerDevUnit() { return mAppUnitsPerDevUnit; }
size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
private: private:
class HashEntry : public nsUint32HashKey { class HashEntry : public nsUint32HashKey {
@ -1208,7 +1209,7 @@ private:
return widths[indexInBlock]; return widths[indexInBlock];
} }
uint32_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const; uint32_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
~GlyphWidths(); ~GlyphWidths();
@ -1675,9 +1676,9 @@ public:
} }
} }
virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const; FontCacheSizes* aSizes) const;
virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const; FontCacheSizes* aSizes) const;
typedef enum { typedef enum {
@ -1885,7 +1886,7 @@ protected:
static size_t static size_t
WordCacheEntrySizeOfExcludingThis(CacheHashEntry* aHashEntry, WordCacheEntrySizeOfExcludingThis(CacheHashEntry* aHashEntry,
nsMallocSizeOfFun aMallocSizeOf, mozilla::MallocSizeOf aMallocSizeOf,
void* aUserArg); void* aUserArg);
nsTHashtable<CacheHashEntry> mWordCache; nsTHashtable<CacheHashEntry> mWordCache;
@ -2378,7 +2379,7 @@ protected:
return details; return details;
} }
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) { size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) {
return aMallocSizeOf(this) + return aMallocSizeOf(this) +
mDetails.SizeOfExcludingThis(aMallocSizeOf) + mDetails.SizeOfExcludingThis(aMallocSizeOf) +
mOffsetToIndex.SizeOfExcludingThis(aMallocSizeOf); mOffsetToIndex.SizeOfExcludingThis(aMallocSizeOf);
@ -3136,13 +3137,13 @@ public:
// return storage used by this run, for memory reporter; // return storage used by this run, for memory reporter;
// nsTransformedTextRun needs to override this as it holds additional data // nsTransformedTextRun needs to override this as it holds additional data
virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf)
MOZ_MUST_OVERRIDE; MOZ_MUST_OVERRIDE;
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
MOZ_MUST_OVERRIDE; MOZ_MUST_OVERRIDE;
// Get the size, if it hasn't already been gotten, marking as it goes. // Get the size, if it hasn't already been gotten, marking as it goes.
size_t MaybeSizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) { size_t MaybeSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) {
if (mFlags & gfxTextRunFactory::TEXT_RUN_SIZE_ACCOUNTED) { if (mFlags & gfxTextRunFactory::TEXT_RUN_SIZE_ACCOUNTED) {
return 0; return 0;
} }

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

@ -23,6 +23,7 @@
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
#include "mozilla/Likely.h" #include "mozilla/Likely.h"
#include "mozilla/Endian.h" #include "mozilla/Endian.h"
#include "mozilla/MemoryReporting.h"
#include "zlib.h" #include "zlib.h"
#include <algorithm> #include <algorithm>
@ -257,7 +258,7 @@ public:
} }
} }
size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const { size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
size_t total = mBlocks.SizeOfExcludingThis(aMallocSizeOf); size_t total = mBlocks.SizeOfExcludingThis(aMallocSizeOf);
for (uint32_t i = 0; i < mBlocks.Length(); i++) { for (uint32_t i = 0; i < mBlocks.Length(); i++) {
if (mBlocks[i]) { if (mBlocks[i]) {
@ -267,7 +268,7 @@ public:
return total; return total;
} }
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const { size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
} }

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

@ -3,6 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/MemoryReporting.h"
#include "gfxGDIFont.h" #include "gfxGDIFont.h"
#include "gfxGDIShaper.h" #include "gfxGDIShaper.h"
#include "gfxUniscribeShaper.h" #include "gfxUniscribeShaper.h"
@ -551,7 +552,7 @@ gfxGDIFont::GetGlyphWidth(gfxContext *aCtx, uint16_t aGID)
} }
void void
gfxGDIFont::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxGDIFont::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const FontCacheSizes* aSizes) const
{ {
gfxFont::SizeOfExcludingThis(aMallocSizeOf, aSizes); gfxFont::SizeOfExcludingThis(aMallocSizeOf, aSizes);
@ -560,7 +561,7 @@ gfxGDIFont::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf,
} }
void void
gfxGDIFont::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxGDIFont::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const FontCacheSizes* aSizes) const
{ {
aSizes->mFontInstances += aMallocSizeOf(this); aSizes->mFontInstances += aMallocSizeOf(this);

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

@ -6,6 +6,7 @@
#ifndef GFX_GDIFONT_H #ifndef GFX_GDIFONT_H
#define GFX_GDIFONT_H #define GFX_GDIFONT_H
#include "mozilla/MemoryReporting.h"
#include "gfxFont.h" #include "gfxFont.h"
#include "gfxGDIFontList.h" #include "gfxGDIFontList.h"
@ -53,9 +54,9 @@ public:
// get hinted glyph width in pixels as 16.16 fixed-point value // get hinted glyph width in pixels as 16.16 fixed-point value
virtual int32_t GetGlyphWidth(gfxContext *aCtx, uint16_t aGID); virtual int32_t GetGlyphWidth(gfxContext *aCtx, uint16_t aGID);
virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const; FontCacheSizes* aSizes) const;
virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const; FontCacheSizes* aSizes) const;
virtual FontType GetType() const { return FONT_TYPE_GDI; } virtual FontType GetType() const { return FONT_TYPE_GDI; }

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

@ -27,6 +27,7 @@
#include "nsISimpleEnumerator.h" #include "nsISimpleEnumerator.h"
#include "nsIWindowsRegKey.h" #include "nsIWindowsRegKey.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Telemetry.h" #include "mozilla/Telemetry.h"
#include <usp10.h> #include <usp10.h>
@ -444,7 +445,7 @@ GDIFontEntry::CreateFontEntry(const nsAString& aName,
} }
void void
GDIFontEntry::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, GDIFontEntry::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const FontListSizes* aSizes) const
{ {
aSizes->mFontListSize += aMallocSizeOf(this); aSizes->mFontListSize += aMallocSizeOf(this);
@ -1065,7 +1066,7 @@ gfxGDIFontList::ResolveFontName(const nsAString& aFontName, nsAString& aResolved
} }
void void
gfxGDIFontList::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxGDIFontList::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const FontListSizes* aSizes) const
{ {
gfxPlatformFontList::SizeOfExcludingThis(aMallocSizeOf, aSizes); gfxPlatformFontList::SizeOfExcludingThis(aMallocSizeOf, aSizes);
@ -1081,7 +1082,7 @@ gfxGDIFontList::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf,
} }
void void
gfxGDIFontList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxGDIFontList::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const FontListSizes* aSizes) const
{ {
aSizes->mFontListSize += aMallocSizeOf(this); aSizes->mFontListSize += aMallocSizeOf(this);

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

@ -6,6 +6,7 @@
#ifndef GFX_GDIFONTLIST_H #ifndef GFX_GDIFONTLIST_H
#define GFX_GDIFONTLIST_H #define GFX_GDIFONTLIST_H
#include "mozilla/MemoryReporting.h"
#include "gfxWindowsPlatform.h" #include "gfxWindowsPlatform.h"
#include "gfxPlatformFontList.h" #include "gfxPlatformFontList.h"
#include "nsGkAtoms.h" #include "nsGkAtoms.h"
@ -239,7 +240,7 @@ public:
virtual bool TestCharacterMap(uint32_t aCh); virtual bool TestCharacterMap(uint32_t aCh);
virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const; FontListSizes* aSizes) const;
// create a font entry for a font with a given name // create a font entry for a font with a given name
@ -321,9 +322,9 @@ public:
virtual bool ResolveFontName(const nsAString& aFontName, virtual bool ResolveFontName(const nsAString& aFontName,
nsAString& aResolvedFontName); nsAString& aResolvedFontName);
virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const; FontListSizes* aSizes) const;
virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const; FontListSizes* aSizes) const;
private: private:

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

@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/MemoryReporting.h"
#include "gfxAlphaRecovery.h" #include "gfxAlphaRecovery.h"
#include "gfxImageSurface.h" #include "gfxImageSurface.h"
@ -197,7 +198,7 @@ gfxImageSurface::ComputeStride(const gfxIntSize& aSize, gfxImageFormat aFormat)
} }
size_t size_t
gfxImageSurface::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const gfxImageSurface::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
{ {
size_t n = gfxASurface::SizeOfExcludingThis(aMallocSizeOf); size_t n = gfxASurface::SizeOfExcludingThis(aMallocSizeOf);
if (mOwnsData) { if (mOwnsData) {
@ -207,7 +208,7 @@ gfxImageSurface::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
} }
size_t size_t
gfxImageSurface::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const gfxImageSurface::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
{ {
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
} }

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

@ -6,6 +6,7 @@
#ifndef GFX_IMAGESURFACE_H #ifndef GFX_IMAGESURFACE_H
#define GFX_IMAGESURFACE_H #define GFX_IMAGESURFACE_H
#include "mozilla/MemoryReporting.h"
#include "gfxASurface.h" #include "gfxASurface.h"
#include "gfxPoint.h" #include "gfxPoint.h"
@ -113,9 +114,9 @@ public:
static long ComputeStride(const gfxIntSize&, gfxImageFormat); static long ComputeStride(const gfxIntSize&, gfxImageFormat);
virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
MOZ_OVERRIDE; MOZ_OVERRIDE;
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
MOZ_OVERRIDE; MOZ_OVERRIDE;
virtual bool SizeOfIsMeasured() const MOZ_OVERRIDE; virtual bool SizeOfIsMeasured() const MOZ_OVERRIDE;

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

@ -3,6 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/MemoryReporting.h"
#include "gfxMacFont.h" #include "gfxMacFont.h"
#include "gfxCoreTextShaper.h" #include "gfxCoreTextShaper.h"
#include "gfxHarfBuzzShaper.h" #include "gfxHarfBuzzShaper.h"
@ -410,7 +411,7 @@ gfxMacFont::GetScaledFont(DrawTarget *aTarget)
} }
void void
gfxMacFont::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxMacFont::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const FontCacheSizes* aSizes) const
{ {
gfxFont::SizeOfExcludingThis(aMallocSizeOf, aSizes); gfxFont::SizeOfExcludingThis(aMallocSizeOf, aSizes);
@ -419,7 +420,7 @@ gfxMacFont::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf,
} }
void void
gfxMacFont::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxMacFont::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const FontCacheSizes* aSizes) const
{ {
aSizes->mFontInstances += aMallocSizeOf(this); aSizes->mFontInstances += aMallocSizeOf(this);

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

@ -6,6 +6,7 @@
#ifndef GFX_MACFONT_H #ifndef GFX_MACFONT_H
#define GFX_MACFONT_H #define GFX_MACFONT_H
#include "mozilla/MemoryReporting.h"
#include "gfxFont.h" #include "gfxFont.h"
#include "gfxMacPlatformFontList.h" #include "gfxMacPlatformFontList.h"
#include "mozilla/gfx/2D.h" #include "mozilla/gfx/2D.h"
@ -42,9 +43,9 @@ public:
virtual mozilla::TemporaryRef<mozilla::gfx::ScaledFont> GetScaledFont(mozilla::gfx::DrawTarget *aTarget); virtual mozilla::TemporaryRef<mozilla::gfx::ScaledFont> GetScaledFont(mozilla::gfx::DrawTarget *aTarget);
virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const; FontCacheSizes* aSizes) const;
virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const; FontCacheSizes* aSizes) const;
virtual FontType GetType() const { return FONT_TYPE_MAC; } virtual FontType GetType() const { return FONT_TYPE_MAC; }

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

@ -6,6 +6,7 @@
#ifndef gfxMacPlatformFontList_H_ #ifndef gfxMacPlatformFontList_H_
#define gfxMacPlatformFontList_H_ #define gfxMacPlatformFontList_H_
#include "mozilla/MemoryReporting.h"
#include "nsDataHashtable.h" #include "nsDataHashtable.h"
#include "nsRefPtrHashtable.h" #include "nsRefPtrHashtable.h"
@ -44,7 +45,7 @@ public:
// use CGFontRef API to get direct access to system font data // use CGFontRef API to get direct access to system font data
virtual hb_blob_t *GetFontTable(uint32_t aTag) MOZ_OVERRIDE; virtual hb_blob_t *GetFontTable(uint32_t aTag) MOZ_OVERRIDE;
virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const; FontListSizes* aSizes) const;
nsresult ReadCMAP(); nsresult ReadCMAP();

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

@ -63,6 +63,7 @@
#include "nsISimpleEnumerator.h" #include "nsISimpleEnumerator.h"
#include "nsCharTraits.h" #include "nsCharTraits.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h" #include "mozilla/Telemetry.h"
@ -423,7 +424,7 @@ MacOSFontEntry::HasFontTable(uint32_t aTableTag)
} }
void void
MacOSFontEntry::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, MacOSFontEntry::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const FontListSizes* aSizes) const
{ {
aSizes->mFontListSize += aMallocSizeOf(this); aSizes->mFontListSize += aMallocSizeOf(this);

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

@ -16,6 +16,7 @@
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/Likely.h" #include "mozilla/Likely.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h" #include "mozilla/Telemetry.h"
#include "mozilla/TimeStamp.h" #include "mozilla/TimeStamp.h"
@ -764,7 +765,7 @@ gfxPlatformFontList::GetPrefsAndStartLoader()
static size_t static size_t
SizeOfFamilyEntryExcludingThis(const nsAString& aKey, SizeOfFamilyEntryExcludingThis(const nsAString& aKey,
const nsRefPtr<gfxFontFamily>& aFamily, const nsRefPtr<gfxFontFamily>& aFamily,
nsMallocSizeOfFun aMallocSizeOf, MallocSizeOf aMallocSizeOf,
void* aUserArg) void* aUserArg)
{ {
FontListSizes *sizes = static_cast<FontListSizes*>(aUserArg); FontListSizes *sizes = static_cast<FontListSizes*>(aUserArg);
@ -782,7 +783,7 @@ SizeOfFamilyEntryExcludingThis(const nsAString& aKey,
gfxPlatformFontList::SizeOfFamilyNameEntryExcludingThis gfxPlatformFontList::SizeOfFamilyNameEntryExcludingThis
(const nsAString& aKey, (const nsAString& aKey,
const nsRefPtr<gfxFontFamily>& aFamily, const nsRefPtr<gfxFontFamily>& aFamily,
nsMallocSizeOfFun aMallocSizeOf, MallocSizeOf aMallocSizeOf,
void* aUserArg) void* aUserArg)
{ {
// we don't count the size of the family here, because this is an *extra* // we don't count the size of the family here, because this is an *extra*
@ -793,7 +794,7 @@ gfxPlatformFontList::SizeOfFamilyNameEntryExcludingThis
static size_t static size_t
SizeOfFontNameEntryExcludingThis(const nsAString& aKey, SizeOfFontNameEntryExcludingThis(const nsAString& aKey,
const nsRefPtr<gfxFontEntry>& aFont, const nsRefPtr<gfxFontEntry>& aFont,
nsMallocSizeOfFun aMallocSizeOf, MallocSizeOf aMallocSizeOf,
void* aUserArg) void* aUserArg)
{ {
// the font itself is counted by its owning family; here we only care about // the font itself is counted by its owning family; here we only care about
@ -805,7 +806,7 @@ static size_t
SizeOfPrefFontEntryExcludingThis SizeOfPrefFontEntryExcludingThis
(const uint32_t& aKey, (const uint32_t& aKey,
const nsTArray<nsRefPtr<gfxFontFamily> >& aList, const nsTArray<nsRefPtr<gfxFontFamily> >& aList,
nsMallocSizeOfFun aMallocSizeOf, MallocSizeOf aMallocSizeOf,
void* aUserArg) void* aUserArg)
{ {
// again, we only care about the size of the array itself; we don't follow // again, we only care about the size of the array itself; we don't follow
@ -816,7 +817,7 @@ SizeOfPrefFontEntryExcludingThis
static size_t static size_t
SizeOfStringEntryExcludingThis(nsStringHashKey* aHashEntry, SizeOfStringEntryExcludingThis(nsStringHashKey* aHashEntry,
nsMallocSizeOfFun aMallocSizeOf, MallocSizeOf aMallocSizeOf,
void* aUserArg) void* aUserArg)
{ {
return aHashEntry->GetKey().SizeOfExcludingThisIfUnshared(aMallocSizeOf); return aHashEntry->GetKey().SizeOfExcludingThisIfUnshared(aMallocSizeOf);
@ -824,7 +825,7 @@ SizeOfStringEntryExcludingThis(nsStringHashKey* aHashEntry,
static size_t static size_t
SizeOfSharedCmapExcludingThis(CharMapHashKey* aHashEntry, SizeOfSharedCmapExcludingThis(CharMapHashKey* aHashEntry,
nsMallocSizeOfFun aMallocSizeOf, MallocSizeOf aMallocSizeOf,
void* aUserArg) void* aUserArg)
{ {
FontListSizes *sizes = static_cast<FontListSizes*>(aUserArg); FontListSizes *sizes = static_cast<FontListSizes*>(aUserArg);
@ -838,8 +839,8 @@ SizeOfSharedCmapExcludingThis(CharMapHashKey* aHashEntry,
} }
void void
gfxPlatformFontList::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxPlatformFontList::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const FontListSizes* aSizes) const
{ {
aSizes->mFontListSize += aSizes->mFontListSize +=
mFontFamilies.SizeOfExcludingThis(SizeOfFamilyEntryExcludingThis, mFontFamilies.SizeOfExcludingThis(SizeOfFamilyEntryExcludingThis,
@ -877,8 +878,8 @@ gfxPlatformFontList::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf,
} }
void void
gfxPlatformFontList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, gfxPlatformFontList::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const FontListSizes* aSizes) const
{ {
aSizes->mFontListSize += aMallocSizeOf(this); aSizes->mFontListSize += aMallocSizeOf(this);
SizeOfExcludingThis(aMallocSizeOf, aSizes); SizeOfExcludingThis(aMallocSizeOf, aSizes);

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

@ -16,6 +16,7 @@
#include "nsIMemoryReporter.h" #include "nsIMemoryReporter.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
class CharMapHashKey : public PLDHashEntryHdr class CharMapHashKey : public PLDHashEntryHdr
{ {
@ -161,9 +162,9 @@ public:
// (platforms may override, eg Mac) // (platforms may override, eg Mac)
virtual bool GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName); virtual bool GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName);
virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const; FontListSizes* aSizes) const;
virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, virtual void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontListSizes* aSizes) const; FontListSizes* aSizes) const;
// search for existing cmap that matches the input // search for existing cmap that matches the input
@ -252,7 +253,7 @@ protected:
static size_t static size_t
SizeOfFamilyNameEntryExcludingThis(const nsAString& aKey, SizeOfFamilyNameEntryExcludingThis(const nsAString& aKey,
const nsRefPtr<gfxFontFamily>& aFamily, const nsRefPtr<gfxFontFamily>& aFamily,
nsMallocSizeOfFun aMallocSizeOf, mozilla::MallocSizeOf aMallocSizeOf,
void* aUserArg); void* aUserArg);
// canonical family name ==> family entry (unique, one name per family entry) // canonical family name ==> family entry (unique, one name per family entry)

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

@ -5,6 +5,7 @@
#include "FrameBlender.h" #include "FrameBlender.h"
#include "mozilla/MemoryReporting.h"
#include "RasterImage.h" #include "RasterImage.h"
#include "imgFrame.h" #include "imgFrame.h"
@ -573,7 +574,7 @@ FrameBlender::Discard()
size_t size_t
FrameBlender::SizeOfDecodedWithComputedFallbackIfHeap(gfxASurface::MemoryLocation aLocation, FrameBlender::SizeOfDecodedWithComputedFallbackIfHeap(gfxASurface::MemoryLocation aLocation,
nsMallocSizeOfFun aMallocSizeOf) const MallocSizeOf aMallocSizeOf) const
{ {
size_t n = 0; size_t n = 0;
for (uint32_t i = 0; i < mFrames.Length(); ++i) { for (uint32_t i = 0; i < mFrames.Length(); ++i) {

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

@ -8,6 +8,7 @@
#define mozilla_imagelib_FrameBlender_h_ #define mozilla_imagelib_FrameBlender_h_
#include "nsTArray.h" #include "nsTArray.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/TimeStamp.h" #include "mozilla/TimeStamp.h"
#include "gfxASurface.h" #include "gfxASurface.h"
@ -57,7 +58,7 @@ public:
void SetSize(nsIntSize aSize) { mSize = aSize; } void SetSize(nsIntSize aSize) { mSize = aSize; }
size_t SizeOfDecodedWithComputedFallbackIfHeap(gfxASurface::MemoryLocation aLocation, size_t SizeOfDecodedWithComputedFallbackIfHeap(gfxASurface::MemoryLocation aLocation,
nsMallocSizeOfFun aMallocSizeOf) const; mozilla::MallocSizeOf aMallocSizeOf) const;
void ResetAnimation(); void ResetAnimation();

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

@ -6,6 +6,7 @@
#ifndef MOZILLA_IMAGELIB_IMAGE_H_ #ifndef MOZILLA_IMAGELIB_IMAGE_H_
#define MOZILLA_IMAGELIB_IMAGE_H_ #define MOZILLA_IMAGELIB_IMAGE_H_
#include "mozilla/MemoryReporting.h"
#include "imgIContainer.h" #include "imgIContainer.h"
#include "imgStatusTracker.h" #include "imgStatusTracker.h"
#include "nsIURI.h" #include "nsIURI.h"
@ -77,8 +78,8 @@ public:
/** /**
* The components that make up SizeOfData(). * The components that make up SizeOfData().
*/ */
virtual size_t HeapSizeOfSourceWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const = 0; virtual size_t HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const = 0;
virtual size_t HeapSizeOfDecodedWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const = 0; virtual size_t HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const = 0;
virtual size_t NonHeapSizeOfDecoded() const = 0; virtual size_t NonHeapSizeOfDecoded() const = 0;
virtual size_t OutOfProcessSizeOfDecoded() const = 0; virtual size_t OutOfProcessSizeOfDecoded() const = 0;

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

@ -3,6 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/MemoryReporting.h"
#include "ImageWrapper.h" #include "ImageWrapper.h"
using mozilla::layers::LayerManager; using mozilla::layers::LayerManager;
@ -38,13 +39,13 @@ ImageWrapper::SizeOfData()
} }
size_t size_t
ImageWrapper::HeapSizeOfSourceWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const ImageWrapper::HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const
{ {
return mInnerImage->HeapSizeOfSourceWithComputedFallback(aMallocSizeOf); return mInnerImage->HeapSizeOfSourceWithComputedFallback(aMallocSizeOf);
} }
size_t size_t
ImageWrapper::HeapSizeOfDecodedWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const ImageWrapper::HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const
{ {
return mInnerImage->HeapSizeOfDecodedWithComputedFallback(aMallocSizeOf); return mInnerImage->HeapSizeOfDecodedWithComputedFallback(aMallocSizeOf);
} }

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

@ -6,6 +6,7 @@
#ifndef MOZILLA_IMAGELIB_IMAGEWRAPPER_H_ #ifndef MOZILLA_IMAGELIB_IMAGEWRAPPER_H_
#define MOZILLA_IMAGELIB_IMAGEWRAPPER_H_ #define MOZILLA_IMAGELIB_IMAGEWRAPPER_H_
#include "mozilla/MemoryReporting.h"
#include "Image.h" #include "Image.h"
namespace mozilla { namespace mozilla {
@ -29,8 +30,8 @@ public:
virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE; virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE;
virtual uint32_t SizeOfData() MOZ_OVERRIDE; virtual uint32_t SizeOfData() MOZ_OVERRIDE;
virtual size_t HeapSizeOfSourceWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE; virtual size_t HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
virtual size_t HeapSizeOfDecodedWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE; virtual size_t HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
virtual size_t NonHeapSizeOfDecoded() const MOZ_OVERRIDE; virtual size_t NonHeapSizeOfDecoded() const MOZ_OVERRIDE;
virtual size_t OutOfProcessSizeOfDecoded() const MOZ_OVERRIDE; virtual size_t OutOfProcessSizeOfDecoded() const MOZ_OVERRIDE;

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

@ -38,6 +38,7 @@
#include "gfxContext.h" #include "gfxContext.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Services.h" #include "mozilla/Services.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/StandardInteger.h" #include "mozilla/StandardInteger.h"
@ -1182,7 +1183,7 @@ RasterImage::UpdateImageContainer()
} }
size_t size_t
RasterImage::HeapSizeOfSourceWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const RasterImage::HeapSizeOfSourceWithComputedFallback(MallocSizeOf aMallocSizeOf) const
{ {
// n == 0 is possible for two reasons. // n == 0 is possible for two reasons.
// - This is a zero-length image. // - This is a zero-length image.
@ -1197,7 +1198,7 @@ RasterImage::HeapSizeOfSourceWithComputedFallback(nsMallocSizeOfFun aMallocSizeO
size_t size_t
RasterImage::SizeOfDecodedWithComputedFallbackIfHeap(gfxASurface::MemoryLocation aLocation, RasterImage::SizeOfDecodedWithComputedFallbackIfHeap(gfxASurface::MemoryLocation aLocation,
nsMallocSizeOfFun aMallocSizeOf) const MallocSizeOf aMallocSizeOf) const
{ {
size_t n = mFrameBlender.SizeOfDecodedWithComputedFallbackIfHeap(aLocation, aMallocSizeOf); size_t n = mFrameBlender.SizeOfDecodedWithComputedFallbackIfHeap(aLocation, aMallocSizeOf);
@ -1209,7 +1210,7 @@ RasterImage::SizeOfDecodedWithComputedFallbackIfHeap(gfxASurface::MemoryLocation
} }
size_t size_t
RasterImage::HeapSizeOfDecodedWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const RasterImage::HeapSizeOfDecodedWithComputedFallback(MallocSizeOf aMallocSizeOf) const
{ {
return SizeOfDecodedWithComputedFallbackIfHeap(gfxASurface::MEMORY_IN_PROCESS_HEAP, return SizeOfDecodedWithComputedFallbackIfHeap(gfxASurface::MEMORY_IN_PROCESS_HEAP,
aMallocSizeOf); aMallocSizeOf);

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

@ -29,6 +29,7 @@
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "DiscardTracker.h" #include "DiscardTracker.h"
#include "nsISupportsImpl.h" #include "nsISupportsImpl.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/TimeStamp.h" #include "mozilla/TimeStamp.h"
#include "mozilla/Telemetry.h" #include "mozilla/Telemetry.h"
#include "mozilla/LinkedList.h" #include "mozilla/LinkedList.h"
@ -176,8 +177,8 @@ public:
/* The total number of frames in this image. */ /* The total number of frames in this image. */
uint32_t GetNumFrames() const; uint32_t GetNumFrames() const;
virtual size_t HeapSizeOfSourceWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const; virtual size_t HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const;
virtual size_t HeapSizeOfDecodedWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const; virtual size_t HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const;
virtual size_t NonHeapSizeOfDecoded() const; virtual size_t NonHeapSizeOfDecoded() const;
virtual size_t OutOfProcessSizeOfDecoded() const; virtual size_t OutOfProcessSizeOfDecoded() const;
@ -589,7 +590,7 @@ private:
mozilla::TimeStamp GetCurrentImgFrameEndTime() const; mozilla::TimeStamp GetCurrentImgFrameEndTime() const;
size_t SizeOfDecodedWithComputedFallbackIfHeap(gfxASurface::MemoryLocation aLocation, size_t SizeOfDecodedWithComputedFallbackIfHeap(gfxASurface::MemoryLocation aLocation,
nsMallocSizeOfFun aMallocSizeOf) const; mozilla::MallocSizeOf aMallocSizeOf) const;
inline void EnsureAnimExists() inline void EnsureAnimExists()
{ {

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

@ -13,6 +13,7 @@
#include "gfxUtils.h" #include "gfxUtils.h"
#include "imgDecoderObserver.h" #include "imgDecoderObserver.h"
#include "mozilla/AutoRestore.h" #include "mozilla/AutoRestore.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/SVGSVGElement.h" #include "mozilla/dom/SVGSVGElement.h"
#include "nsComponentManagerUtils.h" #include "nsComponentManagerUtils.h"
#include "nsIObserverService.h" #include "nsIObserverService.h"
@ -341,7 +342,7 @@ VectorImage::FrameRect(uint32_t aWhichFrame)
} }
size_t size_t
VectorImage::HeapSizeOfSourceWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const VectorImage::HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const
{ {
// We're not storing the source data -- we just feed that directly to // We're not storing the source data -- we just feed that directly to
// our helper SVG document as we receive it, for it to parse. // our helper SVG document as we receive it, for it to parse.
@ -350,7 +351,7 @@ VectorImage::HeapSizeOfSourceWithComputedFallback(nsMallocSizeOfFun aMallocSizeO
} }
size_t size_t
VectorImage::HeapSizeOfDecodedWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const VectorImage::HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const
{ {
// XXXdholbert TODO: return num bytes used by helper SVG doc. (bug 590790) // XXXdholbert TODO: return num bytes used by helper SVG doc. (bug 590790)
return 0; return 0;

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

@ -9,6 +9,7 @@
#include "Image.h" #include "Image.h"
#include "nsIStreamListener.h" #include "nsIStreamListener.h"
#include "nsIRequest.h" #include "nsIRequest.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/TimeStamp.h" #include "mozilla/TimeStamp.h"
#include "mozilla/WeakPtr.h" #include "mozilla/WeakPtr.h"
@ -43,8 +44,8 @@ public:
uint32_t aFlags); uint32_t aFlags);
virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE; virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE;
virtual size_t HeapSizeOfSourceWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const; virtual size_t HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const;
virtual size_t HeapSizeOfDecodedWithComputedFallback(nsMallocSizeOfFun aMallocSizeOf) const; virtual size_t HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const;
virtual size_t NonHeapSizeOfDecoded() const; virtual size_t NonHeapSizeOfDecoded() const;
virtual size_t OutOfProcessSizeOfDecoded() const; virtual size_t OutOfProcessSizeOfDecoded() const;

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

@ -19,6 +19,7 @@ static bool gDisableOptimize = false;
#include "cairo.h" #include "cairo.h"
#include "GeckoProfiler.h" #include "GeckoProfiler.h"
#include "mozilla/Likely.h" #include "mozilla/Likely.h"
#include "mozilla/MemoryReporting.h"
#if defined(XP_WIN) #if defined(XP_WIN)
@ -801,7 +802,7 @@ void imgFrame::SetCompositingFailed(bool val)
// |aMallocSizeOf|. If that fails (because the platform doesn't support it) or // |aMallocSizeOf|. If that fails (because the platform doesn't support it) or
// it's non-heap memory, we fall back to computing the size analytically. // it's non-heap memory, we fall back to computing the size analytically.
size_t size_t
imgFrame::SizeOfExcludingThisWithComputedFallbackIfHeap(gfxASurface::MemoryLocation aLocation, nsMallocSizeOfFun aMallocSizeOf) const imgFrame::SizeOfExcludingThisWithComputedFallbackIfHeap(gfxASurface::MemoryLocation aLocation, mozilla::MallocSizeOf aMallocSizeOf) const
{ {
// aMallocSizeOf is only used if aLocation==MEMORY_IN_PROCESS_HEAP. It // aMallocSizeOf is only used if aLocation==MEMORY_IN_PROCESS_HEAP. It
// should be NULL otherwise. // should be NULL otherwise.

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

@ -7,6 +7,7 @@
#ifndef imgFrame_h #ifndef imgFrame_h
#define imgFrame_h #define imgFrame_h
#include "mozilla/MemoryReporting.h"
#include "nsRect.h" #include "nsRect.h"
#include "nsPoint.h" #include "nsPoint.h"
#include "nsSize.h" #include "nsSize.h"
@ -104,7 +105,7 @@ public:
size_t SizeOfExcludingThisWithComputedFallbackIfHeap( size_t SizeOfExcludingThisWithComputedFallbackIfHeap(
gfxASurface::MemoryLocation aLocation, gfxASurface::MemoryLocation aLocation,
nsMallocSizeOfFun aMallocSizeOf) const; mozilla::MallocSizeOf aMallocSizeOf) const;
uint8_t GetPaletteDepth() const { return mPaletteDepth; } uint8_t GetPaletteDepth() const { return mPaletteDepth; }
uint32_t PaletteDataLength() const { uint32_t PaletteDataLength() const {

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

@ -409,7 +409,7 @@ bool Histogram::HasValidRangeChecksum() const {
return CalculateRangeChecksum() == range_checksum_; return CalculateRangeChecksum() == range_checksum_;
} }
size_t Histogram::SizeOfIncludingThis(size_t (*aMallocSizeOf)(const void*)) size_t Histogram::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
{ {
size_t n = 0; size_t n = 0;
n += aMallocSizeOf(this); n += aMallocSizeOf(this);
@ -420,7 +420,7 @@ size_t Histogram::SizeOfIncludingThis(size_t (*aMallocSizeOf)(const void*))
return n; return n;
} }
size_t Histogram::SampleSet::SizeOfExcludingThis(size_t (*aMallocSizeOf)(const void*)) size_t Histogram::SampleSet::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf)
{ {
// We're not allowed to do deep dives into STL data structures. This // We're not allowed to do deep dives into STL data structures. This
// is as close as we can get to measuring this array. // is as close as we can get to measuring this array.

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

@ -41,6 +41,8 @@
#define BASE_METRICS_HISTOGRAM_H_ #define BASE_METRICS_HISTOGRAM_H_
#pragma once #pragma once
#include "mozilla/MemoryReporting.h"
#include <map> #include <map>
#include <string> #include <string>
#include <vector> #include <vector>
@ -316,10 +318,7 @@ class Histogram {
const char* description; // Null means end of a list of pairs. const char* description; // Null means end of a list of pairs.
}; };
// To avoid depending on XPCOM headers, we define our own MallocSizeOf type. size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf);
typedef size_t (*MallocSizeOf)(const void*);
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf);
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Statistic values, developed over the life of the histogram. // Statistic values, developed over the life of the histogram.
@ -357,7 +356,7 @@ class Histogram {
bool Serialize(Pickle* pickle) const; bool Serialize(Pickle* pickle) const;
bool Deserialize(void** iter, const Pickle& pickle); bool Deserialize(void** iter, const Pickle& pickle);
size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf); size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf);
protected: protected:
// Actual histogram data is stored in buckets, showing the count of values // Actual histogram data is stored in buckets, showing the count of values

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

@ -11,6 +11,7 @@
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/Casting.h" #include "mozilla/Casting.h"
#include "mozilla/DebugOnly.h" #include "mozilla/DebugOnly.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/PodOperations.h" #include "mozilla/PodOperations.h"
#include "mozilla/TypeTraits.h" #include "mozilla/TypeTraits.h"
#include "mozilla/Util.h" #include "mozilla/Util.h"
@ -204,10 +205,10 @@ class HashMap
// Don't just call |impl.sizeOfExcludingThis()| because there's no // Don't just call |impl.sizeOfExcludingThis()| because there's no
// guarantee that |impl| is the first field in HashMap. // guarantee that |impl| is the first field in HashMap.
size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const { size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const {
return impl.sizeOfExcludingThis(mallocSizeOf); return impl.sizeOfExcludingThis(mallocSizeOf);
} }
size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const { size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const {
return mallocSizeOf(this) + impl.sizeOfExcludingThis(mallocSizeOf); return mallocSizeOf(this) + impl.sizeOfExcludingThis(mallocSizeOf);
} }
@ -412,10 +413,10 @@ class HashSet
// Don't just call |impl.sizeOfExcludingThis()| because there's no // Don't just call |impl.sizeOfExcludingThis()| because there's no
// guarantee that |impl| is the first field in HashSet. // guarantee that |impl| is the first field in HashSet.
size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const { size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const {
return impl.sizeOfExcludingThis(mallocSizeOf); return impl.sizeOfExcludingThis(mallocSizeOf);
} }
size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const { size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const {
return mallocSizeOf(this) + impl.sizeOfExcludingThis(mallocSizeOf); return mallocSizeOf(this) + impl.sizeOfExcludingThis(mallocSizeOf);
} }
@ -1340,12 +1341,12 @@ class HashTable : private AllocPolicy
return gen; return gen;
} }
size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const
{ {
return mallocSizeOf(table); return mallocSizeOf(table);
} }
size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const
{ {
return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf); return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf);
} }

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

@ -10,6 +10,8 @@
// These declarations are not within jsapi.h because they are highly likely to // These declarations are not within jsapi.h because they are highly likely to
// change in the future. Depend on them at your own risk. // change in the future. Depend on them at your own risk.
#include "mozilla/MemoryReporting.h"
#include <string.h> #include <string.h>
#include "jsalloc.h" #include "jsalloc.h"
@ -363,7 +365,7 @@ struct CompartmentStats
struct RuntimeStats struct RuntimeStats
{ {
RuntimeStats(JSMallocSizeOfFun mallocSizeOf) RuntimeStats(mozilla::MallocSizeOf mallocSizeOf)
: runtime(), : runtime(),
gcHeapChunkTotal(0), gcHeapChunkTotal(0),
gcHeapDecommittedArenas(0), gcHeapDecommittedArenas(0),
@ -420,7 +422,7 @@ struct RuntimeStats
ZoneStats *currZoneStats; ZoneStats *currZoneStats;
JSMallocSizeOfFun mallocSizeOf_; mozilla::MallocSizeOf mallocSizeOf_;
virtual void initExtraCompartmentStats(JSCompartment *c, CompartmentStats *cstats) = 0; virtual void initExtraCompartmentStats(JSCompartment *c, CompartmentStats *cstats) = 0;
virtual void initExtraZoneStats(JS::Zone *zone, ZoneStats *zstats) = 0; virtual void initExtraZoneStats(JS::Zone *zone, ZoneStats *zstats) = 0;

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

@ -814,11 +814,6 @@ inline bool IsPoisonedPtr(T *v)
} }
/*
* This is SpiderMonkey's equivalent to |nsMallocSizeOfFun|.
*/
typedef size_t(*JSMallocSizeOfFun)(const void *p);
/* sixgill annotation defines */ /* sixgill annotation defines */
#ifndef HAVE_STATIC_ANNOTATIONS #ifndef HAVE_STATIC_ANNOTATIONS
# define HAVE_STATIC_ANNOTATIONS # define HAVE_STATIC_ANNOTATIONS

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

@ -8,6 +8,7 @@
#define js_Vector_h #define js_Vector_h
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/TypeTraits.h" #include "mozilla/TypeTraits.h"
#include "TemplateLib.h" #include "TemplateLib.h"
@ -504,13 +505,13 @@ class Vector : private AllocPolicy
/* /*
* Measure the size of the Vector's heap-allocated storage. * Measure the size of the Vector's heap-allocated storage.
*/ */
size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const; size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
/* /*
* Like sizeOfExcludingThis, but also measures the size of the Vector * Like sizeOfExcludingThis, but also measures the size of the Vector
* object (which must be heap-allocated) itself. * object (which must be heap-allocated) itself.
*/ */
size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const; size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
void swap(Vector &other); void swap(Vector &other);
}; };
@ -1059,14 +1060,14 @@ Vector<T,N,AP>::replaceRawBuffer(T *p, size_t aLength)
template <class T, size_t N, class AP> template <class T, size_t N, class AP>
inline size_t inline size_t
Vector<T,N,AP>::sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const Vector<T,N,AP>::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const
{ {
return usingInlineStorage() ? 0 : mallocSizeOf(beginNoCheck()); return usingInlineStorage() ? 0 : mallocSizeOf(beginNoCheck());
} }
template <class T, size_t N, class AP> template <class T, size_t N, class AP>
inline size_t inline size_t
Vector<T,N,AP>::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const Vector<T,N,AP>::sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const
{ {
return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf); return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf);
} }

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

@ -21,6 +21,10 @@
#include "jscntxtinlines.h" #include "jscntxtinlines.h"
#ifdef JSGC_GENERATIONAL
#include "vm/Shape-inl.h"
#endif
using namespace js; using namespace js;
using mozilla::ArrayLength; using mozilla::ArrayLength;

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

@ -16,6 +16,7 @@
#include "ion/AsmJS.h" #include "ion/AsmJS.h"
#include "vm/ForkJoin.h" #include "vm/ForkJoin.h"
#include "vm/Interpreter.h"
#include "vm/ObjectImpl-inl.h" #include "vm/ObjectImpl-inl.h"

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше