*not part of the buld*
blackConnect tests update git-svn-id: svn://10.0.0.236/trunk@99925 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
*/
|
||||
|
||||
#include "plstr.h"
|
||||
#include "prmem.h"
|
||||
#include "stdio.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "MThreadComponent2.h"
|
||||
@@ -31,10 +32,25 @@
|
||||
#include <stdlib.h>
|
||||
#include "nsID.h"
|
||||
|
||||
iMThreadContext* context;
|
||||
void* iThread;
|
||||
void* eThread;
|
||||
|
||||
iMThreadContext* context=NULL;
|
||||
iMThreadComponent* tComponent=NULL;
|
||||
void* iThread=NULL;
|
||||
void* eThread=NULL;
|
||||
int newT=0, newS=0;
|
||||
|
||||
void Exec(void* arg) {
|
||||
tComponent->Initialize(context);
|
||||
nsIComponentManager* cm;
|
||||
nsresult rv = NS_GetGlobalComponentManager(&cm);
|
||||
if(NS_FAILED(rv)) {
|
||||
fprintf(stderr, "ERROR: Can't get GlobalComponentManager!!\n");
|
||||
return;
|
||||
}
|
||||
tComponent->THack(cm);
|
||||
tComponent->Execute(newT,newS);
|
||||
}
|
||||
|
||||
MThreadComponent2Impl::MThreadComponent2Impl()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
@@ -54,37 +70,77 @@ NS_IMETHODIMP MThreadComponent2Impl::Initialize(iMThreadContext* c){
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP MThreadComponent2Impl::Execute(const char* tName){
|
||||
printf("MThreadComponent2Impl::Execute. Thread is %s\n", tName);
|
||||
eThread = PR_GetCurrentThread();
|
||||
if(eThread == iThread) {
|
||||
printf("###Execute and initialize were executed in one thread\n");
|
||||
}else {
|
||||
printf("###Execute and initialize were executed in DIFFERENT threads\n");
|
||||
}
|
||||
char* progID;
|
||||
context->GetNext(&progID);
|
||||
nsCID classID;
|
||||
classID.Parse(progID);
|
||||
printf("MThreadComponent2Impl::Execute. progID is %s\n",progID);
|
||||
iMThreadComponent* tComponent;
|
||||
nsresult rv = nsComponentManager::CreateInstance(classID,
|
||||
nsnull,
|
||||
NS_GET_IID(iMThreadComponent),
|
||||
(void**)&tComponent);
|
||||
if(NS_FAILED(rv)) {
|
||||
printf("MThreadComponent2Impl:Create instance failed from %s!!!",classID.ToString());
|
||||
return rv;
|
||||
}
|
||||
tComponent->Initialize(context);
|
||||
tComponent->Execute(tName);
|
||||
|
||||
NS_IMETHODIMP MThreadComponent2Impl::THack(nsIComponentManager* cm){
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP MThreadComponent2Impl::Execute(int thread, int stage){
|
||||
|
||||
char* tmp=(char*)PR_Malloc(sizeof(char*));
|
||||
tmp="";
|
||||
FILE *file;
|
||||
|
||||
printf("MThreadComponent2Impl::Execute.\n");
|
||||
eThread = PR_GetCurrentThread();
|
||||
if(eThread == iThread) {
|
||||
printf("###Execute and initialize were executed in one thread\n");
|
||||
} else {
|
||||
printf("###Execute and initialize were executed in DIFFERENT threads\n");
|
||||
}
|
||||
|
||||
char* progID;
|
||||
char* res=(char*)PR_Malloc(sizeof(char*));
|
||||
|
||||
context->GetResFile(&res);
|
||||
|
||||
if ((file = fopen(res, "a+t")) == NULL) {
|
||||
fprintf(stderr, "ERROR: can't open file %s\n",res);
|
||||
return NS_OK;
|
||||
}
|
||||
sprintf(tmp,"%d,%d,",thread,stage);
|
||||
fwrite(tmp,1,strlen(tmp),file);
|
||||
sprintf(tmp,"%d\n",eThread);
|
||||
fwrite(tmp,1,strlen(tmp),file);
|
||||
fclose(file);
|
||||
|
||||
context->GetContractID(thread,stage+1,&progID);
|
||||
nsCID classID;
|
||||
|
||||
classID.Parse(progID);
|
||||
nsresult rv = nsComponentManager::CreateInstance(classID,
|
||||
nsnull,
|
||||
NS_GET_IID(iMThreadComponent),
|
||||
(void**)&tComponent);
|
||||
if(NS_FAILED(rv)) {
|
||||
fprintf(stderr, "MThreadComponent2Impl:Create instance failed from %s!!!\n",classID.ToString());
|
||||
} else {
|
||||
tComponent->Initialize(context);
|
||||
nsIComponentManager* cm;
|
||||
rv = NS_GetGlobalComponentManager(&cm);
|
||||
if(NS_FAILED(rv)) {
|
||||
fprintf(stderr, "ERROR: Can't get GlobalComponentManager!!\n");
|
||||
return NS_OK;
|
||||
}
|
||||
tComponent->THack(cm);
|
||||
tComponent->Execute(thread,stage+1);
|
||||
}
|
||||
|
||||
|
||||
context->GetContractID(thread+1,stage+1,&progID);
|
||||
classID.Parse(progID);
|
||||
rv = nsComponentManager::CreateInstance(classID, nsnull,
|
||||
NS_GET_IID(iMThreadComponent),
|
||||
(void**)&tComponent);
|
||||
if(NS_FAILED(rv)) {
|
||||
fprintf(stderr, "MThreadComponent2Impl: 2: Create instance failed from %s!!!\n",progID);
|
||||
} else {
|
||||
newT=thread+1;
|
||||
newS=stage+1;
|
||||
PR_CreateThread(PR_USER_THREAD, Exec,
|
||||
this, PR_PRIORITY_NORMAL, PR_LOCAL_THREAD,
|
||||
PR_UNJOINABLE_THREAD, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_DECL_IMTHREADCOMPONENT2
|
||||
NS_DECL_IMTHREADCOMPONENT
|
||||
NS_DECL_IMTHREADCOMPONENT
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -29,18 +29,10 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(MThreadComponent2Impl)
|
||||
|
||||
static nsModuleComponentInfo components[] =
|
||||
{
|
||||
{ "X2JIN Client Test Component", MTHREADCOMPONENT2_CID, MTHREADCOMPONENT2_PROGID, MThreadComponent2ImplConstructor,
|
||||
{ "MultiThread Component 2", MTHREADCOMPONENT2_CID, MTHREADCOMPONENT2_PROGID, MThreadComponent2ImplConstructor,
|
||||
NULL /* NULL if you dont need one */,
|
||||
NULL /* NULL if you dont need one */
|
||||
}
|
||||
};
|
||||
|
||||
NS_IMPL_NSGETMODULE("MThreadComponent2Factory", components)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Client QA Team, St. Petersburg, Russia
|
||||
#
|
||||
|
||||
DEPTH=../../../../../..
|
||||
topsrcdir = $(DEPTH)
|
||||
|
||||
@@ -40,7 +40,7 @@ interface iMThreadComponent2 : nsISupports
|
||||
{0xb8, 0xdf, 0x4c, 0x28, 0xc0, 0x68, 0x68, 0x63} \
|
||||
}
|
||||
|
||||
#define MTHREADCOMPONENT2_PROGID "component://netscape/blackwood/blackconnect/test/mthreads/MThreadComponent2"
|
||||
#define MTHREADCOMPONENT2_PROGID "@mozilla/blackwood/blackconnect/test/mthreads/MThreadComponent2;1"
|
||||
|
||||
%}
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Client QA Team, St. Petersburg, Russia
|
||||
#
|
||||
|
||||
DEPTH=..\..\..\..\..\..
|
||||
topsrcdir = $(DEPTH)
|
||||
@@ -29,6 +31,10 @@ MAKE_OBJ_TYPE = DLL
|
||||
DLLNAME = $(MODULE)
|
||||
DLL =.\$(OBJDIR)\$(DLLNAME).dll
|
||||
COMPONENT = 1
|
||||
JAVA_OR_NSJVM=1
|
||||
NO_CAFE=1
|
||||
|
||||
include <$(DEPTH)\config\config.mak>
|
||||
|
||||
CPP_OBJS = \
|
||||
.\$(OBJDIR)\MThreadComponent2.obj \
|
||||
@@ -39,20 +45,19 @@ XPIDLSRCS = \
|
||||
.\iMThreadComponent2.idl \
|
||||
$(NULL)
|
||||
|
||||
JAVAI = iMThreadComponent2.java
|
||||
|
||||
LLIBS =$(LLIBS) $(LIBNSPR) $(DIST)\lib\xpcom.lib
|
||||
|
||||
JDIRS = .
|
||||
JAVAC_PROG=$(JDKHOME)\bin\javac
|
||||
JAVAC_FLAGS=-classpath $(CLASSPATH);$(JAVA_DESTPATH) -d $(JAVA_DESTPATH)
|
||||
|
||||
include <$(topsrcdir)\config\rules.mak>
|
||||
include <$(topsrcdir)\config\javarules.mak>
|
||||
|
||||
javai:
|
||||
echo $(JDKHOME)\bin\javac -classpath $(DEPTH)\dist\classes -d $(DEPTH)\dist\classes $(JAVAI)
|
||||
$(JDKHOME)\bin\javac -classpath $(DEPTH)\dist\classes -d $(DEPTH)\dist\classes $(JAVAI)
|
||||
|
||||
install:: $(DLL) javai
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) $(DLL) $(DIST)\bin\components
|
||||
|
||||
clobber::
|
||||
del /f $(DIST)\bin\components\$(DLLNAME).dll
|
||||
del /f $(DIST)\bin\components\$(DLLNAME).xpt
|
||||
del /f $(DIST)\..\classes\org\mozilla\xpcom\iMThreadComponent2.class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user