2013-04-17 00:47:10 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
2012-05-21 15:12:37 +04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2001-04-17 12:50:41 +04:00
|
|
|
|
|
|
|
#ifndef JSDSERVICE_H___
|
|
|
|
#define JSDSERVICE_H___
|
|
|
|
|
|
|
|
#include "jsdIDebuggerService.h"
|
|
|
|
#include "jsdebug.h"
|
2001-06-28 11:47:04 +04:00
|
|
|
#include "nsString.h"
|
2001-04-17 12:50:41 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2001-07-04 02:21:56 +04:00
|
|
|
#include "nspr.h"
|
2012-05-01 00:58:38 +04:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2012-06-13 07:45:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2001-04-17 12:50:41 +04:00
|
|
|
|
2002-01-31 03:37:28 +03:00
|
|
|
// #if defined(DEBUG_rginda_l)
|
|
|
|
// # define DEBUG_verbose
|
|
|
|
// #endif
|
2001-05-02 01:35:06 +04:00
|
|
|
|
2001-07-04 02:21:56 +04:00
|
|
|
struct LiveEphemeral {
|
|
|
|
/* link in a chain of live values list */
|
2002-01-29 11:32:23 +03:00
|
|
|
PRCList links;
|
|
|
|
jsdIEphemeral *value;
|
|
|
|
void *key;
|
2001-07-04 02:21:56 +04:00
|
|
|
};
|
2001-05-02 01:35:06 +04:00
|
|
|
|
2002-01-12 03:56:35 +03:00
|
|
|
struct PCMapEntry {
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t pc, line;
|
2002-01-12 03:56:35 +03:00
|
|
|
};
|
|
|
|
|
2001-04-17 12:50:41 +04:00
|
|
|
/*******************************************************************************
|
|
|
|
* reflected jsd data structures
|
|
|
|
*******************************************************************************/
|
|
|
|
|
2012-06-13 07:45:08 +04:00
|
|
|
class jsdObject MOZ_FINAL : public jsdIObject
|
2001-04-20 07:57:28 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_JSDIOBJECT
|
|
|
|
|
|
|
|
/* you'll normally use use FromPtr() instead of directly constructing one */
|
|
|
|
jsdObject (JSDContext *aCx, JSDObject *aObject) :
|
|
|
|
mCx(aCx), mObject(aObject)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static jsdIObject *FromPtr (JSDContext *aCx,
|
|
|
|
JSDObject *aObject)
|
|
|
|
{
|
|
|
|
if (!aObject)
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2001-04-20 07:57:28 +04:00
|
|
|
|
|
|
|
jsdIObject *rv = new jsdObject (aCx, aObject);
|
2001-04-17 12:50:41 +04:00
|
|
|
NS_IF_ADDREF(rv);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2001-04-20 07:57:28 +04:00
|
|
|
jsdObject(); /* no implementation */
|
|
|
|
jsdObject(const jsdObject&); /* no implementation */
|
|
|
|
|
2001-04-25 22:22:49 +04:00
|
|
|
JSDContext *mCx;
|
|
|
|
JSDObject *mObject;
|
2001-04-17 12:50:41 +04:00
|
|
|
};
|
|
|
|
|
2001-04-25 22:22:49 +04:00
|
|
|
|
2001-04-20 07:57:28 +04:00
|
|
|
class jsdProperty : public jsdIProperty
|
2001-04-17 12:50:41 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
2001-04-20 07:57:28 +04:00
|
|
|
NS_DECL_JSDIPROPERTY
|
2001-07-04 02:21:56 +04:00
|
|
|
NS_DECL_JSDIEPHEMERAL
|
|
|
|
|
|
|
|
jsdProperty (JSDContext *aCx, JSDProperty *aProperty);
|
|
|
|
virtual ~jsdProperty ();
|
|
|
|
|
2001-04-20 07:57:28 +04:00
|
|
|
static jsdIProperty *FromPtr (JSDContext *aCx,
|
|
|
|
JSDProperty *aProperty)
|
2001-04-17 12:50:41 +04:00
|
|
|
{
|
2001-04-20 07:57:28 +04:00
|
|
|
if (!aProperty)
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2001-04-20 07:57:28 +04:00
|
|
|
|
|
|
|
jsdIProperty *rv = new jsdProperty (aCx, aProperty);
|
2001-04-17 12:50:41 +04:00
|
|
|
NS_IF_ADDREF(rv);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2001-07-04 02:21:56 +04:00
|
|
|
static void InvalidateAll();
|
|
|
|
|
2001-04-20 07:57:28 +04:00
|
|
|
private:
|
|
|
|
jsdProperty(); /* no implementation */
|
|
|
|
jsdProperty(const jsdProperty&); /* no implementation */
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mValid;
|
2001-07-04 02:21:56 +04:00
|
|
|
LiveEphemeral mLiveListEntry;
|
|
|
|
JSDContext *mCx;
|
|
|
|
JSDProperty *mProperty;
|
2001-04-17 12:50:41 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
class jsdScript : public jsdIScript
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_JSDISCRIPT
|
2001-07-04 02:21:56 +04:00
|
|
|
NS_DECL_JSDIEPHEMERAL
|
2001-04-17 12:50:41 +04:00
|
|
|
|
|
|
|
/* you'll normally use use FromPtr() instead of directly constructing one */
|
2001-07-04 02:21:56 +04:00
|
|
|
jsdScript (JSDContext *aCx, JSDScript *aScript);
|
|
|
|
virtual ~jsdScript();
|
|
|
|
|
2001-04-17 12:50:41 +04:00
|
|
|
static jsdIScript *FromPtr (JSDContext *aCx, JSDScript *aScript)
|
|
|
|
{
|
2001-04-20 07:57:28 +04:00
|
|
|
if (!aScript)
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2001-04-20 07:57:28 +04:00
|
|
|
|
|
|
|
void *data = JSD_GetScriptPrivate (aScript);
|
|
|
|
jsdIScript *rv;
|
|
|
|
|
|
|
|
if (data) {
|
2007-07-08 11:08:04 +04:00
|
|
|
rv = static_cast<jsdIScript *>(data);
|
2001-04-20 07:57:28 +04:00
|
|
|
} else {
|
|
|
|
rv = new jsdScript (aCx, aScript);
|
2001-05-02 01:35:06 +04:00
|
|
|
NS_IF_ADDREF(rv); /* addref for the SetScriptPrivate, released in
|
|
|
|
* Invalidate() */
|
2007-07-08 11:08:04 +04:00
|
|
|
JSD_SetScriptPrivate (aScript, static_cast<void *>(rv));
|
2001-04-20 07:57:28 +04:00
|
|
|
}
|
|
|
|
|
2001-05-02 01:35:06 +04:00
|
|
|
NS_IF_ADDREF(rv); /* addref for return value */
|
2001-04-17 12:50:41 +04:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2002-01-12 03:56:35 +03:00
|
|
|
static void InvalidateAll();
|
|
|
|
|
2001-04-17 12:50:41 +04:00
|
|
|
private:
|
2012-08-22 19:56:38 +04:00
|
|
|
static uint32_t LastTag;
|
2002-01-12 03:56:35 +03:00
|
|
|
|
2001-04-17 12:50:41 +04:00
|
|
|
jsdScript(); /* no implementation */
|
|
|
|
jsdScript (const jsdScript&); /* no implementation */
|
2002-01-12 03:56:35 +03:00
|
|
|
PCMapEntry* CreatePPLineMap();
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t PPPcToLine(uint32_t aPC);
|
|
|
|
uint32_t PPLineToPc(uint32_t aLine);
|
2001-04-17 12:50:41 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mValid;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mTag;
|
2001-04-17 12:50:41 +04:00
|
|
|
JSDContext *mCx;
|
|
|
|
JSDScript *mScript;
|
2001-06-28 11:47:04 +04:00
|
|
|
nsCString *mFileName;
|
|
|
|
nsCString *mFunctionName;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mBaseLineNumber, mLineExtent;
|
2002-01-12 03:56:35 +03:00
|
|
|
PCMapEntry *mPPLineMap;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mPCMapSize;
|
2012-01-11 12:23:05 +04:00
|
|
|
uintptr_t mFirstPC;
|
2001-04-17 12:50:41 +04:00
|
|
|
};
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t jsdScript::LastTag = 0;
|
2002-01-12 03:56:35 +03:00
|
|
|
|
2002-01-29 11:32:23 +03:00
|
|
|
class jsdContext : public jsdIContext
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_JSDICONTEXT
|
|
|
|
NS_DECL_JSDIEPHEMERAL
|
|
|
|
|
|
|
|
jsdContext (JSDContext *aJSDCx, JSContext *aJSCx, nsISupports *aISCx);
|
|
|
|
virtual ~jsdContext();
|
|
|
|
|
|
|
|
static void InvalidateAll();
|
|
|
|
static jsdIContext *FromPtr (JSDContext *aJSDCx, JSContext *aJSCx);
|
|
|
|
private:
|
2012-08-22 19:56:38 +04:00
|
|
|
static uint32_t LastTag;
|
2002-01-29 11:32:23 +03:00
|
|
|
|
|
|
|
jsdContext (); /* no implementation */
|
|
|
|
jsdContext (const jsdContext&); /* no implementation */
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mValid;
|
2002-01-29 11:32:23 +03:00
|
|
|
LiveEphemeral mLiveListEntry;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mTag;
|
2002-01-29 11:32:23 +03:00
|
|
|
JSDContext *mJSDCx;
|
|
|
|
JSContext *mJSCx;
|
|
|
|
nsCOMPtr<nsISupports> mISCx;
|
|
|
|
};
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t jsdContext::LastTag = 0;
|
2002-01-29 11:32:23 +03:00
|
|
|
|
2001-04-20 07:57:28 +04:00
|
|
|
class jsdStackFrame : public jsdIStackFrame
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_JSDISTACKFRAME
|
2001-07-04 02:21:56 +04:00
|
|
|
NS_DECL_JSDIEPHEMERAL
|
2001-04-20 07:57:28 +04:00
|
|
|
|
|
|
|
/* you'll normally use use FromPtr() instead of directly constructing one */
|
|
|
|
jsdStackFrame (JSDContext *aCx, JSDThreadState *aThreadState,
|
Bug 151803, "Debugger is leaking JSDValues", r=peterv, sr=jst
Stop caching jsdIValues, it doesn't seem to be worth the lookup cost. This has the side effect of plugging the leak, as described in the bug.
also...
* Convert a few raw pointers to nsCOMPtrs
* Fix a bug where removing the last filter did not null out the list head,
causing a crash the next time filters were used.
* Track live jsdStackFrames, so we can invalidate them all when execution
continues. Without this, only the top frame is properly invalidated, and any
other frame accessed after a continue will do Bad Things.
* Add some debugging prints to GetInitAtService, which seems to be failing at
random times.
2002-06-20 01:56:23 +04:00
|
|
|
JSDStackFrameInfo *aStackFrameInfo);
|
|
|
|
virtual ~jsdStackFrame();
|
2001-04-20 07:57:28 +04:00
|
|
|
|
Bug 151803, "Debugger is leaking JSDValues", r=peterv, sr=jst
Stop caching jsdIValues, it doesn't seem to be worth the lookup cost. This has the side effect of plugging the leak, as described in the bug.
also...
* Convert a few raw pointers to nsCOMPtrs
* Fix a bug where removing the last filter did not null out the list head,
causing a crash the next time filters were used.
* Track live jsdStackFrames, so we can invalidate them all when execution
continues. Without this, only the top frame is properly invalidated, and any
other frame accessed after a continue will do Bad Things.
* Add some debugging prints to GetInitAtService, which seems to be failing at
random times.
2002-06-20 01:56:23 +04:00
|
|
|
static void InvalidateAll();
|
|
|
|
static jsdIStackFrame* FromPtr (JSDContext *aCx,
|
2001-04-20 07:57:28 +04:00
|
|
|
JSDThreadState *aThreadState,
|
Bug 151803, "Debugger is leaking JSDValues", r=peterv, sr=jst
Stop caching jsdIValues, it doesn't seem to be worth the lookup cost. This has the side effect of plugging the leak, as described in the bug.
also...
* Convert a few raw pointers to nsCOMPtrs
* Fix a bug where removing the last filter did not null out the list head,
causing a crash the next time filters were used.
* Track live jsdStackFrames, so we can invalidate them all when execution
continues. Without this, only the top frame is properly invalidated, and any
other frame accessed after a continue will do Bad Things.
* Add some debugging prints to GetInitAtService, which seems to be failing at
random times.
2002-06-20 01:56:23 +04:00
|
|
|
JSDStackFrameInfo *aStackFrameInfo);
|
2001-04-20 07:57:28 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
jsdStackFrame(); /* no implementation */
|
|
|
|
jsdStackFrame(const jsdStackFrame&); /* no implementation */
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mValid;
|
Bug 151803, "Debugger is leaking JSDValues", r=peterv, sr=jst
Stop caching jsdIValues, it doesn't seem to be worth the lookup cost. This has the side effect of plugging the leak, as described in the bug.
also...
* Convert a few raw pointers to nsCOMPtrs
* Fix a bug where removing the last filter did not null out the list head,
causing a crash the next time filters were used.
* Track live jsdStackFrames, so we can invalidate them all when execution
continues. Without this, only the top frame is properly invalidated, and any
other frame accessed after a continue will do Bad Things.
* Add some debugging prints to GetInitAtService, which seems to be failing at
random times.
2002-06-20 01:56:23 +04:00
|
|
|
LiveEphemeral mLiveListEntry;
|
2001-05-05 02:14:37 +04:00
|
|
|
JSDContext *mCx;
|
|
|
|
JSDThreadState *mThreadState;
|
2001-04-20 07:57:28 +04:00
|
|
|
JSDStackFrameInfo *mStackFrameInfo;
|
|
|
|
};
|
|
|
|
|
|
|
|
class jsdValue : public jsdIValue
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_JSDIVALUE
|
2001-07-04 02:21:56 +04:00
|
|
|
NS_DECL_JSDIEPHEMERAL
|
2001-04-20 07:57:28 +04:00
|
|
|
|
|
|
|
/* you'll normally use use FromPtr() instead of directly constructing one */
|
2001-07-04 02:21:56 +04:00
|
|
|
jsdValue (JSDContext *aCx, JSDValue *aValue);
|
|
|
|
virtual ~jsdValue();
|
2001-04-20 07:57:28 +04:00
|
|
|
|
2002-01-29 11:32:23 +03:00
|
|
|
static jsdIValue *FromPtr (JSDContext *aCx, JSDValue *aValue);
|
2001-07-04 02:21:56 +04:00
|
|
|
static void InvalidateAll();
|
2001-04-20 07:57:28 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
jsdValue(); /* no implementation */
|
|
|
|
jsdValue (const jsdScript&); /* no implementation */
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mValid;
|
2001-07-04 02:21:56 +04:00
|
|
|
LiveEphemeral mLiveListEntry;
|
|
|
|
JSDContext *mCx;
|
|
|
|
JSDValue *mValue;
|
2001-04-20 07:57:28 +04:00
|
|
|
};
|
|
|
|
|
2001-04-17 12:50:41 +04:00
|
|
|
/******************************************************************************
|
|
|
|
* debugger service
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
class jsdService : public jsdIDebuggerService
|
|
|
|
{
|
|
|
|
public:
|
2012-05-01 00:58:38 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2001-04-17 12:50:41 +04:00
|
|
|
NS_DECL_JSDIDEBUGGERSERVICE
|
|
|
|
|
2012-05-01 00:58:38 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS(jsdService)
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
jsdService() : mOn(false), mPauseLevel(0),
|
2002-01-29 08:56:02 +03:00
|
|
|
mNestedLoopLevel(0), mCx(0), mRuntime(0), mErrorHook(0),
|
|
|
|
mBreakpointHook(0), mDebugHook(0), mDebuggerHook(0),
|
|
|
|
mInterruptHook(0), mScriptHook(0), mThrowHook(0),
|
|
|
|
mTopLevelHook(0), mFunctionHook(0)
|
2001-06-28 11:47:04 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-11-06 15:59:21 +03:00
|
|
|
virtual ~jsdService();
|
2001-04-17 12:50:41 +04:00
|
|
|
|
2001-04-26 01:55:20 +04:00
|
|
|
static jsdService *GetService ();
|
2010-11-17 02:18:35 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool CheckInterruptHook() { return !!mInterruptHook; }
|
2001-04-26 01:55:20 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult DoPause(uint32_t *_rval, bool internalCall);
|
|
|
|
nsresult DoUnPause(uint32_t *_rval, bool internalCall);
|
2011-11-10 01:11:39 +04:00
|
|
|
|
2001-04-17 12:50:41 +04:00
|
|
|
private:
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mOn;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mPauseLevel;
|
|
|
|
uint32_t mNestedLoopLevel;
|
2001-04-25 22:22:49 +04:00
|
|
|
JSDContext *mCx;
|
2001-06-28 11:47:04 +04:00
|
|
|
JSRuntime *mRuntime;
|
2002-01-29 08:56:02 +03:00
|
|
|
|
|
|
|
nsCOMPtr<jsdIErrorHook> mErrorHook;
|
2001-04-25 22:22:49 +04:00
|
|
|
nsCOMPtr<jsdIExecutionHook> mBreakpointHook;
|
2002-01-29 08:56:02 +03:00
|
|
|
nsCOMPtr<jsdIExecutionHook> mDebugHook;
|
2001-04-17 12:50:41 +04:00
|
|
|
nsCOMPtr<jsdIExecutionHook> mDebuggerHook;
|
|
|
|
nsCOMPtr<jsdIExecutionHook> mInterruptHook;
|
2001-04-20 07:57:28 +04:00
|
|
|
nsCOMPtr<jsdIScriptHook> mScriptHook;
|
2001-05-05 02:14:37 +04:00
|
|
|
nsCOMPtr<jsdIExecutionHook> mThrowHook;
|
2001-09-01 22:03:53 +04:00
|
|
|
nsCOMPtr<jsdICallHook> mTopLevelHook;
|
|
|
|
nsCOMPtr<jsdICallHook> mFunctionHook;
|
2010-10-30 20:13:02 +04:00
|
|
|
nsCOMPtr<jsdIActivationCallback> mActivationCallback;
|
2001-04-17 12:50:41 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* JSDSERVICE_H___ */
|
|
|
|
|
2001-05-05 02:14:37 +04:00
|
|
|
|
|
|
|
/* graveyard */
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
|
|
|
class jsdContext : public jsdIContext
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_JSDICONTEXT
|
|
|
|
|
|
|
|
/* you'll normally use use FromPtr() instead of directly constructing one */
|
|
|
|
jsdContext (JSDContext *aCx) : mCx(aCx)
|
|
|
|
{
|
|
|
|
printf ("++++++ jsdContext\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static jsdIContext *FromPtr (JSDContext *aCx)
|
|
|
|
{
|
|
|
|
if (!aCx)
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2001-05-05 02:14:37 +04:00
|
|
|
|
|
|
|
void *data = JSD_GetContextPrivate (aCx);
|
|
|
|
jsdIContext *rv;
|
|
|
|
|
|
|
|
if (data) {
|
2007-07-08 11:08:04 +04:00
|
|
|
rv = static_cast<jsdIContext *>(data);
|
2001-05-05 02:14:37 +04:00
|
|
|
} else {
|
|
|
|
rv = new jsdContext (aCx);
|
|
|
|
NS_IF_ADDREF(rv); // addref for the SetContextPrivate
|
2007-07-08 11:08:04 +04:00
|
|
|
JSD_SetContextPrivate (aCx, static_cast<void *>(rv));
|
2001-05-05 02:14:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IF_ADDREF(rv); // addref for the return value
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~jsdContext() { printf ("------ ~jsdContext\n"); }
|
|
|
|
private:
|
|
|
|
jsdContext(); /* no implementation */
|
|
|
|
jsdContext(const jsdContext&); /* no implementation */
|
|
|
|
|
|
|
|
JSDContext *mCx;
|
|
|
|
};
|
|
|
|
|
|
|
|
class jsdThreadState : public jsdIThreadState
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_JSDITHREADSTATE
|
|
|
|
|
|
|
|
/* you'll normally use use FromPtr() instead of directly constructing one */
|
|
|
|
jsdThreadState (JSDContext *aCx, JSDThreadState *aThreadState) :
|
|
|
|
mCx(aCx), mThreadState(aThreadState)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/* XXX These things are only valid for a short period of time, they reflect
|
|
|
|
* state in the js engine that will go away after stepping past wherever
|
|
|
|
* we were stopped at when this was created. We could keep a list of every
|
|
|
|
* instance of this we've created, and "invalidate" them before we let the
|
|
|
|
* engine continue. The next time we need a threadstate, we can search the
|
|
|
|
* list to find an invalidated one, and just reuse it.
|
|
|
|
*/
|
|
|
|
static jsdIThreadState *FromPtr (JSDContext *aCx,
|
|
|
|
JSDThreadState *aThreadState)
|
|
|
|
{
|
|
|
|
if (!aThreadState)
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2001-05-05 02:14:37 +04:00
|
|
|
|
|
|
|
jsdIThreadState *rv = new jsdThreadState (aCx, aThreadState);
|
|
|
|
NS_IF_ADDREF(rv);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
jsdThreadState(); /* no implementation */
|
|
|
|
jsdThreadState(const jsdThreadState&); /* no implementation */
|
|
|
|
|
|
|
|
JSDContext *mCx;
|
|
|
|
JSDThreadState *mThreadState;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|