<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:darin&#64;apple.com" title="Darin Adler &lt;darin&#64;apple.com&gt;"> <span class="fn">Darin Adler</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [FreeType] ASSERTION FAILED: !lookupForWriting(Extractor::extract(entry)).second in FontCache::getVerticalData()"
   href="https://bugs.webkit.org/show_bug.cgi?id=157132">bug 157132</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Attachment #277613 Flags</td>
           <td>review?
           </td>
           <td>review+
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [FreeType] ASSERTION FAILED: !lookupForWriting(Extractor::extract(entry)).second in FontCache::getVerticalData()"
   href="https://bugs.webkit.org/show_bug.cgi?id=157132#c2">Comment # 2</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [FreeType] ASSERTION FAILED: !lookupForWriting(Extractor::extract(entry)).second in FontCache::getVerticalData()"
   href="https://bugs.webkit.org/show_bug.cgi?id=157132">bug 157132</a>
              from <span class="vcard"><a class="email" href="mailto:darin&#64;apple.com" title="Darin Adler &lt;darin&#64;apple.com&gt;"> <span class="fn">Darin Adler</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=277613&amp;action=diff" name="attach_277613" title="Patch">attachment 277613</a> <a href="attachment.cgi?id=277613&amp;action=edit" title="Patch">[details]</a></span>
Patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=277613&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=277613&amp;action=review</a>

<span class="quote">&gt; Source/WebCore/platform/graphics/FontCache.cpp:326
&gt; +        if (!data-&gt;isOpenType()) {
&gt; +            fontVerticalDataCache().remove(addResult.iterator);
&gt; +            return nullptr;
&gt; +        }</span >

This isn’t good, because it will not cache the negative result and so if OpenTypeVerticalData::create returns something that is not OpenType then it will call OpenTypeVerticalData::create again and again every time this function is called. And it will also add/remove an element to/from the hash map every time.

I think what we want instead is:

    if (!data-&gt;isOpenType())
        data = nullptr;

We will cache a nullptr and not call OpenTypeVerticalData::create again next time.

Separately, I also think it’s peculiar that OpenTypeVerticalData::create can create something that returns false to isOpenType. There’s some kind of naming mistake there. I would think, given its name, that function would return nullptr if the data is &quot;not OpenType&quot;.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>