svnno****@sourc*****
svnno****@sourc*****
2007年 8月 19日 (日) 02:10:13 JST
Revision: 202 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=bbs2ch&view=rev&rev=202 Author: flyson Date: 2007-08-19 02:10:13 +0900 (Sun, 19 Aug 2007) Log Message: ----------- ソースコードの整理 Modified Paths: -------------- trunk/bbs2chreader/components/b2rServer.js Modified: trunk/bbs2chreader/components/b2rServer.js =================================================================== --- trunk/bbs2chreader/components/b2rServer.js 2007-08-15 14:36:11 UTC (rev 201) +++ trunk/bbs2chreader/components/b2rServer.js 2007-08-18 17:10:13 UTC (rev 202) @@ -91,17 +91,16 @@ serverSocket.init(port, true, 10); serverSocket.asyncListen(this); - dump("b2rServer.run : Listening Port " + port + "\n"); + dump("b2rServer.run : Start Listening Port " + port + "\n"); this._runningEventLoop = true; this._eventQueue.eventLoop(); this._runningEventLoop = false; - dump("b2rServer.run : Stop Listening\n"); - serverSocket.close(); this._eventQueue.processPendingEvents(); this._eventQueue.stopAcceptingEvents(); this._eventQueue.processPendingEvents(); this._eventQueue = null; + dump("b2rServer.run : Stop Listening Port " + port + "\n"); }, @@ -126,11 +125,11 @@ switch(aTopic){ case "app-startup": os.addObserver(this, "network:offline-status-changed", false); - os.addObserver(this, "final-ui-startup", false); + os.addObserver(this, "profile-after-change", false); os.addObserver(this, "xpcom-shutdown", false); break; - case "final-ui-startup": - os.removeObserver(this, "final-ui-startup"); + case "profile-after-change": + os.removeObserver(this, "profile-after-change"); this.start(); break; case "network:offline-status-changed": @@ -142,7 +141,6 @@ break; case "xpcom-shutdown": this.stop(); - this.close(); os.removeObserver(this, "xpcom-shutdown"); os.removeObserver(this, "network:offline-status-changed"); break; @@ -153,8 +151,8 @@ // ********** ********* implements nsISupports ********** ********** QueryInterface: function(aIID){ - if(aIID.equals(Components.interfaces.nsIServerSocketListener)) return this; if(aIID.equals(Components.interfaces.nsIServerSocket)) return this; + if(aIID.equals(Components.interfaces.nsIServerSocketListener)) return this; if(aIID.equals(Components.interfaces.nsIRunnable)) return this; if(aIID.equals(Components.interfaces.nsIObserver)) return this; if(aIID.equals(Components.interfaces.nsISupportsWeakReference)) return this; @@ -213,13 +211,13 @@ serverSocket.init(port, true, 10); serverSocket.asyncListen(this); - dump("b2rServer_GECKO_1_9.run : Listening Port " + port + "\n"); + dump("b2rServer_GECKO_1_9.run : Start Listening Port " + port + "\n"); this._listening = true; while(this._listening){ this._thread.processNextEvent(true); } serverSocket.close(); - dump("b2rServer_GECKO_1_9.run : Stop Listening\n"); + dump("b2rServer_GECKO_1_9.run : Stop Listening Port " + port + "\n"); }, @@ -244,11 +242,11 @@ switch(aTopic){ case "app-startup": os.addObserver(this, "network:offline-status-changed", false); - os.addObserver(this, "final-ui-startup", false); + os.addObserver(this, "profile-after-change", false); os.addObserver(this, "xpcom-shutdown", false); break; - case "final-ui-startup": - os.removeObserver(this, "final-ui-startup"); + case "profile-after-change": + os.removeObserver(this, "profile-after-change"); this.start(); break; case "network:offline-status-changed": @@ -260,7 +258,6 @@ break; case "xpcom-shutdown": this.stop(); - this.close(); os.removeObserver(this, "xpcom-shutdown"); os.removeObserver(this, "network:offline-status-changed"); break; @@ -271,8 +268,8 @@ // ********** ********* implements nsISupports ********** ********** QueryInterface: function(aIID){ - if(aIID.equals(Components.interfaces.nsIServerSocketListener)) return this; if(aIID.equals(Components.interfaces.nsIServerSocket)) return this; + if(aIID.equals(Components.interfaces.nsIServerSocketListener)) return this; if(aIID.equals(Components.interfaces.nsIRunnable)) return this; if(aIID.equals(Components.interfaces.nsIObserver)) return this; if(aIID.equals(Components.interfaces.nsISupportsWeakReference)) return this; @@ -537,11 +534,10 @@ createInstance: function (aOuter, aIID) { if(aOuter != null) throw Components.results.NS_ERROR_NO_AGGREGATION; - - if(aIID.equals(Components.interfaces.nsIServerSocketListener)) - return this.getInstance(aIID); if(aIID.equals(Components.interfaces.nsIServerSocket)) return this.getInstance(aIID); + if(aIID.equals(Components.interfaces.nsIServerSocketListener)) + return this.getInstance(aIID); if(aIID.equals(Components.interfaces.nsIRunnable)) return this.getInstance(aIID); if(aIID.equals(Components.interfaces.nsIObserver)) @@ -575,7 +571,7 @@ CONTRACTID: "@mozilla.org/b2r-server;1", CID: Components.ID("{f99671cf-868a-4e46-a849-a7bf35a878d7}"), - CNAME: "b2rServerFactory JS Component", + CNAME: "b2rServer JS Component", registerSelf: function(aCompMgr, aFileSpec, aLocation, aType){ @@ -586,8 +582,7 @@ var categoryManager = Components.classes["@mozilla.org/categorymanager;1"] .getService(Components.interfaces.nsICategoryManager); - categoryManager.addCategoryEntry("app-startup", this.CONTRACTID, - this.CONTRACTID, true, true); + categoryManager.addCategoryEntry("app-startup", this.CNAME, this.CONTRACTID, true, true); },