fix for 79289
This commit is contained in:
idk%eng.sun.com 2001-05-10 20:31:26 +00:00
Родитель d9fefe861d
Коммит 730fc5a9da
15 изменённых файлов: 122 добавлений и 131 удалений

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

@ -59,6 +59,11 @@ EXPORTS = \
CXXFLAGS += -I../public -I../src
DSO_LDOPTS += \
$(XPCOM_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -27,6 +27,6 @@ srcdir = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS= xpidl src loader import classes components test
DIRS= xpidl src jni loader import classes components test
include $(topsrcdir)/config/rules.mk

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

@ -1,40 +0,0 @@
/* -*- Mode: java; 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 Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
* Igor Kushnirskiy <idk@eng.sun.com>
*/
package org.mozilla.xpcom;
public class Components {
public static nsIComponentManager getComponentManager() {
return componentMgr;
}
public static void setComponentManager(nsIComponentManager mgr) {
componentMgr = mgr;
}
public static nsIXPIDLServiceManager getServiceManager() {
return serviceMgr;
}
public static void setServiceManager(nsIXPIDLServiceManager mgr) {
serviceMgr = mgr;
}
private static nsIComponentManager componentMgr = null;
private static nsIXPIDLServiceManager serviceMgr = null;
};

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

@ -81,12 +81,3 @@ public class Utilities {
System.loadLibrary("bcjavastubs");
}
}

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

@ -1,58 +0,0 @@
#!gmake
#
# The contents of this file are subject to the Netscape 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/NPL/
#
# 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. All
# Rights Reserved.
#
# Contributor(s):
# Igor Kushnirskiy <idk@eng.sun.com>
#
DEPTH = ../../../..
topsrcdir = ../../../..
srcdir = .
VPATH = .
include $(DEPTH)/config/autoconf.mk
MODULE = blackConnectInit
LIBRARY_NAME = blackConnectInit
IS_COMPONENT = 1
XPIDL_MODULE = blackConnectInit
XPIDLSRCS = bcIBlackConnectInit.idl
CPPSRCS = bcBlackConnectInit.cpp
include $(topsrcdir)/config/rules.mk
include ../config/rules.mk
COMPONENT=bcBlackConnectInit
CLASSES=bcIBlackConnectInit.class bcBlackConnectInit.class
$(COMPONENT).jar.comp: manifest $(CLASSES)
$(JDKHOME)/bin/jar cvfm $(COMPONENT).jar.comp manifest *.class
.java.class:
$(JDKHOME)/bin/javac -classpath .:../classes:$(DIST)/classes $<
bcIBlackConnectInit.java : bcIBlackConnectInit.idl
install-component: $(COMPONENT).jar.comp $(COMPONENT).jar.info
cp $(COMPONENT).jar.comp $(COMPONENT).jar.info $(DEPTH)/dist/bin/components/
clobber-java:
rm -f *.class *.jar
clobber:: clobber-java
clobber_all:: clobber-java
install:: install-component

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

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

@ -0,0 +1,62 @@
/* -*- 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 Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
* Igor Kushnirskiy <idk@eng.sun.com>
*/
#include "org_mozilla_xpcom_Components.h"
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
/*
* Class: org_mozilla_xpcom_Components
* Method: initXPCOM
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_xpcom_Components_initXPCOM
(JNIEnv *, jclass) {
static int initCounter = 0;
/*
mozilla/embedding/base/nsEmbedAPI.cpp NS_InitEmbedding was used as
prototype
*/
initCounter++;
if (initCounter > 1) {
return;
}
nsresult rv;
nsIServiceManager* servMgr;
rv = NS_InitXPCOM(&servMgr, NULL);
if (NS_FAILED(rv)) {
printf("--Components::initXPCOM failed \n");
return;
}
rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup,
NULL /* default */);
if (NS_FAILED(rv)) {
printf("--Components::initXPCOM failed \n");
return;
}
}

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

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

@ -39,6 +39,10 @@ CPPSRCS = \
bcJavaComponentFactory.cpp \
$(NULL)
DSO_LDOPTS += \
$(XPCOM_LIBS) \
$(NULL)
CXXFLAGS += -I$(JDKHOME)/include -I$(JDKHOME)/include/linux $(MOZ_TOOLKIT_REGISTRY_CFLAGS) -D_REENTRANT -DOJI_DISABLE -I$(CONNECT_SRC)/public
include $(topsrcdir)/config/rules.mk

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

@ -66,9 +66,13 @@ DSO_LDOPTS += \
-L$(JDKHOME)/jre/lib/$(HOSTTYPE)/ \
-L$(JDKHOME)/jre/lib/$(HOSTTYPE)/classic \
-L$(JDKHOME)/jre/lib/$(HOSTTYPE)/native_threads \
-ljvm -lhpi -ljava -lawt\
-ljvm -lhpi -ljava -lawt \
$(NULL)
DSO_LDOPTS += \
$(XPCOM_LIBS) \
$(NULL)
#DSO_LDOPTS += \
# -L$(JDKHOME)/jre/bin \
# -L$(JDKHOME)/jre/bin/classic \
@ -80,9 +84,8 @@ DSO_LDOPTS += \
-lthread -lXm -lX11 -lXt -lm
endif
EXTRA_DSO_LDOPTS += \
-L$(DIST)/bin/components/ \
$(NULL)
include $(topsrcdir)/config/rules.mk
CCC += $(CXXFLAGS) # I want to have $(JDKHOME)/include before $(DIST) include

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

