Title: [220440] trunk/Source/WebCore
Revision
220440
Author
wei...@apple.com
Date
2017-08-08 20:24:31 -0700 (Tue, 08 Aug 2017)

Log Message

Address review feedback from https://bugs.webkit.org/show_bug.cgi?id=175246.

* bindings/js/DOMPromiseProxy.h:
* css/FontFaceSet.cpp:
* css/FontFaceSet.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (220439 => 220440)


--- trunk/Source/WebCore/ChangeLog	2017-08-09 03:18:25 UTC (rev 220439)
+++ trunk/Source/WebCore/ChangeLog	2017-08-09 03:24:31 UTC (rev 220440)
@@ -1,3 +1,11 @@
+2017-08-08  Sam Weinig  <s...@webkit.org>
+
+        Address review feedback from https://bugs.webkit.org/show_bug.cgi?id=175246.
+
+        * bindings/js/DOMPromiseProxy.h:
+        * css/FontFaceSet.cpp:
+        * css/FontFaceSet.h:
+
 2017-08-08  Devin Rousso  <drou...@apple.com>
 
         Web Inspector: Canvas: support editing WebGL shaders

Modified: trunk/Source/WebCore/bindings/js/DOMPromiseProxy.h (220439 => 220440)


--- trunk/Source/WebCore/bindings/js/DOMPromiseProxy.h	2017-08-09 03:18:25 UTC (rev 220439)
+++ trunk/Source/WebCore/bindings/js/DOMPromiseProxy.h	2017-08-09 03:24:31 UTC (rev 220440)
@@ -46,7 +46,7 @@
 
     JSC::JSValue promise(JSC::ExecState&, JSDOMGlobalObject&);
 
-    void reset();
+    void clear();
 
     bool isFulfilled() const;
 
@@ -70,7 +70,7 @@
 
     JSC::JSValue promise(JSC::ExecState&, JSDOMGlobalObject&);
 
-    void reset();
+    void clear();
 
     bool isFulfilled() const;
 
@@ -82,6 +82,10 @@
     Vector<Ref<DeferredPromise>, 1> m_deferredPromises;
 };
 
+// Instead of storing the value of the resolution directly, DOMPromiseProxyWithResolveCallback
+// allows the owner to specify callback to be called when the resolved value is needed. This is
+// needed to avoid reference cycles when the resolved value is the owner, such as is the case with
+// FontFace and FontFaceSet.
 template<typename IDLType>
 class DOMPromiseProxyWithResolveCallback {
 public:
@@ -99,7 +103,7 @@
 
     JSC::JSValue promise(JSC::ExecState&, JSDOMGlobalObject&);
 
-    void reset();
+    void clear();
 
     bool isFulfilled() const;
 
@@ -143,7 +147,7 @@
 }
 
 template<typename IDLType>
-inline void DOMPromiseProxy<IDLType>::reset()
+inline void DOMPromiseProxy<IDLType>::clear()
 {
     m_valueOrException = std::nullopt;
     m_deferredPromises.clear();
@@ -212,7 +216,7 @@
     return result;
 }
 
-inline void DOMPromiseProxy<IDLVoid>::reset()
+inline void DOMPromiseProxy<IDLVoid>::clear()
 {
     m_valueOrException = std::nullopt;
     m_deferredPromises.clear();
@@ -280,7 +284,7 @@
 }
 
 template<typename IDLType>
-inline void DOMPromiseProxyWithResolveCallback<IDLType>::reset()
+inline void DOMPromiseProxyWithResolveCallback<IDLType>::clear()
 {
     m_valueOrException = std::nullopt;
     m_deferredPromises.clear();

Modified: trunk/Source/WebCore/css/FontFaceSet.cpp (220439 => 220440)


--- trunk/Source/WebCore/css/FontFaceSet.cpp	2017-08-09 03:18:25 UTC (rev 220439)
+++ trunk/Source/WebCore/css/FontFaceSet.cpp	2017-08-09 03:24:31 UTC (rev 220440)
@@ -189,14 +189,12 @@
 void FontFaceSet::startedLoading()
 {
     // FIXME: Fire a "loading" event asynchronously.
-    m_isReady = false;
-    m_readyPromise.reset();
+    m_readyPromise.clear();
 }
 
 void FontFaceSet::completedLoading()
 {
     m_readyPromise.resolve(*this);
-    m_isReady = true;
 }
 
 void FontFaceSet::faceFinished(CSSFontFace& face, CSSFontFace::Status newStatus)

Modified: trunk/Source/WebCore/css/FontFaceSet.h (220439 => 220440)


--- trunk/Source/WebCore/css/FontFaceSet.h	2017-08-09 03:18:25 UTC (rev 220439)
+++ trunk/Source/WebCore/css/FontFaceSet.h	2017-08-09 03:24:31 UTC (rev 220440)
@@ -113,7 +113,6 @@
     Ref<CSSFontFaceSet> m_backing;
     HashMap<RefPtr<FontFace>, Vector<Ref<PendingPromise>>> m_pendingPromises;
     ReadyPromise m_readyPromise;
-    bool m_isReady { true };
 };
 
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to