Diff for /chimera/nsCocoaBrowserService.mm between versions 1.8 and 1.10

version 1.8, 2002/02/25 08:44:17 version 1.10, 2002/04/14 08:43:03
Line 41 Line 41
 #include "nsIWebBrowserChrome.h"  #include "nsIWebBrowserChrome.h"
 #include "nsIEmbeddingSiteWindow.h"  #include "nsIEmbeddingSiteWindow.h"
 #include "nsIProfile.h"  #include "nsIProfile.h"
   #include "nsIPrefService.h"
 #include "NSBrowserView.h"  #include "NSBrowserView.h"
 #include "nsCRT.h"  #include "nsCRT.h"
 #include "nsString.h"  #include "nsString.h"
Line 48 Line 49
 nsAlertController* nsCocoaBrowserService::sController = nsnull;  nsAlertController* nsCocoaBrowserService::sController = nsnull;
 nsCocoaBrowserService* nsCocoaBrowserService::sSingleton = nsnull;  nsCocoaBrowserService* nsCocoaBrowserService::sSingleton = nsnull;
 PRUint32 nsCocoaBrowserService::sNumBrowsers = 0;  PRUint32 nsCocoaBrowserService::sNumBrowsers = 0;
   PRBool nsCocoaBrowserService::sCanTerminate = PR_FALSE;
   
 // nsCocoaBrowserService implementation  // nsCocoaBrowserService implementation
 nsCocoaBrowserService::nsCocoaBrowserService()  nsCocoaBrowserService::nsCocoaBrowserService()
Line 143  void Line 145  void
 nsCocoaBrowserService::BrowserClosed()  nsCocoaBrowserService::BrowserClosed()
 {  {
     sNumBrowsers--;      sNumBrowsers--;
    if (!sSingleton && sNumBrowsers == 0) {    if (sCanTerminate && sNumBrowsers == 0) {
         // The app is terminating *and* our count dropped to 0.          // The app is terminating *and* our count dropped to 0.
           NS_IF_RELEASE(sSingleton);
           nsCOMPtr<nsIPrefService> pref(do_GetService("@mozilla.org/preferences-service;1"));
           pref->SavePrefFile(nsnull);
         NS_TermEmbedding();          NS_TermEmbedding();
         printf("Shutting down embedding!\n");          printf("Shutting down embedding!\n");
     }      }
Line 153  nsCocoaBrowserService::BrowserClosed() Line 158  nsCocoaBrowserService::BrowserClosed()
 void  void
 nsCocoaBrowserService::TermEmbedding()  nsCocoaBrowserService::TermEmbedding()
 {  {
    NS_RELEASE(sSingleton);    sCanTerminate = PR_TRUE;
     
     if (sNumBrowsers == 0) {      if (sNumBrowsers == 0) {
        NS_TermEmbedding(); // Safe to terminate now.        NS_IF_RELEASE(sSingleton);
         NS_TermEmbedding();
         printf("Shutting down embedding.\n");          printf("Shutting down embedding.\n");
     }      }
        else
    // Otherwise we cannot yet terminate.  We have to let the death of the browser windows        printf("Cannot yet shut down embedding.\n");
    // induce termination.        // Otherwise we cannot yet terminate.  We have to let the death of the browser windows
         // induce termination.
 }  }
   
 #define NS_ALERT_NIB_NAME "alert"  #define NS_ALERT_NIB_NAME "alert"

Removed from v.1.8  
changed lines
  Added in v.1.10


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>