<!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>[162812] trunk/Source/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/162812">162812</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2014-01-26 14:41:13 -0800 (Sun, 26 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Remove more history gunk.
* WebHistory.cpp:
(WebHistory::orderedLastVisitedDays):
(WebHistory::addItem):
(WebHistory::visitedURL):
(WebHistory::removeItemForURLString):
* WebHistory.h:
* WebHistoryItem.cpp:
(WebHistoryItem::initFromDictionaryRepresentation):
(WebHistoryItem::dictionaryRepresentation):
(WebHistoryItem::mergeAutoCompleteHints):
(WebHistoryItem::setLastVisitedTimeInterval):
(WebHistoryItem::initWithURLString):
(WebHistoryItem::lastVisitedTimeInterval):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitwinChangeLog">trunk/Source/WebKit/win/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitwinWebHistorycpp">trunk/Source/WebKit/win/WebHistory.cpp</a></li>
<li><a href="#trunkSourceWebKitwinWebHistoryh">trunk/Source/WebKit/win/WebHistory.h</a></li>
<li><a href="#trunkSourceWebKitwinWebHistoryItemcpp">trunk/Source/WebKit/win/WebHistoryItem.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitwinChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/ChangeLog (162811 => 162812)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/ChangeLog        2014-01-26 22:39:31 UTC (rev 162811)
+++ trunk/Source/WebKit/win/ChangeLog        2014-01-26 22:41:13 UTC (rev 162812)
</span><span class="lines">@@ -1,5 +1,23 @@
</span><span class="cx"> 2014-01-26 Anders Carlsson <andersca@apple.com>
</span><span class="cx">
</span><ins>+ Remove more history gunk.
+
+ * WebHistory.cpp:
+ (WebHistory::orderedLastVisitedDays):
+ (WebHistory::addItem):
+ (WebHistory::visitedURL):
+ (WebHistory::removeItemForURLString):
+ * WebHistory.h:
+ * WebHistoryItem.cpp:
+ (WebHistoryItem::initFromDictionaryRepresentation):
+ (WebHistoryItem::dictionaryRepresentation):
+ (WebHistoryItem::mergeAutoCompleteHints):
+ (WebHistoryItem::setLastVisitedTimeInterval):
+ (WebHistoryItem::initWithURLString):
+ (WebHistoryItem::lastVisitedTimeInterval):
+
+2014-01-26 Anders Carlsson <andersca@apple.com>
+
</ins><span class="cx"> Build fix.
</span><span class="cx">
</span><span class="cx"> * WebHistoryItem.cpp:
</span></span></pre></div>
<a id="trunkSourceWebKitwinWebHistorycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebHistory.cpp (162811 => 162812)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebHistory.cpp        2014-01-26 22:39:31 UTC (rev 162811)
+++ trunk/Source/WebKit/win/WebHistory.cpp        2014-01-26 22:41:13 UTC (rev 162812)
</span><span class="lines">@@ -331,34 +331,12 @@
</span><span class="cx"> return postNotification(kWebHistoryAllItemsRemovedNotification, userInfo.get());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// FIXME: This function should be removed from the IWebHistory interface.
</ins><span class="cx"> HRESULT STDMETHODCALLTYPE WebHistory::orderedLastVisitedDays(
</span><span class="cx"> /* [out][in] */ int* count,
</span><span class="cx"> /* [in] */ DATE* calendarDates)
</span><span class="cx"> {
</span><del>- int dateCount = m_entriesByDate.size();
- if (!calendarDates) {
- *count = dateCount;
- return S_OK;
- }
-
- if (*count < dateCount) {
- *count = dateCount;
- return E_FAIL;
- }
-
- *count = dateCount;
- if (!m_orderedLastVisitedDays) {
- m_orderedLastVisitedDays = std::make_unique<DATE[]>(dateCount);
- DateToEntriesMap::const_iterator::Keys end = m_entriesByDate.end().keys();
- int i = 0;
- for (DateToEntriesMap::const_iterator::Keys it = m_entriesByDate.begin().keys(); it != end; ++it, ++i)
- m_orderedLastVisitedDays[i] = *it / secondsPerDay;
- // Use std::greater to sort the days in descending order (i.e., most-recent first).
- sort(m_orderedLastVisitedDays.get(), m_orderedLastVisitedDays.get() + dateCount, greater<DATE>());
- }
-
- memcpy(calendarDates, m_orderedLastVisitedDays.get(), dateCount * sizeof(DATE));
- return S_OK;
</del><ins>+ return E_NOTIMPL;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> HRESULT STDMETHODCALLTYPE WebHistory::orderedItemsLastVisitedOnDay(
</span><span class="lines">@@ -529,10 +507,6 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- hr = addItemToDateCaches(entry);
- if (FAILED(hr))
- return hr;
-
</del><span class="cx"> m_entriesByURL.set(urlString, entry);
</span><span class="cx">
</span><span class="cx"> COMPtr<IPropertyBag> userInfo = createUserInfoFromHistoryItem(
</span><span class="lines">@@ -548,16 +522,7 @@
</span><span class="cx"> void WebHistory::visitedURL(const URL& url, const String& title, const String& httpMethod, bool wasFailure, bool increaseVisitCount)
</span><span class="cx"> {
</span><span class="cx"> IWebHistoryItem* entry = m_entriesByURL.get(url.string()).get();
</span><del>- if (entry) {
- COMPtr<IWebHistoryItemPrivate> entryPrivate(Query, entry);
- if (!entryPrivate)
- return;
-
- // Remove the item from date caches before changing its last visited date. Otherwise we might get duplicate entries
- // as seen in <rdar://problem/6570573>.
- removeItemFromDateCaches(entry);
- entryPrivate->visitedWithTitle(BString(title), increaseVisitCount);
- } else {
</del><ins>+ if (!entry) {
</ins><span class="cx"> COMPtr<WebHistoryItem> item(AdoptCOM, WebHistoryItem::createInstance());
</span><span class="cx"> if (!item)
</span><span class="cx"> return;
</span><span class="lines">@@ -573,13 +538,9 @@
</span><span class="cx"> if (FAILED(entry->initWithURLString(BString(url.string()), BString(title), lastVisited)))
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- item->recordInitialVisit();
-
</del><span class="cx"> m_entriesByURL.set(url.string(), entry);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- addItemToDateCaches(entry);
-
</del><span class="cx"> COMPtr<IWebHistoryItemPrivate> entryPrivate(Query, entry);
</span><span class="cx"> if (!entryPrivate)
</span><span class="cx"> return;
</span><span class="lines">@@ -614,9 +575,6 @@
</span><span class="cx"> if (it == m_entriesByURL.end())
</span><span class="cx"> return E_FAIL;
</span><span class="cx">
</span><del>- HRESULT hr = removeItemFromDateCaches(it->value.get());
- m_entriesByURL.remove(it);
-
</del><span class="cx"> if (!m_entriesByURL.size())
</span><span class="cx"> PageGroup::removeAllVisitedLinks();
</span><span class="cx">
</span><span class="lines">@@ -630,96 +588,6 @@
</span><span class="cx"> return m_entriesByURL.get(urlString);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-HRESULT WebHistory::removeItemFromDateCaches(IWebHistoryItem* entry)
-{
- DATE lastVisitedTime;
- entry->lastVisitedTimeInterval(&lastVisitedTime);
-
- auto found = m_entriesByDate.find(dateKey(lastVisitedTime));
- if (found == m_entriesByDate.end())
- return S_OK;
-
- auto& entriesForDate = found->value;
- int count = entriesForDate.size();
-
- for (int i = count - 1; i >= 0; --i) {
- if (entriesForDate[i] == entry)
- entriesForDate.remove(i);
- }
-
- // remove this date entirely if there are no other entries on it
- if (entriesForDate.isEmpty()) {
- m_entriesByDate.remove(found);
- // Clear m_orderedLastVisitedDays so it will be regenerated when next requested.
- m_orderedLastVisitedDays = nullptr;
- }
-
- return S_OK;
-}
-
-HRESULT WebHistory::addItemToDateCaches(IWebHistoryItem* entry)
-{
- ASSERT_ARG(entry, entry);
-
- DATE lastVisitedTime;
- entry->lastVisitedTimeInterval(&lastVisitedTime);
-
- DateKey key = dateKey(lastVisitedTime);
- auto found = m_entriesByDate.find(key);
- if (found == m_entriesByDate.end()) {
- Vector<COMPtr<IWebHistoryItem>> entries;
- entries.append(entry);
- m_entriesByDate.set(key, entries);
- // Clear m_orderedLastVisitedDays so it will be regenerated when next requested.
- m_orderedLastVisitedDays = nullptr;
- return S_OK;
- }
-
- auto& entriesForDate = found->value;
- size_t count = entriesForDate.size();
-
- // The entries for each day are stored in a sorted array with the most recent entry first
- // Check for the common cases of the entry being newer than all existing entries or the first entry of the day
- bool isNewerThanAllEntries = false;
- if (count) {
- DATE itemTime;
- isNewerThanAllEntries = SUCCEEDED(entriesForDate.first()->lastVisitedTimeInterval(&itemTime)) && itemTime < lastVisitedTime;
- }
- if (!count || isNewerThanAllEntries) {
- entriesForDate.insert(0, entry);
- return S_OK;
- }
-
- // .. or older than all existing entries
- bool isOlderThanAllEntries = false;
- if (count > 0) {
- DATE itemTime;
- isOlderThanAllEntries = SUCCEEDED(entriesForDate.last()->lastVisitedTimeInterval(&itemTime)) && itemTime >= lastVisitedTime;
- }
- if (isOlderThanAllEntries) {
- entriesForDate.append(entry);
- return S_OK;
- }
-
- unsigned low = 0;
- unsigned high = count;
- while (low < high) {
- unsigned mid = low + (high - low) / 2;
- DATE itemTime;
- if (FAILED(entriesForDate[mid]->lastVisitedTimeInterval(&itemTime)))
- return E_FAIL;
-
- if (itemTime >= lastVisitedTime)
- low = mid + 1;
- else
- high = mid;
- }
-
- // low is now the index of the first entry that is older than entryDate
- entriesForDate.insert(low, entry);
- return S_OK;
-}
-
</del><span class="cx"> void WebHistory::addVisitedLinksToPageGroup(PageGroup& group)
</span><span class="cx"> {
</span><span class="cx"> for (auto it = m_entriesByURL.begin(); it != m_entriesByURL.end(); ++it) {
</span></span></pre></div>
<a id="trunkSourceWebKitwinWebHistoryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebHistory.h (162811 => 162812)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebHistory.h        2014-01-26 22:39:31 UTC (rev 162811)
+++ trunk/Source/WebKit/win/WebHistory.h        2014-01-26 22:41:13 UTC (rev 162812)
</span><span class="lines">@@ -134,14 +134,10 @@
</span><span class="cx"> HRESULT removeItem(IWebHistoryItem* entry);
</span><span class="cx"> HRESULT addItem(IWebHistoryItem* entry, bool discardDuplicate, bool* added);
</span><span class="cx"> HRESULT removeItemForURLString(const WTF::String& urlString);
</span><del>- HRESULT addItemToDateCaches(IWebHistoryItem* entry);
- HRESULT removeItemFromDateCaches(IWebHistoryItem* entry);
</del><span class="cx"> BSTR getNotificationString(NotificationType notifyType);
</span><span class="cx">
</span><span class="cx"> ULONG m_refCount;
</span><span class="cx"> URLToEntriesMap m_entriesByURL;
</span><del>- DateToEntriesMap m_entriesByDate;
- std::unique_ptr<DATE[]> m_orderedLastVisitedDays;
</del><span class="cx"> COMPtr<WebPreferences> m_preferences;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitwinWebHistoryItemcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebHistoryItem.cpp (162811 => 162812)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebHistoryItem.cpp        2014-01-26 22:39:31 UTC (rev 162811)
+++ trunk/Source/WebKit/win/WebHistoryItem.cpp        2014-01-26 22:41:13 UTC (rev 162812)
</span><span class="lines">@@ -91,7 +91,6 @@
</span><span class="cx"> // IWebHistoryItemPrivate -----------------------------------------------------
</span><span class="cx">
</span><span class="cx"> static CFStringRef urlKey = CFSTR("");
</span><del>-static CFStringRef lastVisitedDateKey = CFSTR("lastVisitedDate");
</del><span class="cx"> static CFStringRef titleKey = CFSTR("title");
</span><span class="cx"> static CFStringRef visitCountKey = CFSTR("visitCount");
</span><span class="cx"> static CFStringRef lastVisitWasFailureKey = CFSTR("lastVisitWasFailure");
</span><span class="lines">@@ -107,11 +106,6 @@
</span><span class="cx"> if (urlStringRef && CFGetTypeID(urlStringRef) != CFStringGetTypeID())
</span><span class="cx"> return E_FAIL;
</span><span class="cx">
</span><del>- CFStringRef lastVisitedRef = (CFStringRef) CFDictionaryGetValue(dictionaryRef, lastVisitedDateKey);
- if (!lastVisitedRef || CFGetTypeID(lastVisitedRef) != CFStringGetTypeID())
- return E_FAIL;
- CFAbsoluteTime lastVisitedTime = CFStringGetDoubleValue(lastVisitedRef);
-
</del><span class="cx"> CFStringRef titleRef = (CFStringRef) CFDictionaryGetValue(dictionaryRef, titleKey);
</span><span class="cx"> if (titleRef && CFGetTypeID(titleRef) != CFStringGetTypeID())
</span><span class="cx"> return E_FAIL;
</span><span class="lines">@@ -174,7 +168,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> historyItemWrappers().remove(m_historyItem.get());
</span><del>- m_historyItem = HistoryItem::create(urlStringRef, titleRef, lastVisitedTime);
</del><ins>+ m_historyItem = HistoryItem::create(urlStringRef, titleRef);
</ins><span class="cx"> historyItemWrappers().set(m_historyItem.get(), this);
</span><span class="cx">
</span><span class="cx"> m_historyItem->setVisitCount(visitedCount);
</span><span class="lines">@@ -193,11 +187,6 @@
</span><span class="cx"> HRESULT STDMETHODCALLTYPE WebHistoryItem::dictionaryRepresentation(void** dictionary)
</span><span class="cx"> {
</span><span class="cx"> CFDictionaryRef* dictionaryRef = (CFDictionaryRef*) dictionary;
</span><del>- static CFStringRef lastVisitedFormat = CFSTR("%.1lf");
- CFStringRef lastVisitedStringRef =
- CFStringCreateWithFormat(0, 0, lastVisitedFormat, m_historyItem->lastVisitedTime());
- if (!lastVisitedStringRef)
- return E_FAIL;
</del><span class="cx">
</span><span class="cx"> int keyCount = 0;
</span><span class="cx"> CFTypeRef keys[9];
</span><span class="lines">@@ -296,24 +285,16 @@
</span><span class="cx"> return S_OK;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// FIXME: This function should be removed from the IWebHistoryItem interface.
</ins><span class="cx"> HRESULT STDMETHODCALLTYPE WebHistoryItem::mergeAutoCompleteHints(IWebHistoryItem* otherItem)
</span><span class="cx"> {
</span><del>- if (!otherItem)
- return E_FAIL;
-
- COMPtr<WebHistoryItem> otherWebHistoryItem(Query, otherItem);
- if (!otherWebHistoryItem)
- return E_FAIL;
-
- m_historyItem->mergeAutoCompleteHints(otherWebHistoryItem->historyItem());
-
- return S_OK;
</del><ins>+ return E_NOTIMPL;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+// FIXME: This function should be removed from the IWebHistoryItem interface.
</ins><span class="cx"> HRESULT STDMETHODCALLTYPE WebHistoryItem::setLastVisitedTimeInterval(DATE time)
</span><span class="cx"> {
</span><del>- m_historyItem->setLastVisitedTime(MarshallingHelpers::DATEToCFAbsoluteTime(time));
- return S_OK;
</del><ins>+ return E_NOTIMPL;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> HRESULT STDMETHODCALLTYPE WebHistoryItem::setTitle(BSTR title)
</span><span class="lines">@@ -539,7 +520,7 @@
</span><span class="cx"> /* [in] */ DATE lastVisited)
</span><span class="cx"> {
</span><span class="cx"> historyItemWrappers().remove(m_historyItem.get());
</span><del>- m_historyItem = HistoryItem::create(String(urlString, SysStringLen(urlString)), String(title, SysStringLen(title)), MarshallingHelpers::DATEToCFAbsoluteTime(lastVisited));
</del><ins>+ m_historyItem = HistoryItem::create(String(urlString, SysStringLen(urlString)), String(title, SysStringLen(title)), 0);
</ins><span class="cx"> historyItemWrappers().set(m_historyItem.get(), this);
</span><span class="cx">
</span><span class="cx"> return S_OK;
</span><span class="lines">@@ -578,14 +559,11 @@
</span><span class="cx"> return S_OK;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// FIXME: This function should be removed from the IWebHistoryItem interface.
</ins><span class="cx"> HRESULT STDMETHODCALLTYPE WebHistoryItem::lastVisitedTimeInterval(
</span><span class="cx"> /* [retval][out] */ DATE* lastVisited)
</span><span class="cx"> {
</span><del>- if (!lastVisited)
- return E_POINTER;
-
- *lastVisited = MarshallingHelpers::CFAbsoluteTimeToDATE(m_historyItem->lastVisitedTime());
- return S_OK;
</del><ins>+ return E_NOTIMPL;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> HRESULT STDMETHODCALLTYPE WebHistoryItem::setAlternateTitle(
</span></span></pre>
</div>
</div>
</body>
</html>