зеркало из https://github.com/mozilla/pjs.git
Bug 379929 - Lazy creation of nsProperties object for imgContainer
p=Alfred Kayser <alfredkayser@nl.ibm.com> r=stuart, sr=tor
This commit is contained in:
Родитель
db4d460cfd
Коммит
ebe308aea3
|
@ -60,7 +60,6 @@ imgContainer::imgContainer() :
|
|||
mLoopCount(-1),
|
||||
mObserver(nsnull)
|
||||
{
|
||||
mProperties = do_CreateInstance("@mozilla.org/properties;1");
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
|
@ -827,3 +826,47 @@ PRBool imgContainer::CopyFrameImage(gfxIImageFrame *aSrcFrame,
|
|||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/********* Methods to implement lazy allocation of nsIProperties object *************/
|
||||
NS_IMETHODIMP imgContainer::Get(const char *prop, const nsIID & iid, void * *result)
|
||||
{
|
||||
if (!mProperties)
|
||||
return NS_ERROR_FAILURE;
|
||||
return mProperties->Get(prop, iid, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP imgContainer::Set(const char *prop, nsISupports *value)
|
||||
{
|
||||
if (!mProperties)
|
||||
mProperties = do_CreateInstance("@mozilla.org/properties;1");
|
||||
if (!mProperties)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return mProperties->Set(prop, value);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP imgContainer::Has(const char *prop, PRBool *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
if (!mProperties) {
|
||||
*_retval = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
return mProperties->Has(prop, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP imgContainer::Undefine(const char *prop)
|
||||
{
|
||||
if (!mProperties)
|
||||
return NS_ERROR_FAILURE;
|
||||
return mProperties->Undefine(prop);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP imgContainer::GetKeys(PRUint32 *count, char ***keys)
|
||||
{
|
||||
if (!mProperties) {
|
||||
*count = 0;
|
||||
*keys = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
return mProperties->GetKeys(count, keys);
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_IMGICONTAINER
|
||||
NS_DECL_NSITIMERCALLBACK
|
||||
NS_FORWARD_SAFE_NSIPROPERTIES(mProperties)
|
||||
NS_DECL_NSIPROPERTIES
|
||||
|
||||
imgContainer();
|
||||
virtual ~imgContainer();
|
||||
|
|
Загрузка…
Ссылка в новой задаче