Backed out changeset ff2306d8e07f (bug 1329111) for lacking a semicolon in devtools/server/performance/profiler.js. r=backout

This commit is contained in:
Sebastian Hengst 2017-03-16 20:00:34 +01:00
Родитель 224e25992e
Коммит 8b715d46ad
5 изменённых файлов: 50 добавлений и 39 удалений

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

@ -1694,6 +1694,22 @@ public:
for (unsigned int i = 0, n = mRawModules.GetSize(); i != n; i++) { for (unsigned int i = 0, n = mRawModules.GetSize(); i != n; i++) {
const SharedLibrary &info = mRawModules.GetEntry(i); const SharedLibrary &info = mRawModules.GetEntry(i);
nsString basename = info.GetName();
#if defined(XP_MACOSX) || defined(XP_LINUX)
int32_t pos = basename.RFindChar('/');
if (pos != kNotFound) {
basename.Cut(0, pos + 1);
}
#endif
nsString debug_basename = info.GetDebugName();
#if defined(XP_MACOSX) || defined(XP_LINUX)
pos = debug_basename.RFindChar('/');
if (pos != kNotFound) {
debug_basename.Cut(0, pos + 1);
}
#endif
JS::RootedObject moduleObj(cx, JS_NewPlainObject(cx)); JS::RootedObject moduleObj(cx, JS_NewPlainObject(cx));
if (!moduleObj) { if (!moduleObj) {
mPromise->MaybeReject(NS_ERROR_FAILURE); mPromise->MaybeReject(NS_ERROR_FAILURE);
@ -1701,7 +1717,7 @@ public:
} }
// Module name. // Module name.
JS::RootedString moduleName(cx, JS_NewUCStringCopyZ(cx, info.GetModuleName().get())); JS::RootedString moduleName(cx, JS_NewUCStringCopyZ(cx, basename.get()));
if (!moduleName || !JS_DefineProperty(cx, moduleObj, "name", moduleName, JSPROP_ENUMERATE)) { if (!moduleName || !JS_DefineProperty(cx, moduleObj, "name", moduleName, JSPROP_ENUMERATE)) {
mPromise->MaybeReject(NS_ERROR_FAILURE); mPromise->MaybeReject(NS_ERROR_FAILURE);
return NS_OK; return NS_OK;
@ -1710,8 +1726,8 @@ public:
// Module debug name. // Module debug name.
JS::RootedValue moduleDebugName(cx); JS::RootedValue moduleDebugName(cx);
if (!info.GetDebugName().IsEmpty()) { if (!debug_basename.IsEmpty()) {
JS::RootedString str_moduleDebugName(cx, JS_NewUCStringCopyZ(cx, info.GetDebugName().get())); JS::RootedString str_moduleDebugName(cx, JS_NewUCStringCopyZ(cx, debug_basename.get()));
if (!str_moduleDebugName) { if (!str_moduleDebugName) {
mPromise->MaybeReject(NS_ERROR_FAILURE); mPromise->MaybeReject(NS_ERROR_FAILURE);
return NS_OK; return NS_OK;
@ -3212,8 +3228,18 @@ GetStackAndModules(const std::vector<uintptr_t>& aPCs)
#ifdef MOZ_GECKO_PROFILER #ifdef MOZ_GECKO_PROFILER
for (unsigned i = 0, n = rawModules.GetSize(); i != n; ++i) { for (unsigned i = 0, n = rawModules.GetSize(); i != n; ++i) {
const SharedLibrary &info = rawModules.GetEntry(i); const SharedLibrary &info = rawModules.GetEntry(i);
nsString basename = info.GetDebugName();
#if defined(XP_MACOSX) || defined(XP_LINUX)
// We want to use just the basename as the libname, but the
// current profiler addon needs the full path name, so we compute the
// basename in here.
int32_t pos = basename.RFindChar('/');
if (pos != kNotFound) {
basename.Cut(0, pos + 1);
}
#endif
mozilla::Telemetry::ProcessedStack::Module module = { mozilla::Telemetry::ProcessedStack::Module module = {
info.GetDebugName(), basename,
info.GetBreakpadId() info.GetBreakpadId()
}; };
Ret.AddModule(module); Ret.AddModule(module);

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

@ -81,17 +81,12 @@ dl_iterate_callback(struct dl_phdr_info *dl_info, size_t size, void *data)
if (end > libEnd) if (end > libEnd)
libEnd = end; libEnd = end;
} }
const char *path = dl_info->dlpi_name; const char *name = dl_info->dlpi_name;
nsAutoString nameStr; nsAutoString nameStr;
mozilla::Unused << NS_WARN_IF(NS_FAILED(NS_CopyNativeToUnicode(nsDependentCString(path), nameStr))); mozilla::Unused << NS_WARN_IF(NS_FAILED(NS_CopyNativeToUnicode(nsDependentCString(name), nameStr)));
int32_t pos = nameStr.RFindChar('/'); SharedLibrary shlib(libStart, libEnd, 0, getId(name), nameStr, nameStr, "");
if (pos != kNotFound) {
nameStr.Cut(0, pos + 1);
}
SharedLibrary shlib(libStart, libEnd, 0, getId(path), nameStr, nameStr, "");
info.AddSharedLibrary(shlib); info.AddSharedLibrary(shlib);
return 0; return 0;
@ -131,10 +126,10 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
unsigned long end; unsigned long end;
char perm[6] = ""; char perm[6] = "";
unsigned long offset; unsigned long offset;
char modulePath[PATH_MAX] = ""; char name[PATH_MAX] = "";
ret = sscanf(line.c_str(), ret = sscanf(line.c_str(),
"%lx-%lx %6s %lx %*s %*x %" PATH_MAX_STRING(PATH_MAX) "s\n", "%lx-%lx %6s %lx %*s %*x %" PATH_MAX_STRING(PATH_MAX) "s\n",
&start, &end, perm, &offset, modulePath); &start, &end, perm, &offset, name);
if (!strchr(perm, 'x')) { if (!strchr(perm, 'x')) {
// Ignore non executable entries // Ignore non executable entries
continue; continue;
@ -146,7 +141,7 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
#if defined(PROFILE_JAVA) #if defined(PROFILE_JAVA)
// Use proc/pid/maps to get the dalvik-jit section since it has // Use proc/pid/maps to get the dalvik-jit section since it has
// no associated phdrs // no associated phdrs
if (strcmp(modulePath, "/dev/ashmem/dalvik-jit-code-cache") != 0) { if (strcmp(name, "/dev/ashmem/dalvik-jit-code-cache") != 0) {
continue; continue;
} }
#else #else
@ -159,12 +154,7 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
#endif #endif
nsAutoString nameStr; nsAutoString nameStr;
mozilla::Unused << NS_WARN_IF(NS_FAILED(NS_CopyNativeToUnicode(nsDependentCString(modulePath), nameStr))); mozilla::Unused << NS_WARN_IF(NS_FAILED(NS_CopyNativeToUnicode(nsDependentCString(name), nameStr)));
int32_t pos = nameStr.RFindChar('/');
if (pos != kNotFound) {
nameStr.Cut(0, pos + 1);
}
SharedLibrary shlib(start, end, offset, getId(name), nameStr, nameStr, ""); SharedLibrary shlib(start, end, offset, getId(name), nameStr, nameStr, "");
info.AddSharedLibrary(shlib); info.AddSharedLibrary(shlib);

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

@ -35,7 +35,7 @@ typedef segment_command_64 mach_segment_command_type;
#endif #endif
static static
void addSharedLibrary(const platform_mach_header* header, char *path, SharedLibraryInfo &info) { void addSharedLibrary(const platform_mach_header* header, char *name, SharedLibraryInfo &info) {
const struct load_command *cmd = const struct load_command *cmd =
reinterpret_cast<const struct load_command *>(header + 1); reinterpret_cast<const struct load_command *>(header + 1);
@ -73,12 +73,7 @@ void addSharedLibrary(const platform_mach_header* header, char *path, SharedLibr
} }
nsAutoString nameStr; nsAutoString nameStr;
mozilla::Unused << NS_WARN_IF(NS_FAILED(NS_CopyNativeToUnicode(nsDependentCString(path), nameStr))); mozilla::Unused << NS_WARN_IF(NS_FAILED(NS_CopyNativeToUnicode(nsDependentCString(name), nameStr)));
int32_t pos = nameStr.RFindChar('/');
if (pos != kNotFound) {
nameStr.Cut(0, pos + 1);
}
info.AddSharedLibrary(SharedLibrary(start, start + size, 0, uuid.str(), info.AddSharedLibrary(SharedLibrary(start, start + size, 0, uuid.str(),
nameStr, nameStr, "")); nameStr, nameStr, ""));

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

@ -182,17 +182,17 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
} }
} }
nsAutoString moduleNameStr(modulePath); nsAutoString moduleName(modulePath);
int32_t pos = moduleNameStr.RFindChar('\\'); int32_t pos = moduleName.RFindChar('\\');
if (pos != kNotFound) { if (pos != kNotFound) {
moduleNameStr.Cut(0, pos + 1); moduleName.Cut(0, pos + 1);
} }
SharedLibrary shlib((uintptr_t)module.lpBaseOfDll, SharedLibrary shlib((uintptr_t)module.lpBaseOfDll,
(uintptr_t)module.lpBaseOfDll + module.SizeOfImage, (uintptr_t)module.lpBaseOfDll + module.SizeOfImage,
0, // DLLs are always mapped at offset 0 on Windows 0, // DLLs are always mapped at offset 0 on Windows
breakpadId, breakpadId,
moduleNameStr, moduleName,
pdbNameStr, pdbNameStr,
GetVersion(modulePath)); GetVersion(modulePath));
sharedLibraryInfo.AddSharedLibrary(shlib); sharedLibraryInfo.AddSharedLibrary(shlib);

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

@ -27,14 +27,14 @@ public:
uintptr_t aEnd, uintptr_t aEnd,
uintptr_t aOffset, uintptr_t aOffset,
const std::string& aBreakpadId, const std::string& aBreakpadId,
const nsString& aModuleName, const nsString& aName,
const nsString& aDebugName, const nsString& aDebugName,
const std::string& aVersion) const std::string& aVersion)
: mStart(aStart) : mStart(aStart)
, mEnd(aEnd) , mEnd(aEnd)
, mOffset(aOffset) , mOffset(aOffset)
, mBreakpadId(aBreakpadId) , mBreakpadId(aBreakpadId)
, mModuleName(aModuleName) , mName(aName)
, mDebugName(aDebugName) , mDebugName(aDebugName)
, mVersion(aVersion) , mVersion(aVersion)
{} {}
@ -44,7 +44,7 @@ public:
, mEnd(aEntry.mEnd) , mEnd(aEntry.mEnd)
, mOffset(aEntry.mOffset) , mOffset(aEntry.mOffset)
, mBreakpadId(aEntry.mBreakpadId) , mBreakpadId(aEntry.mBreakpadId)
, mModuleName(aEntry.mModuleName) , mName(aEntry.mName)
, mDebugName(aEntry.mDebugName) , mDebugName(aEntry.mDebugName)
, mVersion(aEntry.mVersion) , mVersion(aEntry.mVersion)
{} {}
@ -58,7 +58,7 @@ public:
mEnd = aEntry.mEnd; mEnd = aEntry.mEnd;
mOffset = aEntry.mOffset; mOffset = aEntry.mOffset;
mBreakpadId = aEntry.mBreakpadId; mBreakpadId = aEntry.mBreakpadId;
mModuleName = aEntry.mModuleName; mName = aEntry.mName;
mDebugName = aEntry.mDebugName; mDebugName = aEntry.mDebugName;
mVersion = aEntry.mVersion; mVersion = aEntry.mVersion;
return *this; return *this;
@ -69,7 +69,7 @@ public:
return (mStart == other.mStart) && return (mStart == other.mStart) &&
(mEnd == other.mEnd) && (mEnd == other.mEnd) &&
(mOffset == other.mOffset) && (mOffset == other.mOffset) &&
(mModuleName == other.mModuleName) && (mName == other.mName) &&
(mDebugName == other.mDebugName) && (mDebugName == other.mDebugName) &&
(mBreakpadId == other.mBreakpadId) && (mBreakpadId == other.mBreakpadId) &&
(mVersion == other.mVersion); (mVersion == other.mVersion);
@ -79,7 +79,7 @@ public:
uintptr_t GetEnd() const { return mEnd; } uintptr_t GetEnd() const { return mEnd; }
uintptr_t GetOffset() const { return mOffset; } uintptr_t GetOffset() const { return mOffset; }
const std::string &GetBreakpadId() const { return mBreakpadId; } const std::string &GetBreakpadId() const { return mBreakpadId; }
const nsString &GetModuleName() const { return mModuleName; } const nsString &GetName() const { return mName; }
const std::string GetNativeDebugName() const { const std::string GetNativeDebugName() const {
nsAutoCString debugNameStr; nsAutoCString debugNameStr;
@ -97,7 +97,7 @@ private:
uintptr_t mEnd; uintptr_t mEnd;
uintptr_t mOffset; uintptr_t mOffset;
std::string mBreakpadId; std::string mBreakpadId;
nsString mModuleName; nsString mName;
nsString mDebugName; nsString mDebugName;
std::string mVersion; std::string mVersion;
}; };