Bug 1166492 - Remove dead code in the ProfileBuffer and ThreadProfile. (r=mstange)

This commit is contained in:
Shu-yu Guo 2015-05-26 22:58:40 -07:00
parent bd0a1b0094
commit 58d880c1fb
2 changed files with 0 additions and 69 deletions

View File

@ -186,44 +186,6 @@ char* ProfileBuffer::processDynamicTag(int readPos,
return tagBuff;
}
void ProfileBuffer::IterateTagsForThread(IterateTagsCallback aCallback, int aThreadId)
{
MOZ_ASSERT(aCallback);
int readPos = mReadPos;
int currentThreadID = -1;
while (readPos != mWritePos) {
const ProfileEntry& entry = mEntries[readPos];
if (entry.mTagName == 'T') {
currentThreadID = entry.mTagInt;
readPos = (readPos + 1) % mEntrySize;
continue;
}
// Number of tags consumed
int incBy = 1;
// Read ahead to the next tag, if it's a 'd' tag process it now
const char* tagStringData = entry.mTagData;
int readAheadPos = (readPos + 1) % mEntrySize;
char tagBuff[DYNAMIC_MAX_STRING];
// Make sure the string is always null terminated if it fills up DYNAMIC_MAX_STRING-2
tagBuff[DYNAMIC_MAX_STRING-1] = '\0';
if (readAheadPos != mWritePos && mEntries[readAheadPos].mTagName == 'd') {
tagStringData = processDynamicTag(readPos, &incBy, tagBuff);
}
if (currentThreadID == aThreadId) {
aCallback(entry, tagStringData);
}
readPos = (readPos + incBy) % mEntrySize;
}
}
class JSONSchemaWriter
{
JSONWriter& mWriter;
@ -929,17 +891,6 @@ void ThreadProfile::addStoredMarker(ProfilerMarker *aStoredMarker) {
mBuffer->addStoredMarker(aStoredMarker);
}
void ThreadProfile::IterateTags(IterateTagsCallback aCallback)
{
mBuffer->IterateTagsForThread(aCallback, mThreadId);
}
void ThreadProfile::ToStreamAsJSON(std::ostream& stream, float aSinceTime)
{
SpliceableJSONWriter b(MakeUnique<OStreamJSONWriteFunc>(stream));
StreamJSON(b, aSinceTime);
}
void ThreadProfile::StreamJSON(SpliceableJSONWriter& aWriter, float aSinceTime)
{
// mUniqueStacks may already be emplaced from FlushSamplesAndMarkers.
@ -1107,20 +1058,6 @@ void ThreadProfile::FlushSamplesAndMarkers()
mBuffer->reset();
}
JSObject* ThreadProfile::ToJSObject(JSContext* aCx, float aSinceTime)
{
JS::RootedValue val(aCx);
{
SpliceableChunkedJSONWriter b;
StreamJSON(b, aSinceTime);
UniquePtr<char[]> buf = b.WriteFunc()->CopyData();
NS_ConvertUTF8toUTF16 js_string(nsDependentCString(buf.get()));
MOZ_ALWAYS_TRUE(JS_ParseJSON(aCx, static_cast<const char16_t*>(js_string.get()),
js_string.Length(), &val));
}
return &val.toObject();
}
PseudoStack* ThreadProfile::GetPseudoStack()
{
return mPseudoStack;

View File

@ -75,8 +75,6 @@ private:
#pragma pack(pop)
typedef void (*IterateTagsCallback)(const ProfileEntry& entry, const char* tagStringData);
class UniqueJSONStrings
{
public:
@ -218,7 +216,6 @@ public:
explicit ProfileBuffer(int aEntrySize);
void addTag(const ProfileEntry& aTag);
void IterateTagsForThread(IterateTagsCallback aCallback, int aThreadId);
void StreamSamplesToJSON(SpliceableJSONWriter& aWriter, int aThreadId, float aSinceTime,
JSRuntime* rt, UniqueStacks& aUniqueStacks);
void StreamMarkersToJSON(SpliceableJSONWriter& aWriter, int aThreadId, float aSinceTime,
@ -364,9 +361,6 @@ public:
* expired.
*/
void addStoredMarker(ProfilerMarker *aStoredMarker);
void IterateTags(IterateTagsCallback aCallback);
void ToStreamAsJSON(std::ostream& stream, float aSinceTime = 0);
JSObject* ToJSObject(JSContext *aCx, float aSinceTime = 0);
PseudoStack* GetPseudoStack();
mozilla::Mutex* GetMutex();
void StreamJSON(SpliceableJSONWriter& aWriter, float aSinceTime = 0);