@ -38,6 +38,10 @@ CPPSRCS = bcJavaSample.cpp
include $(topsrcdir)/config/rules.mk
include ../config/rules.mk
DSO_LDOPTS += \
$(XPCOM_LIBS) \
$(NULL)
bcJavaSample.jar.comp: manifest bcIJavaSample.class bcJavaSample.class
$(JDKHOME)/bin/jar cvfm bcJavaSample.jar.comp manifest *.class
.java.class:

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

@ -128,13 +128,14 @@ void test() {
}
//sigsend(P_PID, getpid(),SIGINT);
//test->Test1(2000);
test->Test1(1000);
bcIJavaSample *test1;
if (NS_FAILED(r)) {
printf("failed to get component. try to restart test\n");
} else {
test->Test2(a);
}
}
test->QueryInterface(NS_GET_IID(bcIJavaSample),(void**)&test1);
int intArray[] = {1,2,3};
test->Test3(3, intArray);
@ -192,10 +193,10 @@ extern "C" NS_EXPORT nsresult NSGetModule(nsIComponentManager *compMgr,
nsIModule** result) //I am using it for runnig test *only*
{
if (counter == 0) {
counter ++;
printf("--bcJavaSample before test\n");
test();
printf("--bcJavaSample after test\n");
counter ++;
printf("--bcJavaSample before test\n");
test();
printf("--bcJavaSample after test\n");
}
return NS_ERROR_FAILURE;
}

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

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
/* -*- Mode: java; 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
@ -23,6 +23,7 @@ import org.mozilla.xpcom.*;
import java.lang.reflect.*;
public class bcJavaSample implements bcIJavaSample {
bcIJavaSample object;
public bcJavaSample() {
System.out.println("--[java]bcJavaSample constructor");
}
@ -41,11 +42,14 @@ public class bcJavaSample implements bcIJavaSample {
public void test0() {
System.out.println("--[java]bcJavaSample.test0");
nsIXPIDLServiceManager sm = Components.getServiceManager();
nsISupports service = sm.getService(new CID("f0032af2-1dd1-11b2-bb75-c242dcb4f47a"), new IID("1f29f516-1dd2-11b2-9751-f129d72134d0"));
nsISupports service = sm.getService(new CID("f0032af2-1dd1-11b2-bb75-c242dcb4f47a"), new IID("1f29f516-1dd2-11b2-9751-f129d72134d0"));
System.out.println("--[java]bcJavaSample.test0 current thread "+Thread.currentThread()+"\n");
Thread.dumpStack();
}
public void test1(int l) {
System.out.println("--[java]bcJavaSample.test1 "+l+"\n");
}
public void test2(bcIJavaSample o) {
System.out.println("--[java]bcJavaSample.test2");
@ -61,9 +65,23 @@ public class bcJavaSample implements bcIJavaSample {
String[] strings = {"4","3","2","1"};
o.test6(4, strings);
}
System.out.println("--[java]bcJavaSample.test2 doing threads test\n");
System.out.println("--[java]bcJavaSample.test2 current thread "+Thread.currentThread()+"\n");
Thread.dumpStack();
o.test2(this);
object = o;
new Thread( new Runnable() {
public void run() {
System.out.println("--[java]bcJavaSample.test2 current thread "+Thread.currentThread()+"\n");
object.test2(bcJavaSample.this);
}
}).start();
} else {
System.out.println("--[java]bcJavaSample.test2 o = null");
}
}
public void test3(int count, int[] valueArray) {
System.out.println("--[java]bcJavaSample.test3");

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

@ -26,6 +26,10 @@ topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
LIBRARY_NAME = bcXPCOMWrappers
MODULE = bcXPCOMWrappers
@ -44,8 +48,10 @@ CPPSRCS = \
nsXPIDLServiceManager.cpp \
$(NULL)
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
DSO_LDOPTS += \
$(XPCOM_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -41,20 +41,15 @@ CPPSRCS = \
bcXPCOMStubsAndProxies.cpp \
bcXPCOMLog.cpp \
$(NULL)
EXPORTS = \
bcIXPCOMStubsAndProxies.h \
bcXPCOMStubsAndProxiesCID.h \
$(NULL)
LIBS = \
-lxpcom \
-lxptinfo \
$(NSPR_LIBS) \
$(NULL)
EXTRA_DSO_LDOPTS += \
-L$(DIST)/bin/components/ \
$(NULL)
DSO_LDOPTS += \
$(XPCOM_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk