"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "platform/widget/windows/nsDataObj.cpp" between
basilisk-2021.12.14-source.tar.xz and basilisk-2022.01.27-source.tar.xz

About: Basilisk is an XUL-based web-browser demonstrating the Unified XUL Platform (UXP), featuring the well-known Firefox-style interface and operation ("development software").

nsDataObj.cpp  (basilisk-2021.12.14-source.tar.xz):nsDataObj.cpp  (basilisk-2022.01.27-source.tar.xz)
skipping to change at line 27 skipping to change at line 27
#include "IEnumFE.h" #include "IEnumFE.h"
#include "nsPrimitiveHelpers.h" #include "nsPrimitiveHelpers.h"
#include "nsXPIDLString.h" #include "nsXPIDLString.h"
#include "nsCRT.h" #include "nsCRT.h"
#include "nsPrintfCString.h" #include "nsPrintfCString.h"
#include "nsIStringBundle.h" #include "nsIStringBundle.h"
#include "nsEscape.h" #include "nsEscape.h"
#include "nsIURL.h" #include "nsIURL.h"
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "mozilla/Services.h" #include "mozilla/Services.h"
#include "nsProxyRelease.h"
#include "nsIOutputStream.h" #include "nsIOutputStream.h"
#include "nsXPCOMStrings.h" #include "nsXPCOMStrings.h"
#include "nscore.h" #include "nscore.h"
#include "nsDirectoryServiceDefs.h" #include "nsDirectoryServiceDefs.h"
#include "nsITimer.h" #include "nsITimer.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "nsIContentPolicy.h" #include "nsIContentPolicy.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsIPrincipal.h" #include "nsIPrincipal.h"
skipping to change at line 443 skipping to change at line 444
} }
return E_NOINTERFACE; return E_NOINTERFACE;
} }
//----------------------------------------------------- //-----------------------------------------------------
STDMETHODIMP_(ULONG) nsDataObj::AddRef() STDMETHODIMP_(ULONG) nsDataObj::AddRef()
{ {
++m_cRef; ++m_cRef;
NS_LOG_ADDREF(this, m_cRef, "nsDataObj", sizeof(*this)); NS_LOG_ADDREF(this, m_cRef, "nsDataObj", sizeof(*this));
// When the first reference is taken, hold our own internal reference.
if (m_cRef == 1) {
mKeepAlive = this;
}
return m_cRef; return m_cRef;
} }
namespace { namespace {
class RemoveTempFileHelper : public nsIObserver class RemoveTempFileHelper : public nsIObserver
{ {
public: public:
explicit RemoveTempFileHelper(nsIFile* aTempFile) explicit RemoveTempFileHelper(nsIFile* aTempFile)
: mTempFile(aTempFile) : mTempFile(aTempFile)
{ {
skipping to change at line 529 skipping to change at line 536
return NS_OK; return NS_OK;
} }
} // namespace } // namespace
//----------------------------------------------------- //-----------------------------------------------------
STDMETHODIMP_(ULONG) nsDataObj::Release() STDMETHODIMP_(ULONG) nsDataObj::Release()
{ {
--m_cRef; --m_cRef;
NS_LOG_RELEASE(this, m_cRef, "nsDataObj"); NS_LOG_RELEASE(this, m_cRef, "nsDataObj");
// If we hold the last reference, submit release of it to the main thread.
if (m_cRef == 1 && mKeepAlive) {
NS_ReleaseOnMainThread(mKeepAlive.forget(), true);
}
if (0 != m_cRef) if (0 != m_cRef)
return m_cRef; return m_cRef;
// We have released our last ref on this object and need to delete the // We have released our last ref on this object and need to delete the
// temp file. External app acting as drop target may still need to open the // temp file. External app acting as drop target may still need to open the
// temp file. Addref a timer so it can delay deleting file and destroying // temp file. Addref a timer so it can delay deleting file and destroying
// this object. // this object.
if (mCachedTempFile) { if (mCachedTempFile) {
RefPtr<RemoveTempFileHelper> helper = RefPtr<RemoveTempFileHelper> helper =
new RemoveTempFileHelper(mCachedTempFile); new RemoveTempFileHelper(mCachedTempFile);
mCachedTempFile = nullptr; mCachedTempFile = nullptr;
helper->Attach(); helper->Attach();
} }
// In case the destructor ever AddRef/Releases, ensure we don't delete twice
// or take mKeepAlive as another reference.
m_cRef = 1;
delete this; delete this;
return 0; return 0;
} }
//----------------------------------------------------- //-----------------------------------------------------
BOOL nsDataObj::FormatsMatch(const FORMATETC& source, const FORMATETC& target) c onst BOOL nsDataObj::FormatsMatch(const FORMATETC& source, const FORMATETC& target) c onst
{ {
if ((source.cfFormat == target.cfFormat) && if ((source.cfFormat == target.cfFormat) &&
(source.dwAspect & target.dwAspect) && (source.dwAspect & target.dwAspect) &&
skipping to change at line 568 skipping to change at line 585
} }
//----------------------------------------------------- //-----------------------------------------------------
// IDataObject methods // IDataObject methods
//----------------------------------------------------- //-----------------------------------------------------
STDMETHODIMP nsDataObj::GetData(LPFORMATETC aFormat, LPSTGMEDIUM pSTM) STDMETHODIMP nsDataObj::GetData(LPFORMATETC aFormat, LPSTGMEDIUM pSTM)
{ {
if (!mTransferable) if (!mTransferable)
return DV_E_FORMATETC; return DV_E_FORMATETC;
// Hold an extra reference in case we end up spinning the event loop.
RefPtr<nsDataObj> keepAliveDuringGetData(this);
uint32_t dfInx = 0; uint32_t dfInx = 0;
static CLIPFORMAT fileDescriptorFlavorA = ::RegisterClipboardFormat( CFSTR_FIL EDESCRIPTORA ); static CLIPFORMAT fileDescriptorFlavorA = ::RegisterClipboardFormat( CFSTR_FIL EDESCRIPTORA );
static CLIPFORMAT fileDescriptorFlavorW = ::RegisterClipboardFormat( CFSTR_FIL EDESCRIPTORW ); static CLIPFORMAT fileDescriptorFlavorW = ::RegisterClipboardFormat( CFSTR_FIL EDESCRIPTORW );
static CLIPFORMAT uniformResourceLocatorA = ::RegisterClipboardFormat( CFSTR_I NETURLA ); static CLIPFORMAT uniformResourceLocatorA = ::RegisterClipboardFormat( CFSTR_I NETURLA );
static CLIPFORMAT uniformResourceLocatorW = ::RegisterClipboardFormat( CFSTR_I NETURLW ); static CLIPFORMAT uniformResourceLocatorW = ::RegisterClipboardFormat( CFSTR_I NETURLW );
static CLIPFORMAT fileFlavor = ::RegisterClipboardFormat( CFSTR_FILECONTENTS ) ; static CLIPFORMAT fileFlavor = ::RegisterClipboardFormat( CFSTR_FILECONTENTS ) ;
static CLIPFORMAT PreferredDropEffect = ::RegisterClipboardFormat( CFSTR_PREFE RREDDROPEFFECT ); static CLIPFORMAT PreferredDropEffect = ::RegisterClipboardFormat( CFSTR_PREFE RREDDROPEFFECT );
// Arbitrary system formats are used for image feedback during drag // Arbitrary system formats are used for image feedback during drag
 End of changes. 5 change blocks. 
0 lines changed or deleted 20 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)