зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1516578 Part 2 - Add ToString methods for breakpoint positions and execution points, r=lsmyth.
--HG-- extra : rebase_source : 4f0d872e618da7fc109074e25ad665f21848b5ba extra : source : 0426a61d27a9c9c047b4d489e4a2586b4c7a6491
This commit is contained in:
Родитель
5f10ff1d4c
Коммит
d3d0015ff0
|
@ -15,23 +15,6 @@ namespace navigation {
|
|||
typedef js::BreakpointPosition BreakpointPosition;
|
||||
typedef js::ExecutionPoint ExecutionPoint;
|
||||
|
||||
static void BreakpointPositionToString(const BreakpointPosition& aPos,
|
||||
nsAutoCString& aStr) {
|
||||
aStr.AppendPrintf("{ Kind: %s, Script: %d, Offset: %d, Frame: %d }",
|
||||
aPos.KindString(), (int)aPos.mScript, (int)aPos.mOffset,
|
||||
(int)aPos.mFrameIndex);
|
||||
}
|
||||
|
||||
static void ExecutionPointToString(const ExecutionPoint& aPoint,
|
||||
nsAutoCString& aStr) {
|
||||
aStr.AppendPrintf("{ Checkpoint %d", (int)aPoint.mCheckpoint);
|
||||
if (aPoint.HasPosition()) {
|
||||
aStr.AppendPrintf(" Progress %llu Position ", aPoint.mProgress);
|
||||
BreakpointPositionToString(aPoint.mPosition, aStr);
|
||||
}
|
||||
aStr.AppendPrintf(" }");
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Navigation State
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -232,10 +215,10 @@ class ReachBreakpointPhase final : public NavigationPhase {
|
|||
|
||||
void ToString(nsAutoCString& aStr) override {
|
||||
aStr.AppendPrintf("ReachBreakpoint: ");
|
||||
ExecutionPointToString(mPoint, aStr);
|
||||
mPoint.ToString(aStr);
|
||||
if (mTemporaryCheckpoint.isSome()) {
|
||||
aStr.AppendPrintf(" TemporaryCheckpoint: ");
|
||||
ExecutionPointToString(mTemporaryCheckpoint.ref(), aStr);
|
||||
mTemporaryCheckpoint.ref().ToString(aStr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -781,7 +764,7 @@ void ForwardPhase::PositionHit(const ExecutionPoint& aPoint) {
|
|||
|
||||
void ForwardPhase::HitRecordingEndpoint(const ExecutionPoint& aPoint) {
|
||||
nsAutoCString str;
|
||||
ExecutionPointToString(aPoint, str);
|
||||
aPoint.ToString(str);
|
||||
|
||||
gNavigation->mPausedPhase.Enter(aPoint, /* aRewind = */ false,
|
||||
/* aRecordingEndpoint = */ true);
|
||||
|
|
|
@ -106,7 +106,7 @@ bool BreakpointPosition::Decode(JSContext* aCx, HandleObject aObject) {
|
|||
return false;
|
||||
}
|
||||
|
||||
RootedString str(aCx, ToString(aCx, v));
|
||||
RootedString str(aCx, ::ToString(aCx, v));
|
||||
for (size_t i = BreakpointPosition::Invalid + 1;
|
||||
i < BreakpointPosition::sKindCount; i++) {
|
||||
BreakpointPosition::Kind kind = (BreakpointPosition::Kind)i;
|
||||
|
@ -134,6 +134,13 @@ bool BreakpointPosition::Decode(JSContext* aCx, HandleObject aObject) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
BreakpointPosition::ToString(nsCString& aStr) const
|
||||
{
|
||||
aStr.AppendPrintf("{ Kind: %s, Script: %d, Offset: %d, Frame: %d }",
|
||||
KindString(), (int) mScript, (int) mOffset, (int) mFrameIndex);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// ExecutionPoint Conversion
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -171,6 +178,17 @@ bool ExecutionPoint::Decode(JSContext* aCx, HandleObject aObject) {
|
|||
GetNumberProperty(aCx, aObject, gProgressProperty, &mProgress);
|
||||
}
|
||||
|
||||
void
|
||||
ExecutionPoint::ToString(nsCString& aStr) const
|
||||
{
|
||||
aStr.AppendPrintf("{ Checkpoint %d", (int) mCheckpoint);
|
||||
if (HasPosition()) {
|
||||
aStr.AppendPrintf(" Progress %llu Position ", mProgress);
|
||||
mPosition.ToString(aStr);
|
||||
}
|
||||
aStr.AppendPrintf(" }");
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Middleman Methods
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "ProcessRewind.h"
|
||||
|
||||
#include "mozilla/DefineEnum.h"
|
||||
#include "nsString.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace recordreplay {
|
||||
|
@ -135,6 +136,7 @@ struct BreakpointPosition {
|
|||
|
||||
JSObject* Encode(JSContext* aCx) const;
|
||||
bool Decode(JSContext* aCx, JS::HandleObject aObject);
|
||||
void ToString(nsCString& aStr) const;
|
||||
};
|
||||
|
||||
// Identification for a point in the execution of a child process where it may
|
||||
|
@ -182,6 +184,7 @@ struct ExecutionPoint {
|
|||
|
||||
JSObject* Encode(JSContext* aCx) const;
|
||||
bool Decode(JSContext* aCx, JS::HandleObject aObject);
|
||||
void ToString(nsCString& aStr) const;
|
||||
};
|
||||
|
||||
// Buffer type used for encoding object data.
|
||||
|
|
Загрузка…
Ссылка в новой задаче