WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
121801
Make WebHistory more type safe
https://bugs.webkit.org/show_bug.cgi?id=121801
Summary
Make WebHistory more type safe
Patrick R. Gansterer
Reported
2013-09-23 14:02:55 PDT
Make WebHistory more type safe
Attachments
Patch
(12.23 KB, patch)
2013-09-23 14:06 PDT
,
Patrick R. Gansterer
no flags
Details
Formatted Diff
Diff
Patch
(12.46 KB, patch)
2013-09-23 15:49 PDT
,
Patrick R. Gansterer
no flags
Details
Formatted Diff
Diff
Patch
(12.68 KB, patch)
2013-09-23 16:42 PDT
,
Patrick R. Gansterer
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Patrick R. Gansterer
Comment 1
2013-09-23 14:06:15 PDT
Created
attachment 212387
[details]
Patch
Brent Fulgham
Comment 2
2013-09-23 15:30:23 PDT
Comment on
attachment 212387
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=212387&action=review
I think the general idea of this change is good, but I don't agree with removing some of these methods, as they may be used by other WebKit clients.
> Source/WebKit/win/WebHistory.cpp:322 > + DateToEntriesMap::iterator found = m_entriesByDate.find(dateKey(calendarDate));
How about 'auto found = ...'?
> Source/WebKit/win/WebHistory.cpp:343 > + entriesForDate.at(i).copyRefTo(&items[i]);
Why use the "at(i)" syntax here? Is there some benefit over the square-bracket operator?
> Source/WebKit/win/WebHistory.h:-141 > - HRESULT insertItem(IWebHistoryItem* entry, DateKey);
We don't want to get rid of the insertItem method. I think "addItemToDateCaches" should be implemented in terms of insertItem.
> Source/WebKit/win/WebHistory.h:-143 > - bool findKey(DateKey*, CFAbsoluteTime forDay);
Why don't we have 'bool findKey(DateKey*, DATE)'? Why don't we want to keep this?
Patrick R. Gansterer
Comment 3
2013-09-23 15:39:28 PDT
Comment on
attachment 212387
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=212387&action=review
>> Source/WebKit/win/WebHistory.cpp:322 >> + DateToEntriesMap::iterator found = m_entriesByDate.find(dateKey(calendarDate)); > > How about 'auto found = ...'?
i copy&pasted it from other places, but i'm ok with the auto here too
>> Source/WebKit/win/WebHistory.cpp:343 >> + entriesForDate.at(i).copyRefTo(&items[i]); > > Why use the "at(i)" syntax here? Is there some benefit over the square-bracket operator?
no, i'll fix it
>> Source/WebKit/win/WebHistory.h:-141 >> - HRESULT insertItem(IWebHistoryItem* entry, DateKey); > > We don't want to get rid of the insertItem method. I think "addItemToDateCaches" should be implemented in terms of insertItem.
it's private, so there should be nobody able to use it
>> Source/WebKit/win/WebHistory.h:-143 >> - bool findKey(DateKey*, CFAbsoluteTime forDay); > > Why don't we have 'bool findKey(DateKey*, DATE)'? Why don't we want to keep this?
because we use the iterator now everywhere -> not needed
Brent Fulgham
Comment 4
2013-09-23 15:40:46 PDT
Comment on
attachment 212387
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=212387&action=review
>>> Source/WebKit/win/WebHistory.h:-141 >>> - HRESULT insertItem(IWebHistoryItem* entry, DateKey); >> >> We don't want to get rid of the insertItem method. I think "addItemToDateCaches" should be implemented in terms of insertItem. > > it's private, so there should be nobody able to use it
Ah -- I missed that. Okay -- never mind.
>>> Source/WebKit/win/WebHistory.h:-143 >>> - bool findKey(DateKey*, CFAbsoluteTime forDay); >> >> Why don't we have 'bool findKey(DateKey*, DATE)'? Why don't we want to keep this? > > because we use the iterator now everywhere -> not needed
Seems fine then.
Patrick R. Gansterer
Comment 5
2013-09-23 15:49:28 PDT
Created
attachment 212401
[details]
Patch
Brent Fulgham
Comment 6
2013-09-23 16:24:45 PDT
Comment on
attachment 212401
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=212401&action=review
Looks good. I did notice a couple of minor things that I missed last time. The only one I really care about is the naming of the last visited time (I think this should stay as "lastVisitedTime", not be written as "entryTime". You can fix this while landing, or you can upload a final patch and I will r+ that.
> Source/WebKit/win/WebHistory.cpp:590 > + DATE entryTime;
I just noticed that this should be "lastVisitedTime".
> Source/WebKit/win/WebHistory.cpp:595 > return E_FAIL;
This isn't your doing, but I wonder if attempting to remove an entry that is already not in the entry queue should be considered failure. Seems like a safe "success" case to me.
> Source/WebKit/win/WebHistory.cpp:601 > + if (entriesForDate.at(i) == entry)
We don't tend to use the "at()" method, but this is okay.
> Source/WebKit/win/WebHistory.cpp:625 > + Vector<COMPtr<IWebHistoryItem> > entries(1);
You don't need the space here "> >" can be ">>" under C++11. :-)
> Source/WebKit/win/WebHistory.cpp:664 > + if (FAILED(entriesForDate.at(mid)->lastVisitedTimeInterval(&itemTime)))
... another "at()".
> Source/WebKit/win/WebHistory.h:120 > + typedef HashMap<DateKey, Vector<COMPtr<IWebHistoryItem> > > DateToEntriesMap;
You can write this as "...IWebHistoryItem>>>"
Patrick R. Gansterer
Comment 7
2013-09-23 16:42:19 PDT
Created
attachment 212405
[details]
Patch
Brent Fulgham
Comment 8
2013-09-23 16:47:48 PDT
Comment on
attachment 212405
[details]
Patch r=me
WebKit Commit Bot
Comment 9
2013-09-24 00:32:26 PDT
Comment on
attachment 212405
[details]
Patch Clearing flags on attachment: 212405 Committed
r156321
: <
http://trac.webkit.org/changeset/156321
>
WebKit Commit Bot
Comment 10
2013-09-24 00:32:28 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug