<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[50567] trunk/WebKit/win</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/50567">50567</a></dd>
<dt>Author</dt> <dd>aroben@apple.com</dd>
<dt>Date</dt> <dd>2009-11-05 10:14:35 -0800 (Thu, 05 Nov 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Make CFDictionaryPropertyBag::createInstance return a COMPtr

I also cleaned up CFDictionaryPropertyBag's class declaration a little
while I was at it.

Part of &lt;http://webkit.org/b/25294&gt; &lt;rdar://problem/6803127&gt; All
WebKit/win classes should return COMPtrs from their static constructor
members

Reviewed by Steve Falkenburg.

* CFDictionaryPropertyBag.cpp:
(CFDictionaryPropertyBag::CFDictionaryPropertyBag): Changed to
initialize m_refCount to 0. m_refCount gets increased to 1 by
createInstance.
(CFDictionaryPropertyBag::createInstance): Changed to return a COMPtr.

* CFDictionaryPropertyBag.h:
  - Updated copyright years
  - Fixed header guard to match current style
  - Replaced #include of CoreFoundation.h with forward-declaration of
    CFMutableDictionaryRef
  - Added #include of COMPtr.h
  - Fixed opening brace placement in class declaration
  - Made createInstance return a COMPtr
  - Made constructor/destructor private
  - Made QueryInterface and IPropertyBag functions private
  - Removed unnecessary parameter names and MIDL comments

* WebCache.cpp:
(WebCache::statistics): Updated for change to
CFDictionaryPropertyBag::createInstance. Now uses releaseRef to place
the IPropertyBag pointers into the s array.

* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::dispatchDidFailToStartPlugin):
* WebDatabaseManager.cpp:
(WebDatabaseManager::dispatchDidModifyDatabase):
* WebFrame.cpp:
(WebFrame::createJavaAppletWidget):
Updated for change to CFDictionaryPropertyBag::createInstance.

* WebHistory.cpp: Removed releaseUserInfo, which is no longer needed.
That function was also doing an unnecessary call to setDictionary(0).
(createUserInfoFromArray):
(createUserInfoFromHistoryItem):
Changed to return COMPtr.

(WebHistory::loadFromURL): Updated for change to
CFDictionaryPropertyBag::createInstance.

(WebHistory::removeAllItems): Updated for change to
CFDictionaryPropertyBag::createInstance, which fixed a leak! We had
forgotten to call releaseUserInfo here.

(WebHistory::removeItem):
(WebHistory::addItem):
(WebHistory::visitedURL):
* WebIconDatabase.cpp:
(postDidAddIconNotification):
Updated for change to CFDictionaryPropertyBag::createInstance.

