RESOLVED FIXED 121467
[Windows] Clean up WinLauncher by using smart pointers
https://bugs.webkit.org/show_bug.cgi?id=121467
Summary [Windows] Clean up WinLauncher by using smart pointers
Brent Fulgham
Reported 2013-09-16 21:08:36 PDT
Get rid of a lot of ugly (and error-prone) boilerplate by switching to smart pointers for the various data types in the program.
Attachments
Patch (19.86 KB, patch)
2013-09-16 21:11 PDT, Brent Fulgham
andersca: review+
Brent Fulgham
Comment 1 2013-09-16 21:11:23 PDT
Anders Carlsson
Comment 2 2013-09-16 21:15:18 PDT
Comment on attachment 211861 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=211861&action=review > Tools/WinLauncher/WinLauncher.cpp:82 > +IWebInspectorPtr gInspector; > +IWebViewPtr gWebView; > +IWebViewPrivatePtr gWebViewPrivate; > +IWebPreferencesPtr gStandardPreferences; > +IWebPreferencesPrivatePtr gPrefsPrivate; I don't think these need to be smart pointers, and I think that making them smart pointers will cause global constructors. > Tools/WinLauncher/WinLauncher.cpp:88 > +std::vector<IWebHistoryItemPtr> gHistoryItems; Same thing here. Maybe you should just create an application class/struct? > Tools/WinLauncher/WinLauncher.cpp:537 > + static _bstr_t defaultHTML(TEXT("<p style=\"background-color: #00FF00\">Testing</p><img id=\"webkit logo\" src=\"http://webkit.org/images/icon-gold.png\" alt=\"Face\"><div style=\"border: solid blue; background: white;\" contenteditable=\"true\">div with blue border</div><ul><li>foo<li>bar<li>baz</ul>")); I don't think this needs to be static. > Tools/WinLauncher/WinLauncher.cpp:915 > + static _bstr_t methodBStr(TEXT("GET")); Same thing here.
Brent Fulgham
Comment 3 2013-09-16 21:21:30 PDT
Comment on attachment 211861 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=211861&action=review Thanks for looking this over. I'll make some more adjustments in a follow-up patch. >> Tools/WinLauncher/WinLauncher.cpp:82 >> +IWebPreferencesPrivatePtr gPrefsPrivate; > > I don't think these need to be smart pointers, and I think that making them smart pointers will cause global constructors. Hmm. I have some other cleanup to do; I'll revise this when I make those changes. >> Tools/WinLauncher/WinLauncher.cpp:88 >> +std::vector<IWebHistoryItemPtr> gHistoryItems; > > Same thing here. Maybe you should just create an application class/struct? Agreed. I'll do that next. >> Tools/WinLauncher/WinLauncher.cpp:537 >> + static _bstr_t defaultHTML(TEXT("<p style=\"background-color: #00FF00\">Testing</p><img id=\"webkit logo\" src=\"http://webkit.org/images/icon-gold.png\" alt=\"Face\"><div style=\"border: solid blue; background: white;\" contenteditable=\"true\">div with blue border</div><ul><li>foo<li>bar<li>baz</ul>")); > > I don't think this needs to be static. Done. >> Tools/WinLauncher/WinLauncher.cpp:915 >> + static _bstr_t methodBStr(TEXT("GET")); > > Same thing here. Done.
Brent Fulgham
Comment 4 2013-09-16 21:22:12 PDT
Note You need to log in before you can comment on or make changes to this bug.