mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 799638 - Export profiler markers when saving profiler profiles. r=ehsan
This commit is contained in:
parent
a0793a7600
commit
828e28e911
@ -85,6 +85,26 @@ class JSObjectBuilder
|
||||
mOk = JS_SetElement(mCx, aArray, length, &objval);
|
||||
}
|
||||
|
||||
void ArrayPush(JSObject *aArray, const char *value)
|
||||
{
|
||||
if (!mOk)
|
||||
return;
|
||||
|
||||
JSString *string = JS_NewStringCopyN(mCx, value, strlen(value));
|
||||
if (!string) {
|
||||
mOk = JS_FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
jsval objval = STRING_TO_JSVAL(string);
|
||||
uint32_t length;
|
||||
mOk = JS_GetArrayLength(mCx, aArray, &length);
|
||||
|
||||
if (!mOk)
|
||||
return;
|
||||
|
||||
mOk = JS_SetElement(mCx, aArray, length, &objval);
|
||||
}
|
||||
|
||||
void ArrayPush(JSObject *aArray, JSObject *aObject)
|
||||
{
|
||||
|
@ -290,6 +290,7 @@ public:
|
||||
|
||||
JSObject *sample = NULL;
|
||||
JSObject *frames = NULL;
|
||||
JSObject *marker = NULL;
|
||||
|
||||
int readPos = mReadPos;
|
||||
while (readPos != mLastFlushPos) {
|
||||
@ -315,6 +316,19 @@ public:
|
||||
frames = b.CreateArray();
|
||||
b.DefineProperty(sample, "frames", frames);
|
||||
b.ArrayPush(samples, sample);
|
||||
// Created lazily
|
||||
marker = NULL;
|
||||
break;
|
||||
case 'm':
|
||||
{
|
||||
if (sample) {
|
||||
if (!marker) {
|
||||
marker = b.CreateArray();
|
||||
b.DefineProperty(sample, "marker", marker);
|
||||
}
|
||||
b.ArrayPush(marker, tagStringData);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'r':
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user