* WebKitClassFactory.cpp:
(releaseRefFromCreateInstance): Added this overloaded function
template to abstract away the difference between createInstance
functions that return a ref'd pointer and createInstance functions
that return a COMPtr.
(WebKitClassFactory::CreateInstance): Changed to use
releaseRefFromCreateInstance.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebKitwinCFDictionaryPropertyBagcpp">trunk/WebKit/win/CFDictionaryPropertyBag.cpp</a></li>
<li><a href="#trunkWebKitwinCFDictionaryPropertyBagh">trunk/WebKit/win/CFDictionaryPropertyBag.h</a></li>
<li><a href="#trunkWebKitwinChangeLog">trunk/WebKit/win/ChangeLog</a></li>
<li><a href="#trunkWebKitwinWebCachecpp">trunk/WebKit/win/WebCache.cpp</a></li>
<li><a href="#trunkWebKitwinWebCoreSupportWebFrameLoaderClientcpp">trunk/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp</a></li>
<li><a href="#trunkWebKitwinWebDatabaseManagercpp">trunk/WebKit/win/WebDatabaseManager.cpp</a></li>
<li><a href="#trunkWebKitwinWebFramecpp">trunk/WebKit/win/WebFrame.cpp</a></li>
<li><a href="#trunkWebKitwinWebHistorycpp">trunk/WebKit/win/WebHistory.cpp</a></li>
<li><a href="#trunkWebKitwinWebIconDatabasecpp">trunk/WebKit/win/WebIconDatabase.cpp</a></li>
<li><a href="#trunkWebKitwinWebKitClassFactorycpp">trunk/WebKit/win/WebKitClassFactory.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebKitwinCFDictionaryPropertyBagcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/win/CFDictionaryPropertyBag.cpp (50566 => 50567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/win/CFDictionaryPropertyBag.cpp        2009-11-05 17:59:35 UTC (rev 50566)
+++ trunk/WebKit/win/CFDictionaryPropertyBag.cpp        2009-11-05 18:14:35 UTC (rev 50567)
</span><span class="lines">@@ -33,7 +33,7 @@
</span><span class="cx"> // CFDictionaryPropertyBag -----------------------------------------------
</span><span class="cx"> 
</span><span class="cx"> CFDictionaryPropertyBag::CFDictionaryPropertyBag()
</span><del>-: m_refCount(1)
</del><ins>+: m_refCount(0)
</ins><span class="cx"> {
</span><span class="cx">     gClassCount++;
</span><span class="cx">     gClassNameCount.add(&quot;CFDictionaryPropertyBag&quot;);
</span><span class="lines">@@ -45,10 +45,9 @@
</span><span class="cx">     gClassNameCount.remove(&quot;CFDictionaryPropertyBag&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-CFDictionaryPropertyBag* CFDictionaryPropertyBag::createInstance()
</del><ins>+COMPtr&lt;CFDictionaryPropertyBag&gt; CFDictionaryPropertyBag::createInstance()
</ins><span class="cx"> {
</span><del>-    CFDictionaryPropertyBag* instance = new CFDictionaryPropertyBag();
-    return instance;
</del><ins>+    return new CFDictionaryPropertyBag;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void CFDictionaryPropertyBag::setDictionary(CFMutableDictionaryRef dictionary)
</span></span></pre></div>
<a id="trunkWebKitwinCFDictionaryPropertyBagh"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/win/CFDictionaryPropertyBag.h (50566 => 50567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/win/CFDictionaryPropertyBag.h        2009-11-05 17:59:35 UTC (rev 50566)
+++ trunk/WebKit/win/CFDictionaryPropertyBag.h        2009-11-05 18:14:35 UTC (rev 50567)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2007 Apple Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc.  All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -23,42 +23,37 @@
</span><span class="cx">  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef CFDictionaryPropertyBag_H
-#define CFDictionaryPropertyBag_H
</del><ins>+#ifndef CFDictionaryPropertyBag_h
+#define CFDictionaryPropertyBag_h
</ins><span class="cx"> 
</span><del>-#include &lt;CoreFoundation/CoreFoundation.h&gt;
</del><ins>+#include &lt;WebCore/COMPtr.h&gt;
</ins><span class="cx"> #include &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> 
</span><del>-class CFDictionaryPropertyBag : public IPropertyBag
-{
-public:
-    static CFDictionaryPropertyBag* createInstance();
-protected:
-    CFDictionaryPropertyBag();
-    ~CFDictionaryPropertyBag();
</del><ins>+typedef struct __CFDictionary* CFMutableDictionaryRef;
</ins><span class="cx"> 
</span><ins>+class CFDictionaryPropertyBag : public IPropertyBag {
</ins><span class="cx"> public:
</span><ins>+    static COMPtr&lt;CFDictionaryPropertyBag&gt; createInstance();
+
</ins><span class="cx">     // IUnknown
</span><del>-    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
-    virtual ULONG STDMETHODCALLTYPE AddRef(void);
-    virtual ULONG STDMETHODCALLTYPE Release(void);
</del><ins>+    virtual ULONG STDMETHODCALLTYPE AddRef();
+    virtual ULONG STDMETHODCALLTYPE Release();
</ins><span class="cx"> 
</span><del>-    // IPropertyBag
-    virtual /* [local] */ HRESULT STDMETHODCALLTYPE Read( 
-        /* [in] */ LPCOLESTR pszPropName,
-        /* [out][in] */ VARIANT *pVar,
-        /* [in] */ IErrorLog *pErrorLog);
-        
-    virtual HRESULT STDMETHODCALLTYPE Write( 
-        /* [in] */ LPCOLESTR pszPropName,
-        /* [in] */ VARIANT *pVar);
-
</del><span class="cx">     void setDictionary(CFMutableDictionaryRef dictionary);
</span><span class="cx">     CFMutableDictionaryRef dictionary() const;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><ins>+    CFDictionaryPropertyBag();
+    ~CFDictionaryPropertyBag();
+
+    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void** ppvObject);
+
+    // IPropertyBag
+    virtual HRESULT STDMETHODCALLTYPE Read(LPCOLESTR pszPropName, VARIANT*, IErrorLog*);
+    virtual HRESULT STDMETHODCALLTYPE Write(LPCOLESTR pszPropName, VARIANT*);
+
</ins><span class="cx">     RetainPtr&lt;CFMutableDictionaryRef&gt; m_dictionary;
</span><span class="cx">     ULONG m_refCount;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif
</del><span class="cx">\ No newline at end of file
</span><ins>+#endif // CFDictionaryPropertyBag_h
</ins></span></pre></div>
<a id="trunkWebKitwinChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/win/ChangeLog (50566 => 50567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/win/ChangeLog        2009-11-05 17:59:35 UTC (rev 50566)
+++ trunk/WebKit/win/ChangeLog        2009-11-05 18:14:35 UTC (rev 50567)
</span><span class="lines">@@ -1,3 +1,75 @@
</span><ins>+2009-11-05  Adam Roben  &lt;aroben@apple.com&gt;
+
+        Make CFDictionaryPropertyBag::createInstance return a COMPtr
+
+        I also cleaned up CFDictionaryPropertyBag's class declaration a little
+        while I was at it.
+
+        Part of &lt;http://webkit.org/b/25294&gt; &lt;rdar://problem/6803127&gt; All
+        WebKit/win classes should return COMPtrs from their static constructor
+        members
+
+        Reviewed by Steve Falkenburg.
+
+        * CFDictionaryPropertyBag.cpp:
+        (CFDictionaryPropertyBag::CFDictionaryPropertyBag): Changed to
+        initialize m_refCount to 0. m_refCount gets increased to 1 by
+        createInstance.
+        (CFDictionaryPropertyBag::createInstance): Changed to return a COMPtr.
+
+        * CFDictionaryPropertyBag.h:
+          - Updated copyright years
+          - Fixed header guard to match current style
+          - Replaced #include of CoreFoundation.h with forward-declaration of
+            CFMutableDictionaryRef
+          - Added #include of COMPtr.h
+          - Fixed opening brace placement in class declaration
+          - Made createInstance return a COMPtr
+          - Made constructor/destructor private
+          - Made QueryInterface and IPropertyBag functions private
+          - Removed unnecessary parameter names and MIDL comments
+
+        * WebCache.cpp:
+        (WebCache::statistics): Updated for change to
+        CFDictionaryPropertyBag::createInstance. Now uses releaseRef to place
+        the IPropertyBag pointers into the s array.
+
+        * WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebFrameLoaderClient::dispatchDidFailToStartPlugin):
+        * WebDatabaseManager.cpp:
+        (WebDatabaseManager::dispatchDidModifyDatabase):
+        * WebFrame.cpp:
+        (WebFrame::createJavaAppletWidget):
+        Updated for change to CFDictionaryPropertyBag::createInstance.
+
+        * WebHistory.cpp: Removed releaseUserInfo, which is no longer needed.
+        That function was also doing an unnecessary call to setDictionary(0).
+        (createUserInfoFromArray):
+        (createUserInfoFromHistoryItem):
+        Changed to return COMPtr.
+
+        (WebHistory::loadFromURL): Updated for change to
+        CFDictionaryPropertyBag::createInstance.
+
+        (WebHistory::removeAllItems): Updated for change to
+        CFDictionaryPropertyBag::createInstance, which fixed a leak! We had
+        forgotten to call releaseUserInfo here.
+
+        (WebHistory::removeItem):
+        (WebHistory::addItem):
+        (WebHistory::visitedURL):
+        * WebIconDatabase.cpp:
+        (postDidAddIconNotification):
+        Updated for change to CFDictionaryPropertyBag::createInstance.
+
+        * WebKitClassFactory.cpp:
+        (releaseRefFromCreateInstance): Added this overloaded function
+        template to abstract away the difference between createInstance
+        functions that return a ref'd pointer and createInstance functions
+        that return a COMPtr.
+        (WebKitClassFactory::CreateInstance): Changed to use
+        releaseRefFromCreateInstance.
+
</ins><span class="cx"> 2009-11-03  Brian Weinstein  &lt;bweinstein@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Steve Falkenburg.
</span></span></pre></div>
<a id="trunkWebKitwinWebCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/win/WebCache.cpp (50566 => 50567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/win/WebCache.cpp        2009-11-05 17:59:35 UTC (rev 50566)
+++ trunk/WebKit/win/WebCache.cpp        2009-11-05 18:14:35 UTC (rev 50567)
</span><span class="lines">@@ -129,9 +129,9 @@
</span><span class="cx">     value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &amp;stat.scripts.count));
</span><span class="cx">     CFDictionaryAddValue(dictionary.get(), scriptsKey, value.get());
</span><span class="cx"> 
</span><del>-    CFDictionaryPropertyBag* propBag = CFDictionaryPropertyBag::createInstance();
</del><ins>+    COMPtr&lt;CFDictionaryPropertyBag&gt; propBag = CFDictionaryPropertyBag::createInstance();
</ins><span class="cx">     propBag-&gt;setDictionary(dictionary.get());
</span><del>-    s[0] = propBag;
</del><ins>+    s[0] = propBag.releaseRef();
</ins><span class="cx"> 
</span><span class="cx">     dictionary.adoptCF(CFDictionaryCreateMutable(0, 0, &amp;kCFTypeDictionaryKeyCallBacks, &amp;kCFTypeDictionaryValueCallBacks));
</span><span class="cx"> 
</span><span class="lines">@@ -153,7 +153,7 @@
</span><span class="cx"> 
</span><span class="cx">     propBag = CFDictionaryPropertyBag::createInstance();
</span><span class="cx">     propBag-&gt;setDictionary(dictionary.get());
</span><del>-    s[1] = propBag;
</del><ins>+    s[1] = propBag.releaseRef();
</ins><span class="cx"> 
</span><span class="cx">     dictionary.adoptCF(CFDictionaryCreateMutable(0, 0, &amp;kCFTypeDictionaryKeyCallBacks, &amp;kCFTypeDictionaryValueCallBacks));
</span><span class="cx"> 
</span><span class="lines">@@ -175,7 +175,7 @@
</span><span class="cx"> 
</span><span class="cx">     propBag = CFDictionaryPropertyBag::createInstance();
</span><span class="cx">     propBag-&gt;setDictionary(dictionary.get());
</span><del>-    s[2] = propBag;
</del><ins>+    s[2] = propBag.releaseRef();
</ins><span class="cx"> 
</span><span class="cx">     dictionary.adoptCF(CFDictionaryCreateMutable(0, 0, &amp;kCFTypeDictionaryKeyCallBacks, &amp;kCFTypeDictionaryValueCallBacks));
</span><span class="cx"> 
</span><span class="lines">@@ -197,7 +197,7 @@
</span><span class="cx"> 
</span><span class="cx">     propBag = CFDictionaryPropertyBag::createInstance();
</span><span class="cx">     propBag-&gt;setDictionary(dictionary.get());
</span><del>-    s[3] = propBag;
</del><ins>+    s[3] = propBag.releaseRef();
</ins><span class="cx"> 
</span><span class="cx">     return S_OK;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkWebKitwinWebCoreSupportWebFrameLoaderClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp (50566 => 50567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp        2009-11-05 17:59:35 UTC (rev 50566)
+++ trunk/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp        2009-11-05 18:14:35 UTC (rev 50567)
</span><span class="lines">@@ -747,7 +747,7 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    COMPtr&lt;CFDictionaryPropertyBag&gt; userInfoBag(AdoptCOM, CFDictionaryPropertyBag::createInstance());
</del><ins>+    COMPtr&lt;CFDictionaryPropertyBag&gt; userInfoBag = CFDictionaryPropertyBag::createInstance();
</ins><span class="cx">     userInfoBag-&gt;setDictionary(userInfo.get());
</span><span class="cx">  
</span><span class="cx">     int errorCode = 0;
</span></span></pre></div>
<a id="trunkWebKitwinWebDatabaseManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/win/WebDatabaseManager.cpp (50566 => 50567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/win/WebDatabaseManager.cpp        2009-11-05 17:59:35 UTC (rev 50566)
+++ trunk/WebKit/win/WebDatabaseManager.cpp        2009-11-05 18:14:35 UTC (rev 50567)
</span><span class="lines">@@ -364,7 +364,7 @@
</span><span class="cx">     RetainPtr&lt;CFStringRef&gt; str(AdoptCF, databaseName.createCFString());
</span><span class="cx">     CFDictionarySetValue(userInfo.get(), databaseNameKey, str.get());
</span><span class="cx"> 
</span><del>-    COMPtr&lt;CFDictionaryPropertyBag&gt; userInfoBag(AdoptCOM, CFDictionaryPropertyBag::createInstance());
</del><ins>+    COMPtr&lt;CFDictionaryPropertyBag&gt; userInfoBag = CFDictionaryPropertyBag::createInstance();
</ins><span class="cx">     userInfoBag-&gt;setDictionary(userInfo.get());
</span><span class="cx"> 
</span><span class="cx">     notifyCenter-&gt;postNotificationName(databaseDidModifyOriginName, securityOrigin.get(), userInfoBag.get());
</span></span></pre></div>
<a id="trunkWebKitwinWebFramecpp"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/win/WebFrame.cpp (50566 => 50567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/win/WebFrame.cpp        2009-11-05 17:59:35 UTC (rev 50566)
+++ trunk/WebKit/win/WebFrame.cpp        2009-11-05 18:14:35 UTC (rev 50567)
</span><span class="lines">@@ -1691,7 +1691,7 @@
</span><span class="cx">     if (FAILED(d-&gt;webView-&gt;resourceLoadDelegate(&amp;resourceLoadDelegate)))
</span><span class="cx">         return pluginView;
</span><span class="cx"> 
</span><del>-    COMPtr&lt;CFDictionaryPropertyBag&gt; userInfoBag(AdoptCOM, CFDictionaryPropertyBag::createInstance());
</del><ins>+    COMPtr&lt;CFDictionaryPropertyBag&gt; userInfoBag = CFDictionaryPropertyBag::createInstance();
</ins><span class="cx"> 
</span><span class="cx">     ResourceError resourceError(String(WebKitErrorDomain), WebKitErrorJavaUnavailable, String(), String());
</span><span class="cx">     COMPtr&lt;IWebError&gt; error(AdoptCOM, WebError::createInstance(resourceError, userInfoBag.get()));
</span></span></pre></div>
<a id="trunkWebKitwinWebHistorycpp"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/win/WebHistory.cpp (50566 => 50567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/win/WebHistory.cpp        2009-11-05 17:59:35 UTC (rev 50566)
+++ trunk/WebKit/win/WebHistory.cpp        2009-11-05 18:14:35 UTC (rev 50567)
</span><span class="lines">@@ -96,7 +96,7 @@
</span><span class="cx">     return (diff &lt; .000001 &amp;&amp; diff &gt; -.000001);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static CFDictionaryPropertyBag* createUserInfoFromArray(BSTR notificationStr, CFArrayRef arrayItem)
</del><ins>+static COMPtr&lt;CFDictionaryPropertyBag&gt; createUserInfoFromArray(BSTR notificationStr, CFArrayRef arrayItem)
</ins><span class="cx"> {
</span><span class="cx">     RetainPtr&lt;CFMutableDictionaryRef&gt; dictionary(AdoptCF, 
</span><span class="cx">         CFDictionaryCreateMutable(0, 0, &amp;kCFTypeDictionaryKeyCallBacks, &amp;kCFTypeDictionaryValueCallBacks));
</span><span class="lines">@@ -104,28 +104,19 @@
</span><span class="cx">     RetainPtr&lt;CFStringRef&gt; key(AdoptCF, MarshallingHelpers::BSTRToCFStringRef(notificationStr));
</span><span class="cx">     CFDictionaryAddValue(dictionary.get(), key.get(), arrayItem);
</span><span class="cx"> 
</span><del>-    CFDictionaryPropertyBag* result = CFDictionaryPropertyBag::createInstance();
</del><ins>+    COMPtr&lt;CFDictionaryPropertyBag&gt; result = CFDictionaryPropertyBag::createInstance();
</ins><span class="cx">     result-&gt;setDictionary(dictionary.get());
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static CFDictionaryPropertyBag* createUserInfoFromHistoryItem(BSTR notificationStr, IWebHistoryItem* item)
</del><ins>+static COMPtr&lt;CFDictionaryPropertyBag&gt; createUserInfoFromHistoryItem(BSTR notificationStr, IWebHistoryItem* item)
</ins><span class="cx"> {
</span><span class="cx">     // reference counting of item added to the array is managed by the CFArray value callbacks
</span><span class="cx">     RetainPtr&lt;CFArrayRef&gt; itemList(AdoptCF, CFArrayCreate(0, (const void**) &amp;item, 1, &amp;MarshallingHelpers::kIUnknownArrayCallBacks));
</span><del>-    CFDictionaryPropertyBag* info = createUserInfoFromArray(notificationStr, itemList.get());
</del><ins>+    COMPtr&lt;CFDictionaryPropertyBag&gt; info = createUserInfoFromArray(notificationStr, itemList.get());
</ins><span class="cx">     return info;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void releaseUserInfo(CFDictionaryPropertyBag* userInfo)
-{
-    // free the dictionary
-    userInfo-&gt;setDictionary(0);
-    int result = userInfo-&gt;Release();
-    (void)result;
-    ASSERT(result == 0);   // make sure no one else holds a reference to the userInfo.
-}
-
</del><span class="cx"> // WebHistory -----------------------------------------------------------------
</span><span class="cx"> 
</span><span class="cx"> WebHistory::WebHistory()
</span><span class="lines">@@ -264,9 +255,8 @@
</span><span class="cx">         goto exit;
</span><span class="cx"> 
</span><span class="cx">     if (CFArrayGetCount(discardedItems.get()) &gt; 0) {
</span><del>-        CFDictionaryPropertyBag* userInfo = createUserInfoFromArray(getNotificationString(kWebHistoryItemsDiscardedWhileLoadingNotification), discardedItems.get());
-        hr = postNotification(kWebHistoryItemsDiscardedWhileLoadingNotification, userInfo);
-        releaseUserInfo(userInfo);
</del><ins>+        COMPtr&lt;CFDictionaryPropertyBag&gt; userInfo = createUserInfoFromArray(getNotificationString(kWebHistoryItemsDiscardedWhileLoadingNotification), discardedItems.get());
+        hr = postNotification(kWebHistoryItemsDiscardedWhileLoadingNotification, userInfo.get());
</ins><span class="cx">         if (FAILED(hr))
</span><span class="cx">             goto exit;
</span><span class="cx">     }
</span><span class="lines">@@ -465,8 +455,8 @@
</span><span class="cx"> 
</span><span class="cx">     PageGroup::removeAllVisitedLinks();
</span><span class="cx"> 
</span><del>-    CFDictionaryPropertyBag* userInfo = createUserInfoFromArray(getNotificationString(kWebHistoryAllItemsRemovedNotification), allItems.get());
-    return postNotification(kWebHistoryAllItemsRemovedNotification, userInfo);
</del><ins>+    COMPtr&lt;CFDictionaryPropertyBag&gt; userInfo = createUserInfoFromArray(getNotificationString(kWebHistoryAllItemsRemovedNotification), allItems.get());
+    return postNotification(kWebHistoryAllItemsRemovedNotification, userInfo.get());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> HRESULT STDMETHODCALLTYPE WebHistory::orderedLastVisitedDays( 
</span><span class="lines">@@ -644,10 +634,9 @@
</span><span class="cx">     if (FAILED(hr))
</span><span class="cx">         return hr;
</span><span class="cx"> 
</span><del>-    CFDictionaryPropertyBag* userInfo = createUserInfoFromHistoryItem(
</del><ins>+    COMPtr&lt;CFDictionaryPropertyBag&gt; userInfo = createUserInfoFromHistoryItem(
</ins><span class="cx">         getNotificationString(kWebHistoryItemsRemovedNotification), entry);
</span><del>-    hr = postNotification(kWebHistoryItemsRemovedNotification, userInfo);
-    releaseUserInfo(userInfo);
</del><ins>+    hr = postNotification(kWebHistoryItemsRemovedNotification, userInfo.get());
</ins><span class="cx"> 
</span><span class="cx">     return hr;
</span><span class="cx"> }
</span><span class="lines">@@ -695,10 +684,9 @@
</span><span class="cx"> 
</span><span class="cx">     CFDictionarySetValue(m_entriesByURL.get(), urlString.get(), entry);
</span><span class="cx"> 
</span><del>-    CFDictionaryPropertyBag* userInfo = createUserInfoFromHistoryItem(
</del><ins>+    COMPtr&lt;CFDictionaryPropertyBag&gt; userInfo = createUserInfoFromHistoryItem(
</ins><span class="cx">         getNotificationString(kWebHistoryItemsAddedNotification), entry);
</span><del>-    hr = postNotification(kWebHistoryItemsAddedNotification, userInfo);
-    releaseUserInfo(userInfo);
</del><ins>+    hr = postNotification(kWebHistoryItemsAddedNotification, userInfo.get());
</ins><span class="cx"> 
</span><span class="cx">     if (added)
</span><span class="cx">         *added = true;
</span><span class="lines">@@ -754,10 +742,9 @@
</span><span class="cx">     COMPtr&lt;WebHistoryItem&gt; item(Query, entry);
</span><span class="cx">     item-&gt;historyItem()-&gt;setRedirectURLs(0);
</span><span class="cx"> 
</span><del>-    CFDictionaryPropertyBag* userInfo = createUserInfoFromHistoryItem(
</del><ins>+    COMPtr&lt;CFDictionaryPropertyBag&gt; userInfo = createUserInfoFromHistoryItem(
</ins><span class="cx">         getNotificationString(kWebHistoryItemsAddedNotification), entry);
</span><del>-    postNotification(kWebHistoryItemsAddedNotification, userInfo);
-    releaseUserInfo(userInfo);
</del><ins>+    postNotification(kWebHistoryItemsAddedNotification, userInfo.get());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> HRESULT WebHistory::itemForURLString(
</span></span></pre></div>
<a id="trunkWebKitwinWebIconDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/win/WebIconDatabase.cpp (50566 => 50567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/win/WebIconDatabase.cpp        2009-11-05 17:59:35 UTC (rev 50566)
+++ trunk/WebKit/win/WebIconDatabase.cpp        2009-11-05 18:14:35 UTC (rev 50567)
</span><span class="lines">@@ -358,7 +358,7 @@
</span><span class="cx">     RetainPtr&lt;CFStringRef&gt; url(AdoptCF, pageURL.createCFString());
</span><span class="cx">     CFDictionaryAddValue(dictionary.get(), WebIconDatabase::iconDatabaseNotificationUserInfoURLKey(), url.get());
</span><span class="cx"> 
</span><del>-    COMPtr&lt;CFDictionaryPropertyBag&gt; userInfo(AdoptCOM, CFDictionaryPropertyBag::createInstance());
</del><ins>+    COMPtr&lt;CFDictionaryPropertyBag&gt; userInfo = CFDictionaryPropertyBag::createInstance();
</ins><span class="cx">     userInfo-&gt;setDictionary(dictionary.get());
</span><span class="cx"> 
</span><span class="cx">     IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
</span></span></pre></div>
<a id="trunkWebKitwinWebKitClassFactorycpp"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/win/WebKitClassFactory.cpp (50566 => 50567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/win/WebKitClassFactory.cpp        2009-11-05 17:59:35 UTC (rev 50566)
+++ trunk/WebKit/win/WebKitClassFactory.cpp        2009-11-05 18:14:35 UTC (rev 50567)
</span><span class="lines">@@ -126,6 +126,19 @@
</span><span class="cx">     return newRef;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+// FIXME: Remove these functions once all createInstance() functions return COMPtr.
+template &lt;typename T&gt;
+static T* releaseRefFromCreateInstance(T* object)
+{
+    return object;
+}
+
+template &lt;typename T&gt;
+static T* releaseRefFromCreateInstance(COMPtr&lt;T&gt; object)
+{
+    return object.releaseRef();
+}
+
</ins><span class="cx"> // IClassFactory --------------------------------------------------------------
</span><span class="cx"> 
</span><span class="cx"> HRESULT STDMETHODCALLTYPE WebKitClassFactory::CreateInstance(IUnknown* pUnkOuter, REFIID riid, void** ppvObject)
</span><span class="lines">@@ -138,7 +151,7 @@
</span><span class="cx"> 
</span><span class="cx"> #define INITIALIZE_IF_CLASS(cls) \
</span><span class="cx">     if (IsEqualGUID(m_targetClass, CLSID_##cls)) \
</span><del>-        unknown = static_cast&lt;I##cls*&gt;(cls::createInstance()); \
</del><ins>+        unknown = static_cast&lt;I##cls*&gt;(releaseRefFromCreateInstance(cls::createInstance())); \
</ins><span class="cx">     else \
</span><span class="cx">     // end of macro
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>