<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - We should be able to clear search field recent searches based on time given"
   href="https://bugs.webkit.org/show_bug.cgi?id=150019#c10">Comment # 10</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - We should be able to clear search field recent searches based on time given"
   href="https://bugs.webkit.org/show_bug.cgi?id=150019">bug 150019</a>
              from <span class="vcard"><a class="email" href="mailto:andersca&#64;apple.com" title="Anders Carlsson &lt;andersca&#64;apple.com&gt;"> <span class="fn">Anders Carlsson</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=150019#c9">comment #9</a>)
<span class="quote">&gt; (In reply to <a href="show_bug.cgi?id=150019#c8">comment #8</a>)
&gt; &gt; Comment on <span class=""><a href="attachment.cgi?id=263184&amp;action=diff" name="attach_263184" title="Patch v2">attachment 263184</a> <a href="attachment.cgi?id=263184&amp;action=edit" title="Patch v2">[details]</a></span>
&gt; &gt; Patch v2
&gt; &gt; 
&gt; &gt; View in context:
&gt; &gt; <a href="https://bugs.webkit.org/attachment.cgi?id=263184&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=263184&amp;action=review</a>
&gt; &gt; 
&gt; &gt; &gt; Source/WebCore/platform/SearchPopupMenu.h:45
&gt; &gt; &gt; +WEBCORE_EXPORT static void removeRecentSearches(std::chrono::system_clock::time_point modifiedSince);
&gt; &gt; 
&gt; &gt; Indentation.
&gt; 
&gt; Will fix.
&gt; 
&gt; &gt; 
&gt; &gt; &gt; Source/WebCore/platform/cocoa/SearchPopupMenuCocoa.mm:135
&gt; &gt; &gt; +    RetainPtr&lt;NSDictionary&gt; emptyItemsDictionary = adoptNS([[NSDictionary alloc] init]);
&gt; &gt; &gt; +    RetainPtr&lt;NSDictionary&gt; emptyRecentSearchesDictionary = adoptNS([[NSDictionary alloc] initWithObjectsAndKeys:emptyItemsDictionary.get(), itemsKey, nil]);
&gt; &gt; 
&gt; &gt; Can use auto here.
&gt; 
&gt; What is the benefit of using auto? Is it more modern?</span >

It avoids having &quot;NSDictionary&quot; twice on one line.

<span class="quote">&gt; &gt; 
&gt; &gt; &gt; Source/WebCore/platform/cocoa/SearchPopupMenuCocoa.mm:205
&gt; &gt; &gt; +        [recentSearchesPlist writeToFile:searchFieldRecentSearchesPlistPath() atomically:NO];
&gt; &gt; 
&gt; &gt; Should be atomically:YES here.
&gt; 
&gt; Darin suggested I should use atomically:NO because of the performance cost.</span >

I think the performance cost is negligible and not corrupting data is better.


<span class="quote">&gt; &gt; &gt; Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp:1085
&gt; &gt; &gt; +    WebCore::SearchPopupMenu::removeRecentSearches(modifiedSince);
&gt; &gt; 
&gt; &gt; I don't think you should call into WebCore here. Why can't you just put the
&gt; &gt; contents of removeRecentSearches here?
&gt; 
&gt; Originally I had the contents of removeRecentSearches in WebsiteDataStore,
&gt; but Darin thinks we should not do
&gt; 
&gt; #if PLATFORM(COCOA)
&gt; #endif
&gt; 
&gt; in WebsiteDataStore and it would be better to move this logic to the
&gt; platform independent SearchPopupMenu file.</span >

Just call platformRemoveRecentSearches and implement it in WebsiteDataStoreCocoa.mm.</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>