Backed out changeset 3c42531f4ec8 (bug 627672) because of possibility of being related to the Maemo oranges
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 15 Apr 2011 16:41:36 -0400
changeset 68187 d492992e2884acde428e5c06bd88123c65267644
parent 68186 979b2dace25337817c32c4c342c4d830a9399ce5
child 68188 ab7b7d345f4a7cc99cff73a45f93540df833bdb8
push id19533
push usereakhgari@mozilla.com
push dateFri, 15 Apr 2011 20:41:50 +0000
treeherdermozilla-central@d492992e2884 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs627672
milestone6.0a1
backs out3c42531f4ec88dc53eb3bd189de3e43ae12c4a62
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 3c42531f4ec8 (bug 627672) because of possibility of being related to the Maemo oranges
netwerk/base/src/nsIOService.cpp
netwerk/base/src/nsIOService.h
--- a/netwerk/base/src/nsIOService.cpp
+++ b/netwerk/base/src/nsIOService.cpp
@@ -160,33 +160,31 @@ PRInt16 gBadPortList[] = {
   2049, // nfs
   4045, // lockd
   6000, // x11        
   0,    // This MUST be zero so that we can populating the array
 };
 
 static const char kProfileChangeNetTeardownTopic[] = "profile-change-net-teardown";
 static const char kProfileChangeNetRestoreTopic[] = "profile-change-net-restore";
-static const char kStartupTopic[] = "profile-after-change";
 
 // Necko buffer cache
 nsIMemory* nsIOService::gBufferCache = nsnull;
 PRUint32   nsIOService::gDefaultSegmentSize = 4096;
 PRUint32   nsIOService::gDefaultSegmentCount = 24;
 
 ////////////////////////////////////////////////////////////////////////////////
 
 nsIOService::nsIOService()
     : mOffline(PR_TRUE)
     , mOfflineForProfileChange(PR_FALSE)
     , mManageOfflineStatus(PR_TRUE)
     , mSettingOffline(PR_FALSE)
     , mSetOfflineValue(PR_FALSE)
     , mShutdown(PR_FALSE)
-    , mNetworkLinkServiceInitialized(PR_FALSE)
     , mChannelEventSinks(NS_CHANNEL_EVENT_SINK_CATEGORY)
     , mContentSniffers(NS_CONTENT_SNIFFER_CATEGORY)
 {
 }
 
 nsresult
 nsIOService::Init()
 {
@@ -231,17 +229,16 @@ nsIOService::Init()
     }
     
     // Register for profile change notifications
     nsCOMPtr<nsIObserverService> observerService =
         mozilla::services::GetObserverService();
     if (observerService) {
         observerService->AddObserver(this, kProfileChangeNetTeardownTopic, PR_TRUE);
         observerService->AddObserver(this, kProfileChangeNetRestoreTopic, PR_TRUE);
-        observerService->AddObserver(this, kStartupTopic, PR_TRUE);
         observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_TRUE);
         observerService->AddObserver(this, NS_NETWORK_LINK_TOPIC, PR_TRUE);
     }
     else
         NS_WARNING("failed to get observer service");
         
     NS_TIME_FUNCTION_MARK("Registered observers");
 
@@ -260,19 +257,29 @@ nsIOService::Init()
         NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Was unable to allocate.  No gBufferCache.");
         CallQueryInterface(recyclingAllocator, &gBufferCache);
     }
 
     NS_TIME_FUNCTION_MARK("Set up the recycling allocator");
 
     gIOService = this;
 
-    // We can't really determine if the machine has a usable network connection,
-    // (mNetworkLinkService will be initialized later) so let's cross our fingers!
-    SetOffline(PR_FALSE);
+    // go into managed mode if we can, and chrome process
+    if (XRE_GetProcessType() == GeckoProcessType_Default)
+        mNetworkLinkService = do_GetService(NS_NETWORK_LINK_SERVICE_CONTRACTID);
+
+    if (!mNetworkLinkService)
+        // We can't really determine if the machine has a usable network connection,
+        // so let's cross our fingers!
+        mManageOfflineStatus = PR_FALSE;
+
+    if (mManageOfflineStatus)
+        TrackNetworkLinkStatusForOffline();
+    else
+        SetOffline(PR_FALSE);
     
     NS_TIME_FUNCTION_MARK("Set up network link service");
 
     return NS_OK;
 }
 
 
 nsIOService::~nsIOService()
@@ -297,52 +304,16 @@ nsIOService::InitializeSocketTransportSe
     if (mSocketTransportService) {
         rv = mSocketTransportService->Init();
         NS_ASSERTION(NS_SUCCEEDED(rv), "socket transport service init failed");
     }
 
     return rv;
 }
 
