moving the xpcom wrapper into js/jsd

This commit is contained in:
rginda%netscape.com 2001-04-17 08:57:15 +00:00
Родитель 82e0b7637c
Коммит 396d737f23
12 изменённых файлов: 13 добавлений и 904 удалений

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

@ -38,7 +38,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = resources src idl
DIRS = resources
include $(topsrcdir)/config/rules.mk

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

@ -1,47 +0,0 @@
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation
# Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation.
#
# Alternatively, the contents of this file may be used under the
# terms of the GNU Public License (the "GPL"), in which case the
# provisions of the GPL are applicable instead of those above.
# If you wish to allow use of your version of this file only
# under the terms of the GPL and not to allow others to use your
# version of this file under the MPL, indicate your decision by
# deleting the provisions above and replace them with the notice
# and other provisions required by the GPL. If you do not delete
# the provisions above, a recipient may use your version of this
# file under either the MPL or the GPL.
#
# Contributor(s):
#
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = jsdservice
XPIDLSRCS = \
jsdIDebuggerService.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -1,132 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation
* Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the MPL or the GPL.
*
* Contributor(s):
*
*
*/
#include "nsISupports.idl"
%{ C++
#include "jsdebug.h"
%}
[ptr] native JSDContext(JSDContext);
[ptr] native JSDScript(JSDScript);
[ptr] native JSDThreadState(JSDThreadState);
/*
[scriptable, uuid(e7c8ea2c-1dd1-11b2-9242-f2768e04e92e)]
interface jsdIHandle : nsISupports
{
[noscript] readonly attribute voidPtr data;
};
*/
[scriptable, uuid(a2dd25a4-1dd1-11b2-bda6-ed525acd4c35)]
interface jsdIContext : nsISupports
{
[noscript] readonly attribute JSDContext JSDContext;
};
[scriptable, uuid(d500e8b8-1dd1-11b2-89a1-cdf55d91cbbd)]
interface jsdIObject : nsISupports
{};
[scriptable, uuid(b8816e56-1dd1-11b2-81dc-8ba99a833d9e)]
interface jsdIProperty : nsISupports
{};
[scriptable, uuid(a38f65ca-1dd1-11b2-95d5-ff2947e9c920)]
interface jsdIScript : nsISupports
{
[noscript] readonly attribute JSDScript JSDScript;
readonly attribute boolean isActive;
readonly attribute wstring fileName;
readonly attribute wstring functionName;
readonly attribute unsigned long baseLineNumber;
readonly attribute unsigned long lineExtent;
};
[scriptable, uuid(a47adad2-1dd1-11b2-b9e9-8e67a47beca5)]
interface jsdISourceText : nsISupports
{};
[scriptable, uuid(b6d50784-1dd1-11b2-a932-882246c6fe45)]
interface jsdIStackFrameInfo : nsISupports
{};
[scriptable, uuid(b6d1c006-1dd1-11b2-b9d8-b4d1ccfb74d8)]
interface jsdIThreadState : nsISupports
{
[noscript] readonly attribute JSDThreadState JSDThreadState;
};
[scriptable, uuid(b7964304-1dd1-11b2-ba20-cf4205772e9d)]
interface jsdIValue : nsISupports
{};
[scriptable, uuid(ae89a7e2-1dd1-11b2-8c2f-af82086291a5)]
interface jsdIScriptHook : nsISupports
{
void onScriptLoaded (in jsdIContext aCx, in jsdIScript aScript,
in boolean aCreating);
};
[scriptable, uuid(9a7b6ad0-1dd1-11b2-a789-fcfae96356a2)]
interface jsdIExecutionHook : nsISupports
{
const unsigned long RETURN_HOOK_ERROR = 0;
const unsigned long RETURN_CONTINUE = 1;
const unsigned long RETURN_ABORT = 2;
const unsigned long RETURN_RET_WITH_VAL = 3;
const unsigned long RETURN_THROW_WITH_VAL = 4;
const unsigned long RETURN_CONTINUE_THROW = 5;
unsigned long onExecute (in jsdIContext aCx,
in jsdIThreadState aThreadState,
in unsigned long aType, out nsISupports rval);
};
[scriptable, uuid(01be7f9a-1dd2-11b2-9d55-aaf919b27c73)]
interface jsdIDebuggerService : nsISupports
{
void init ();
attribute jsdIExecutionHook debugBreakHook;
attribute jsdIExecutionHook debuggerHook;
attribute jsdIExecutionHook interruptHook;
attribute jsdIScriptHook scriptHook;
};

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

