Bug 711491. Decide whether to get shared library info at runtime r=bgirard

Now that we have implementations of SharedLibraryInfo for
all platforms we don't need to build support for it conditionally.

--HG--
extra : rebase_source : d40cf1b0b28fab3ef31ab4511fc1ddda98a37a38
This commit is contained in:
Jeff Muizelaar 2011-12-16 11:54:22 -05:00
parent 5b09800c1c
commit 350bd02999
2 changed files with 15 additions and 16 deletions

View File

@ -135,6 +135,10 @@ public:
, mEntrySize(aEntrySize)
{
mEntries = new ProfileEntry[mEntrySize];
mNeedsSharedLibraryInfo = false;
#ifdef ENABLE_SPS_LEAF_DATA
mNeedsSharedLibraryInfo = true;
#endif
}
~Profile()
@ -156,11 +160,11 @@ public:
void ToString(string* profile)
{
// Can't be called from signal because
// getting the shared library information can call non-reentrant functions.
#ifdef ENABLE_SPS_LEAF_DATA
mSharedLibraryInfo = SharedLibraryInfo::GetInfoForSelf();
#endif
if (mNeedsSharedLibraryInfo) {
// Can't be called from signal because
// getting the shared library information can call non-reentrant functions.
mSharedLibraryInfo = SharedLibraryInfo::GetInfoForSelf();
}
*profile = "";
int oldReadPos = mReadPos;
@ -173,11 +177,11 @@ public:
void WriteProfile(FILE* stream)
{
// Can't be called from signal because
// getting the shared library information can call non-reentrant functions.
#ifdef ENABLE_SPS_LEAF_DATA
mSharedLibraryInfo = SharedLibraryInfo::GetInfoForSelf();
#endif
if (mNeedsSharedLibraryInfo) {
// Can't be called from signal because
// getting the shared library information can call non-reentrant functions.
mSharedLibraryInfo = SharedLibraryInfo::GetInfoForSelf();
}
int oldReadPos = mReadPos;
while (mReadPos != mWritePos) {
@ -187,12 +191,10 @@ public:
mReadPos = oldReadPos;
}
#ifdef ENABLE_SPS_LEAF_DATA
SharedLibraryInfo& getSharedLibraryInfo()
{
return mSharedLibraryInfo;
}
#endif
private:
// Circular buffer 'Keep One Slot Open' implementation
// for simplicity
@ -200,9 +202,8 @@ private:
int mWritePos; // points to the next entry we will write to
int mReadPos; // points to the next entry we will read to
int mEntrySize;
#ifdef ENABLE_SPS_LEAF_DATA
bool mNeedsSharedLibraryInfo;
SharedLibraryInfo mSharedLibraryInfo;
#endif
};
class SaveProfileTask;

View File

@ -8,7 +8,6 @@
#include "platform.h"
#include "shared-libraries.h"
#ifdef ENABLE_SPS_LEAF_DATA
#ifndef __GLIBC__
/* a crapy version of getline, because it's not included in bionic */
static ssize_t getline(char **lineptr, size_t *n, FILE *stream)
@ -64,4 +63,3 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
free(line);
return info;
}
#endif