-nsresult
-nsIOService::InitializeNetworkLinkService()
-{
-    NS_TIME_FUNCTION;
-
-    nsresult rv = NS_OK;
-
-    if (mNetworkLinkServiceInitialized)
-      return rv;
-
-    // go into managed mode if we can, and chrome process
-    if (XRE_GetProcessType() == GeckoProcessType_Default)
-    {
-        mNetworkLinkService = do_GetService(NS_NETWORK_LINK_SERVICE_CONTRACTID, &rv);
-        if (NS_FAILED(rv)) {
-            NS_WARNING("failed to get network link service");
-            return rv;
-        }
-    }
-  
-    mNetworkLinkServiceInitialized = PR_TRUE;
-
-    if (!mNetworkLinkService) {
-        // We can't really determine if the machine has a usable network connection,
-        // so let's cross our fingers!
-        mManageOfflineStatus = PR_FALSE;
-    }
-
-    if (mManageOfflineStatus)
-        TrackNetworkLinkStatusForOffline();
-    else
-        SetOffline(PR_FALSE);
-    
-    return rv;
-}
-
 nsIOService*
 nsIOService::GetInstance() {
     if (!gIOService) {
         gIOService = new nsIOService();
         if (!gIOService)
             return nsnull;
         NS_ADDREF(gIOService);
 
@@ -706,19 +677,16 @@ nsIOService::NewChannel(const nsACString
     if (NS_FAILED(rv)) return rv;
 
     return NewChannelFromURI(uri, result);
 }
 
 PRBool
 nsIOService::IsLinkUp()
 {
-    NS_ASSERTION(mNetworkLinkServiceInitialized, 
-                 "network link service should be initialized");
-
     if (!mNetworkLinkService) {
         // We cannot decide, assume the link is up
         return PR_TRUE;
     }
 
     PRBool isLinkUp;
     nsresult rv;
     rv = mNetworkLinkService->GetIsLinkUp(&isLinkUp);
@@ -987,20 +955,16 @@ nsIOService::Observe(nsISupports *subjec
         if (mOfflineForProfileChange) {
             mOfflineForProfileChange = PR_FALSE;
             if (!mManageOfflineStatus ||
                 NS_FAILED(TrackNetworkLinkStatusForOffline())) {
                 SetOffline(PR_FALSE);
             }
         } 
     }
-    else if (!strcmp(topic, kStartupTopic)) {
-        // Lazy initialization of network link service (see bug 620472)
-        InitializeNetworkLinkService();
-    }
     else if (!strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
         // Remember we passed XPCOM shutdown notification to prevent any
         // changes of the offline status from now. We must not allow going
         // online after this point.
         mShutdown = PR_TRUE;
 
         SetOffline(PR_TRUE);
 
@@ -1108,42 +1072,32 @@ nsIOService::NewSimpleNestedURI(nsIURI* 
     NS_IF_ADDREF(*aResult = new nsSimpleNestedURI(safeURI));
     return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
 }
 
 NS_IMETHODIMP
 nsIOService::SetManageOfflineStatus(PRBool aManage) {
     PRBool wasManaged = mManageOfflineStatus;
     mManageOfflineStatus = aManage;
-
-    if (!mNetworkLinkServiceInitialized) {
-        nsresult rv = InitializeNetworkLinkService();
-        if (NS_FAILED(rv))
-            return rv;
-    }
-
     if (mManageOfflineStatus && !wasManaged)
         return TrackNetworkLinkStatusForOffline();
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsIOService::GetManageOfflineStatus(PRBool* aManage) {
     *aManage = mManageOfflineStatus;
     return NS_OK;
 }
 
 nsresult
 nsIOService::TrackNetworkLinkStatusForOffline()
 {
     NS_ASSERTION(mManageOfflineStatus,
                  "Don't call this unless we're managing the offline status");
-    NS_ASSERTION(mNetworkLinkServiceInitialized, 
-                "network link service should be set up");
-
     if (!mNetworkLinkService)
         return NS_ERROR_FAILURE;
 
     if (mShutdown)
         return NS_ERROR_NOT_AVAILABLE;
   
     // check to make sure this won't collide with Autodial
     if (mSocketTransportService) {
--- a/netwerk/base/src/nsIOService.h
+++ b/netwerk/base/src/nsIOService.h
@@ -129,17 +129,16 @@ private:
                                               nsIProtocolHandler* hdlr);
 
     // Prefs wrangling
     NS_HIDDEN_(void) PrefsChanged(nsIPrefBranch *prefs, const char *pref = nsnull);
     NS_HIDDEN_(void) GetPrefBranch(nsIPrefBranch2 **);
     NS_HIDDEN_(void) ParsePortList(nsIPrefBranch *prefBranch, const char *pref, PRBool remove);
 
     nsresult InitializeSocketTransportService();
-    nsresult InitializeNetworkLinkService();
 
 private:
     PRPackedBool                         mOffline;
     PRPackedBool                         mOfflineForProfileChange;
     PRPackedBool                         mManageOfflineStatus;
 
     // Used to handle SetOffline() reentrancy.  See the comment in
     // SetOffline() for more details.
@@ -147,17 +146,16 @@ private:
     PRPackedBool                         mSetOfflineValue;
 
     PRPackedBool                         mShutdown;
 
     nsCOMPtr<nsPISocketTransportService> mSocketTransportService;
     nsCOMPtr<nsPIDNSService>             mDNSService;
     nsCOMPtr<nsIProtocolProxyService2>   mProxyService;
     nsCOMPtr<nsINetworkLinkService>      mNetworkLinkService;
-    PRPackedBool                         mNetworkLinkServiceInitialized;
     
     // Cached protocol handlers
     nsWeakPtr                            mWeakHandler[NS_N(gScheme)];
 
     // cached categories
     nsCategoryCache<nsIChannelEventSink> mChannelEventSinks;
     nsCategoryCache<nsIContentSniffer>   mContentSniffers;