@ -1,44 +0,0 @@
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation
# Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation.
#
# Alternatively, the contents of this file may be used under the
# terms of the GNU Public License (the "GPL"), in which case the
# provisions of the GPL are applicable instead of those above.
# If you wish to allow use of your version of this file only
# under the terms of the GPL and not to allow others to use your
# version of this file under the MPL, indicate your decision by
# deleting the provisions above and replace them with the notice
# and other provisions required by the GPL. If you do not delete
# the provisions above, a recipient may use your version of this
# file under either the MPL or the GPL.
#
# Contributor(s):
#
#
DEPTH = ..\..\..
include <$(DEPTH)/config/config.mak>
MODULE = jsdservice
XPIDLSRCS = \
jsdIDebuggerService.idl \
$(NULL)
include <$(DEPTH)/config/rules.mk>

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

@ -35,6 +35,6 @@ DEPTH = ..\..
include <$(DEPTH)\config\config.mak>
DIRS = resources src idl
DIRS = resources
include <$(DEPTH)\config\rules.mak>

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

@ -47,17 +47,26 @@ function sh_scripthook (cx, script, creating)
}
var interruptHooker = new Object();
interruptHooker.onExecutionHook =
interruptHooker.onExecute =
function ih_exehook (cx, state, type, rv)
{
dd ("onInterruptHook (" + cx + ", " + state + ", " + type + ")");
return jsdIExecutionHook.HOOK_RETURN_CONTINUE;
}
var debuggerHooker = new Object();
debuggerHooker.onExecute =
function dh_exehook (cx, state, type, rv)
{
dd ("onDebuggerHook (" + cx + ", " + state + ", " + type + ")");
return jsdIExecutionHook.HOOK_RETURN_CONTINUE;
}
function initDebugger()
{
dbg = Components.classes[JSD_CTRID].getService(jsdIDebuggerService);
dbg.init();
dbg.scriptHook = scriptHooker;
dbg.interruptHook = interruptHooker;
dbg.debuggerHook = debuggerHooker;
//dbg.interruptHook = interruptHooker;
}

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

