Merge mozilla-inbound into mozilla-central

This commit is contained in:
Ehsan Akhgari 2012-07-04 16:57:19 -04:00
commit 8c06f1acb2
7 changed files with 1797 additions and 166 deletions

View File

@ -29,6 +29,7 @@ const MESSAGES_IN_INTERVAL = 1500;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/ConsoleAPIStorage.jsm");
Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
let gTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
@ -49,64 +50,45 @@ ConsoleAPI.prototype = {
Services.obs.addObserver(this, "xpcom-shutdown", false);
Services.obs.addObserver(this, "inner-window-destroyed", false);
let outerID;
let innerID;
try {
let windowUtils = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
outerID = windowUtils.outerWindowID;
innerID = windowUtils.currentInnerWindowID;
}
catch (ex) {
Cu.reportError(ex);
}
let meta = {
outerID: outerID,
innerID: innerID,
};
let self = this;
let chromeObject = {
// window.console API
log: function CA_log() {
self.queueCall("log", arguments, meta);
self.queueCall("log", arguments, aWindow);
},
info: function CA_info() {
self.queueCall("info", arguments, meta);
self.queueCall("info", arguments, aWindow);
},
warn: function CA_warn() {
self.queueCall("warn", arguments, meta);
self.queueCall("warn", arguments, aWindow);
},
error: function CA_error() {
self.queueCall("error", arguments, meta);
self.queueCall("error", arguments, aWindow);
},
debug: function CA_debug() {
self.queueCall("debug", arguments, meta);
self.queueCall("debug", arguments, aWindow);
},
trace: function CA_trace() {
self.queueCall("trace", arguments, meta);
self.queueCall("trace", arguments, aWindow);
},
// Displays an interactive listing of all the properties of an object.
dir: function CA_dir() {
self.queueCall("dir", arguments, meta);
self.queueCall("dir", arguments, aWindow);
},
group: function CA_group() {
self.queueCall("group", arguments, meta);
self.queueCall("group", arguments, aWindow);
},
groupCollapsed: function CA_groupCollapsed() {
self.queueCall("groupCollapsed", arguments, meta);
self.queueCall("groupCollapsed", arguments, aWindow);
},
groupEnd: function CA_groupEnd() {
self.queueCall("groupEnd", arguments, meta);
self.queueCall("groupEnd", arguments, aWindow);
},
time: function CA_time() {
self.queueCall("time", arguments, meta);
self.queueCall("time", arguments, aWindow);
},
timeEnd: function CA_timeEnd() {
self.queueCall("timeEnd", arguments, meta);
self.queueCall("timeEnd", arguments, aWindow);
},
__exposedProps__: {
log: "r",
@ -181,15 +163,29 @@ ConsoleAPI.prototype = {
* The console method the code has invoked.
* @param object aArguments
* The arguments passed to the console method.
* @param object aMeta
* The associated call meta information. This needs to hold the inner
* and outer window IDs from where the console method was called.
* @param object aWindow
* The window from where the console method was called.
*/
queueCall: function CA_queueCall(aMethod, aArguments, aMeta)
queueCall: function CA_queueCall(aMethod, aArguments, aWindow)
{
let outerID;
let innerID;
try {
let windowUtils = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
outerID = windowUtils.outerWindowID;
innerID = windowUtils.currentInnerWindowID;
}
catch (ex) {
Cu.reportError(ex);
return;
}
let metaForCall = {
outerID: aMeta.outerID,
innerID: aMeta.innerID,
outerID: outerID,
innerID: innerID,
isPrivate: PrivateBrowsingUtils.isWindowPrivate(aWindow),
timeStamp: Date.now(),
stack: this.getStackTrace(aMethod != "trace" ? 1 : null),
};
@ -233,6 +229,7 @@ ConsoleAPI.prototype = {
let notifyMeta = {
outerID: meta.outerID,
innerID: meta.innerID,
isPrivate: meta.isPrivate,
timeStamp: meta.timeStamp,
frame: meta.stack[0],
};
@ -283,6 +280,7 @@ ConsoleAPI.prototype = {
* Object that holds metadata about the console API call:
* - outerID - the outer ID of the window where the message came from.
* - innerID - the inner ID of the window where the message came from.
* - isPrivate - Whether the window is in private browsing mode.
* - frame - the youngest content frame in the call stack.
* - timeStamp - when the console API call occurred.
*/
@ -300,8 +298,8 @@ ConsoleAPI.prototype = {
consoleEvent.wrappedJSObject = consoleEvent;
// Store messages for which the inner window was not destroyed.
if (this._destroyedWindows.indexOf(aMeta.innerID) == -1) {
// Store non-private messages for which the inner window was not destroyed.
if (!aMeta.isPrivate && this._destroyedWindows.indexOf(aMeta.innerID) == -1) {
ConsoleAPIStorage.recordEvent(aMeta.innerID, consoleEvent);
}

View File

@ -11,14 +11,6 @@ Cu.import("resource://gre/modules/Services.jsm");
const STORAGE_MAX_EVENTS = 200;
XPCOMUtils.defineLazyGetter(this, "gPrivBrowsing", function () {
// private browsing may not be available in some Gecko Apps
if (!(["@mozilla.org/privatebrowsing;1"] in Cc))
return null;
return Cc["@mozilla.org/privatebrowsing;1"].getService(Ci.nsIPrivateBrowsingService);
});
var EXPORTED_SYMBOLS = ["ConsoleAPIStorage"];
var _consoleStorage = {};
@ -105,10 +97,6 @@ var ConsoleAPIStorage = {
throw new Error("Invalid window ID argument");
}
if (gPrivBrowsing && gPrivBrowsing.privateBrowsingEnabled) {
return;
}
if (!_consoleStorage[ID]) {
_consoleStorage[ID] = [];
}

View File

@ -421,13 +421,8 @@ CompositorParent::TransformShadowTree()
// Translate fixed position layers so that they stay in the correct position
// when mScrollOffset and metricsScrollOffset differ.
gfxPoint scaleDiff(tempScaleDiffX, tempScaleDiffY);
gfxPoint offset(clamped(mScrollOffset.x / tempScaleDiffX, mContentRect.x / tempScaleDiffX,
(mContentRect.XMost() - mWidgetSize.width / tempScaleDiffX)) -
metricsScrollOffset.x,
clamped(mScrollOffset.y / tempScaleDiffY, mContentRect.y / tempScaleDiffY,
(mContentRect.YMost() - mWidgetSize.height / tempScaleDiffY)) -
metricsScrollOffset.y);
gfxPoint offset;
gfxPoint scaleDiff;
// If the contents can fit entirely within the widget area on a particular
// dimenson, we need to translate and scale so that the fixed layers remain
@ -435,11 +430,21 @@ CompositorParent::TransformShadowTree()
if (mContentRect.width * tempScaleDiffX < mWidgetSize.width) {
offset.x = -metricsScrollOffset.x;
scaleDiff.x = NS_MIN(1.0f, mWidgetSize.width / (float)mContentRect.width);
} else {
offset.x = clamped(mScrollOffset.x / tempScaleDiffX, (float)mContentRect.x,
mContentRect.XMost() - mWidgetSize.width / tempScaleDiffX) -
metricsScrollOffset.x;
scaleDiff.x = tempScaleDiffX;
}
if (mContentRect.height * tempScaleDiffY < mWidgetSize.height) {
offset.y = -metricsScrollOffset.y;
scaleDiff.y = NS_MIN(1.0f, mWidgetSize.height / (float)mContentRect.height);
} else {
offset.y = clamped(mScrollOffset.y / tempScaleDiffY, (float)mContentRect.y,
mContentRect.YMost() - mWidgetSize.height / tempScaleDiffY) -
metricsScrollOffset.y;
scaleDiff.y = tempScaleDiffY;
}
TransformFixedLayers(layer, offset, scaleDiff);

File diff suppressed because it is too large Load Diff

View File

@ -702,6 +702,9 @@ void doSampleStackTrace(ProfileStack *aStack, ThreadProfile &aProfile, TickSampl
#ifdef ENABLE_SPS_LEAF_DATA
if (sample) {
aProfile.addTag(ProfileEntry('l', (void*)sample->pc));
#ifdef ENABLE_ARM_LR_SAVING
aProfile.addTag(ProfileEntry('L', (void*)sample->lr));
#endif
}
#endif
}
@ -782,12 +785,12 @@ std::ostream& operator<<(std::ostream& stream, const ProfileEntry& entry)
{
if (entry.mTagName == 'r') {
stream << entry.mTagName << "-" << std::fixed << entry.mTagFloat << "\n";
} else if (entry.mTagName == 'l') {
} else if (entry.mTagName == 'l' || entry.mTagName == 'L') {
// Bug 739800 - Force l-tag addresses to have a "0x" prefix on all platforms
// Additionally, stringstream seemed to be ignoring formatter flags.
char tagBuff[1024];
unsigned long long pc = (unsigned long long)(uintptr_t)entry.mTagPtr;
snprintf(tagBuff, 1024, "l-%#llx\n", pc);
snprintf(tagBuff, 1024, "%c-%#llx\n", entry.mTagName, pc);
stream << tagBuff;
} else if (entry.mTagName == 'd') {
// TODO implement 'd' tag for text profile

View File

@ -97,10 +97,16 @@ static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
sample->pc = reinterpret_cast<Address>(mcontext.gregs[R15]);
sample->sp = reinterpret_cast<Address>(mcontext.gregs[R13]);
sample->fp = reinterpret_cast<Address>(mcontext.gregs[R11]);
#ifdef ENABLE_ARM_LR_SAVING
sample->lr = reinterpret_cast<Address>(mcontext.gregs[R14]);
#endif
#else
sample->pc = reinterpret_cast<Address>(mcontext.arm_pc);
sample->sp = reinterpret_cast<Address>(mcontext.arm_sp);
sample->fp = reinterpret_cast<Address>(mcontext.arm_fp);
#ifdef ENABLE_ARM_LR_SAVING
sample->lr = reinterpret_cast<Address>(mcontext.arm_lr);
#endif
#endif
#elif V8_HOST_ARCH_MIPS
// Implement this on MIPS.

View File

@ -18,6 +18,7 @@
#ifdef ANDROID
#if defined(__arm__) || defined(__thumb__)
#define ENABLE_SPS_LEAF_DATA
#define ENABLE_ARM_LR_SAVING
#endif
#define LOG(text) __android_log_print(ANDROID_LOG_ERROR, "profiler", "%s", text);
#else
@ -167,12 +168,18 @@ class TickSample {
pc(NULL),
sp(NULL),
fp(NULL),
#ifdef ENABLE_ARM_LR_SAVING
lr(NULL),
#endif
function(NULL),
context(NULL),
frames_count(0) {}
Address pc; // Instruction pointer.
Address sp; // Stack pointer.
Address fp; // Frame pointer.
#ifdef ENABLE_ARM_LR_SAVING
Address lr; // ARM link register
#endif
Address function; // The last called JS function.
void* context; // The context from the signal handler, if available
static const int kMaxFramesCount = 64;