[Webkit-unassigned] [Bug 25294] All WebKit/win classes should return COMPtrs from their static constructor members

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Apr 20 09:19:39 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=25294


darin at apple.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #29616|review?                     |review+
               Flag|                            |




------- Comment #3 from darin at apple.com  2009-04-20 09:19 PDT -------
(From update of attachment 29616)
>  HRESULT STDMETHODCALLTYPE MemoryStream::Clone( 
>      /* [out] */ IStream** ppstm)
>  {
> -    *ppstm = MemoryStream::createInstance(m_buffer);
> +    *ppstm = MemoryStream::createInstance(m_buffer).releaseRef();
> +    // FIXME: MSDN says we should be returning STG_E_INSUFFICIENT_MEMORY instead of E_OUTOFMEMORY here.
>      return (*ppstm) ? S_OK : E_OUTOFMEMORY;

Why not copyRefTo here?

> -    COMPtr<IStream> stream(AdoptCOM, MemoryStream::createInstance(buffer.release()));
> +    COMPtr<MemoryStream> stream = MemoryStream::createInstance(buffer.release());
>      m_view->didReceiveData(stream.get());

Would this read better without the local variable?

> -    COMPtr<MemoryStream> result(AdoptCOM, MemoryStream::createInstance(SharedBuffer::wrapCFData(historyData.get())));
> +    COMPtr<MemoryStream> result = MemoryStream::createInstance(SharedBuffer::wrapCFData(historyData.get()));
>      return result.copyRefTo(stream);

Would this read better without the local variable?

r=me


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list