@ -1,56 +0,0 @@
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation
# Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation.
#
# Alternatively, the contents of this file may be used under the
# terms of the GNU Public License (the "GPL"), in which case the
# provisions of the GPL are applicable instead of those above.
# If you wish to allow use of your version of this file only
# under the terms of the GPL and not to allow others to use your
# version of this file under the MPL, indicate your decision by
# deleting the provisions above and replace them with the notice
# and other provisions required by the GPL. If you do not delete
# the provisions above, a recipient may use your version of this
# file under either the MPL or the GPL.
#
# Contributor(s):
#
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = jsdservice
LIBRARY_NAME = jsdservice
IS_COMPONENT = 1
REQUIRES = xpcom string xpconnect mozjs jsd jsdr
CPPSRCS = jsdDebuggerService.cpp \
jsdHandles.cpp \
$(NULL)
EXTRA_DSO_LDOPTS += \
$(MOZ_JS_LIBS) \
$(MOZ_JSD_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -1,218 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation
* Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the MPL or the GPL.
*
* Contributor(s):
*
*
*/
#include "jsdebug.h"
#include "prmem.h"
#include "jsdDebuggerService.h"
#include "jsdHandles.h"
#include "nsIGenericFactory.h"
#include "nsIServiceManager.h"
#include "nsIXPConnect.h"
#define JSDS_HANDLE_HASH_BUCKETS 4096
const char jsdServiceContractID[] = "@mozilla.org/js/jsd/debugger-service;1";
NS_IMPL_THREADSAFE_ISUPPORTS1(jsdService, jsdIDebuggerService);
void
jsds_SetContextProc (JSDContext* jsdc, void* user)
{
printf ("jsds_SetContextProc: called.\n");
}
static PRUint32
jsds_ExecutionHookProc (JSDContext* jsdc, JSDThreadState* jsdthreadstate,
uintN type, void* callerdata, jsval* rval)
{
NS_PRECONDITION (callerdata, "no callerdata for jsds_ExecutionHookProc.");
jsdIExecutionHook *hook = NS_STATIC_CAST(jsdIExecutionHook *, callerdata);
nsISupports *is_rv = 0;
PRUint32 hook_rv = JSD_HOOK_RETURN_CONTINUE;
hook->OnExecute (jsdContext::FromPtr(jsdc),
jsdThreadState::FromPtr(jsdthreadstate),
type, &is_rv, &hook_rv);
return hook_rv;
}
static void
jsds_ScriptHookProc (JSDContext* jsdc, JSDScript* jsdscript, JSBool creating,
void* callerdata)
{
if (!callerdata)
return;
jsdIScriptHook *hook = NS_STATIC_CAST(jsdIScriptHook *, callerdata);
hook->OnScriptLoaded (jsdContext::FromPtr(jsdc),
jsdScript::FromPtr(jsdc, jsdscript),
creating ? PR_TRUE : PR_FALSE);
}
NS_IMETHODIMP
jsdService::Init (void)
{
nsresult rv;
/* get JS things from the CallContext */
nsCOMPtr<nsIXPConnect> xpc = do_GetService(nsIXPConnect::GetCID());
if (!xpc) return NS_ERROR_FAILURE;
nsCOMPtr<nsIXPCNativeCallContext> cc;
rv = xpc->GetCurrentNativeCallContext(getter_AddRefs(cc));
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
JSContext *cx;
rv = cc->GetJSContext (&cx);
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
mJSrt = JS_GetRuntime (cx);
JSD_UserCallbacks jsd_uc;
jsd_uc.size = sizeof(JSD_UserCallbacks);
jsd_uc.setContext = jsds_SetContextProc;
mJSDcx = JSD_DebuggerOnForUser (mJSrt, &jsd_uc, NULL);
return NS_OK;
}
/* hook attribute get/set functions */
NS_IMETHODIMP
jsdService::SetDebugBreakHook (jsdIExecutionHook *aHook)
{
mDebugBreakHook = aHook;
if (aHook)
JSD_SetDebugBreakHook (mJSDcx, jsds_ExecutionHookProc,
NS_STATIC_CAST(void *, aHook));
else
JSD_ClearDebugBreakHook (mJSDcx);
return NS_OK;
}
NS_IMETHODIMP
jsdService::GetDebugBreakHook (jsdIExecutionHook **aHook)
{
if (!aHook)
return NS_ERROR_NULL_POINTER;
*aHook = mDebugBreakHook;
NS_IF_ADDREF(*aHook);
return NS_OK;
}
NS_IMETHODIMP
jsdService::SetDebuggerHook (jsdIExecutionHook *aHook)
{
mDebuggerHook = aHook;
if (aHook)
JSD_SetDebuggerHook (mJSDcx, jsds_ExecutionHookProc,
NS_STATIC_CAST(void *, aHook));
else
JSD_ClearDebuggerHook (mJSDcx);
return NS_OK;
}
NS_IMETHODIMP
jsdService::GetDebuggerHook (jsdIExecutionHook **aHook)
{
if (!aHook)
return NS_ERROR_NULL_POINTER;
*aHook = mDebuggerHook;
NS_IF_ADDREF(*aHook);
return NS_OK;
}
NS_IMETHODIMP
jsdService::SetInterruptHook (jsdIExecutionHook *aHook)
{
mInterruptHook = aHook;
if (aHook)
JSD_SetInterruptHook (mJSDcx, jsds_ExecutionHookProc,
NS_STATIC_CAST(void *, aHook));
else
JSD_ClearInterruptHook (mJSDcx);
return NS_OK;
}
NS_IMETHODIMP
jsdService::GetInterruptHook (jsdIExecutionHook **aHook)
{
if (!aHook)
return NS_ERROR_NULL_POINTER;
*aHook = mInterruptHook;
NS_IF_ADDREF(*aHook);
return NS_OK;
}
NS_IMETHODIMP
jsdService::SetScriptHook (jsdIScriptHook *aHook)
{
mScriptHook = aHook;
return NS_OK;
}
NS_IMETHODIMP
jsdService::GetScriptHook (jsdIScriptHook **aHook)
{
if (!aHook)
return NS_ERROR_NULL_POINTER;
*aHook = mScriptHook;
NS_IF_ADDREF(*aHook);
return NS_OK;
}
NS_GENERIC_FACTORY_CONSTRUCTOR(jsdService);
static nsModuleComponentInfo components[] = {
{ "JSDService", JSDSERVICE_CID,
jsdServiceContractID,
jsdServiceConstructor},
};
NS_IMPL_NSGETMODULE("JavaScript Debugger", components);

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

@ -1,74 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation
* Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the MPL or the GPL.
*
* Contributor(s):
*
*
*/
#ifndef JSDSERVICE_H___
#define JSDSERVICE_H___
#include "jsdIDebuggerService.h"
#include "jsdebug.h"
#include "nsCOMPtr.h"
#define JSDSERVICE_CID \
{ /* f1299dc2-1dd1-11b2-a347-ee6b7660e048 */ \
0xf1299dc2, \
0x1dd1, \
0x11b2, \
{0xa3, 0x47, 0xee, 0x6b, 0x76, 0x60, 0xe0, 0x48} \
}
class jsdService : public jsdIDebuggerService
{
public:
NS_DECL_ISUPPORTS
NS_DECL_JSDIDEBUGGERSERVICE
jsdService() : mJSrt(0), mJSDcx(0), mDebugBreakHook(0), mDebuggerHook(0),
mInterruptHook(0), mScriptHook(0)
{
NS_INIT_ISUPPORTS();
}
virtual ~jsdService() { }
private:
JSRuntime *mJSrt;
JSDContext *mJSDcx;
nsCOMPtr<jsdIExecutionHook> mDebugBreakHook;
nsCOMPtr<jsdIExecutionHook> mDebuggerHook;
nsCOMPtr<jsdIExecutionHook> mInterruptHook;
nsCOMPtr<jsdIScriptHook> mScriptHook;
};
#endif /* JSDSERVICE_H___ */

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

@ -1,122 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation
* Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the MPL or the GPL.
*
* Contributor(s):
*
*/
#include "jsdHandles.h"
#include "nsString.h"
NS_IMPL_THREADSAFE_ISUPPORTS1(jsdContext, jsdIContext);
NS_IMETHODIMP
jsdContext::GetJSDContext(JSDContext **_rval)
{
if (!_rval)
return NS_ERROR_NULL_POINTER;
*_rval = mCx;
return NS_OK;
}
NS_IMPL_THREADSAFE_ISUPPORTS1(jsdScript, jsdIScript);
NS_IMETHODIMP
jsdScript::GetJSDScript(JSDScript **_rval)
{
if (!_rval)
return NS_ERROR_NULL_POINTER;
*_rval = mScript;
return NS_OK;
}
NS_IMETHODIMP
jsdScript::GetIsActive(PRBool *_rval)
{
if (!_rval)
return NS_ERROR_NULL_POINTER;
*_rval = JSD_IsActiveScript(mCx, mScript);
return NS_OK;
}
NS_IMETHODIMP
jsdScript::GetFileName(PRUnichar **_rval)
{
if (!_rval)
return NS_ERROR_NULL_POINTER;
*_rval = nsCString(JSD_GetScriptFilename(mCx, mScript)).ToNewUnicode();
return NS_OK;
}
NS_IMETHODIMP
jsdScript::GetFunctionName(PRUnichar **_rval)
{
if (!_rval)
return NS_ERROR_NULL_POINTER;
*_rval = nsCString(JSD_GetScriptFunctionName(mCx, mScript)).ToNewUnicode();
return NS_OK;
}
NS_IMETHODIMP
jsdScript::GetBaseLineNumber(PRUint32 *_rval)
{
if (!_rval)
return NS_ERROR_NULL_POINTER;
*_rval = JSD_GetScriptBaseLineNumber(mCx, mScript);
return NS_OK;
}
NS_IMETHODIMP
jsdScript::GetLineExtent(PRUint32 *_rval)
{
if (!_rval)
return NS_ERROR_NULL_POINTER;
*_rval = JSD_GetScriptLineExtent(mCx, mScript);
return NS_OK;
}
NS_IMPL_THREADSAFE_ISUPPORTS1(jsdThreadState, jsdIThreadState);
NS_IMETHODIMP
jsdThreadState::GetJSDThreadState(JSDThreadState **_rval)
{
if (!_rval)
return NS_ERROR_NULL_POINTER;
*_rval = mThreadState;
return NS_OK;
}

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

@ -1,159 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation
* Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the MPL or the GPL.
*
* Contributor(s):
*
*
*/
#ifndef JSDHANDLES_H___
#define JSDHANDLES_H___
#include "jsdIDebuggerService.h"
#include "jsdebug.h"
class jsdThreadState : public jsdIThreadState
{
public:
NS_DECL_ISUPPORTS
NS_DECL_JSDITHREADSTATE
/* you'll normally use use FromPtr() instead of directly constructing one */
jsdThreadState (JSDThreadState *aThreadState) : mThreadState(aThreadState)
{
NS_INIT_ISUPPORTS();
}
/* XXX keep track of these somehow, so we don't create new wrapper if we've
* got one already */
static jsdIThreadState *FromPtr (JSDThreadState *aThreadState)
{
jsdIThreadState *rv = new jsdThreadState (aThreadState);
NS_IF_ADDREF(rv);
return rv;
}
private:
jsdThreadState(); /* no implementation */
jsdThreadState(const jsdThreadState&); /* no implementation */
JSDThreadState *mThreadState;
};
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)
{
NS_INIT_ISUPPORTS();
printf ("++++++ jsdContext: %i\n", mRefCnt);
}
/* XXX keep track of these somehow, so we don't create new wrapper if we've
* got one already */
static jsdIContext *FromPtr (JSDContext *aCx)
{
jsdIContext *rv = new jsdContext (aCx);
NS_IF_ADDREF(rv);
return rv;
}
virtual ~jsdContext() { printf ("------ ~jsdContext: %i\n", mRefCnt); }
private:
jsdContext(); /* no implementation */
jsdContext(const jsdContext&); /* no implementation */
JSDContext *mCx;
};
class jsdScript : public jsdIScript
{
public:
NS_DECL_ISUPPORTS
NS_DECL_JSDISCRIPT
/* you'll normally use use FromPtr() instead of directly constructing one */
jsdScript (JSDContext *aCx, JSDScript *aScript) : mCx(aCx), mScript(aScript)
{
NS_INIT_ISUPPORTS();
}
/* XXX keep track of these somehow, so we don't create new wrapper if we've
* got one already */
static jsdIScript *FromPtr (JSDContext *aCx, JSDScript *aScript)
{
jsdIScript *rv = new jsdScript (aCx, aScript);
NS_IF_ADDREF(rv);
return rv;
}
private:
jsdScript(); /* no implementation */
jsdScript (const jsdScript&); /* no implementation */
JSDContext *mCx;
JSDScript *mScript;
};
#endif /* JSDHANDLES_H___ */
#if 0
#define DECL_HANDLE(type,type_uc,jsd_type) \
class jsd##type : public jsdI##type \
{ \
public: \
NS_DECL_ISUPPORTS; \
NS_DECL_JSDIHANDLE; \
NS_DECL_JSDI##type_uc; \
static jsd##type *FromPtr (jsd_type *aData) \
{ return new jsd##type (aData); } \
private: \
jsd_type *mData; \
jsdHandle (jsd_type *aData) : mData(aData) \
{ \
NS_INIT_ISUPPORTS(); \
} \
}
DECL_HANDLE(Handle, HANDLE, void *);
DECL_HANDLE(Script, SCRIPT, JSDScript);
#undef DECL_HANDLE
#endif

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

@ -1,48 +0,0 @@
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation
# Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation.
#
# Alternatively, the contents of this file may be used under the
# terms of the GNU Public License (the "GPL"), in which case the
# provisions of the GPL are applicable instead of those above.
# If you wish to allow use of your version of this file only
# under the terms of the GPL and not to allow others to use your
# version of this file under the MPL, indicate your decision by
# deleting the provisions above and replace them with the notice
# and other provisions required by the GPL. If you do not delete
# the provisions above, a recipient may use your version of this
# file under either the MPL or the GPL.
#
# Contributor(s):
#
#
DEPTH = ..\..\..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include <$(DEPTH)\config\config.mak>
MODULE = jsdservice
LIBRARY_NAME = jsdservice
IS_COMPONENT = 1
REQUIRES = xpcom string xpconnect
CPPSRCS = jsdDebuggerService.cpp
include <$(DEPTH)\config\rules.mak>