зеркало из https://github.com/mozilla/pjs.git
Bug 383543 - mozStorageService cleanup. r=sspitzer
This commit is contained in:
Родитель
bfca11e71a
Коммит
4848707dc1
|
@ -23,6 +23,7 @@
|
|||
* Contributor(s):
|
||||
* Vladimir Vukicevic <vladimir.vukicevic@oracle.com>
|
||||
* Brett Wilson <brettw@gmail.com>
|
||||
* Shawn Wilsher <me@shawnwilsher.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -49,9 +50,6 @@
|
|||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS2(mozStorageService, mozIStorageService, nsIObserver)
|
||||
|
||||
// XXX this sucks that we have to pull in nsIFile and all that
|
||||
// just to use NS_GetSpecialDirectory
|
||||
|
||||
static const char kShutdownMessage[] = "xpcom-shutdown-threads";
|
||||
|
||||
mozStorageService::mozStorageService()
|
||||
|
@ -122,14 +120,13 @@ mozStorageService::OpenSpecialDatabase(const char *aStorageKey, mozIStorageConne
|
|||
}
|
||||
|
||||
mozStorageConnection *msc = new mozStorageConnection(this);
|
||||
if (! msc)
|
||||
if (!msc)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsCOMPtr<mozIStorageConnection> conn = msc;
|
||||
rv = msc->Initialize (storageFile);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*_retval = conn;
|
||||
NS_ADDREF(*_retval);
|
||||
rv = msc->Initialize (storageFile);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
NS_ADDREF(*_retval = msc);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -140,14 +137,13 @@ mozStorageService::OpenDatabase(nsIFile *aDatabaseFile, mozIStorageConnection **
|
|||
nsresult rv;
|
||||
|
||||
mozStorageConnection *msc = new mozStorageConnection(this);
|
||||
if (! msc)
|
||||
if (!msc)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsCOMPtr<mozIStorageConnection> conn = msc;
|
||||
rv = msc->Initialize (aDatabaseFile);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*_retval = conn;
|
||||
NS_ADDREF(*_retval);
|
||||
rv = msc->Initialize (aDatabaseFile);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
NS_ADDREF(*_retval = msc);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -156,9 +152,8 @@ mozStorageService::Observe(nsISupports *aSubject, const char *aTopic,
|
|||
const PRUnichar *aData)
|
||||
{
|
||||
nsresult rv;
|
||||
if (nsCRT::strcmp(aTopic, kShutdownMessage) == 0) {
|
||||
if (strcmp(aTopic, kShutdownMessage) == 0) {
|
||||
rv = FinishAsyncIO();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
return NS_OK;
|
||||
return rv;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче