RESOLVED FIXED 173629
[Curl] Separate global curl settings from ResourceHandleManager as CurlContext class
https://bugs.webkit.org/show_bug.cgi?id=173629
Summary [Curl] Separate global curl settings from ResourceHandleManager as CurlContex...
Basuke Suzuki
Reported 2017-06-20 17:37:11 PDT
ResourceHandleManager is hard to refactor because it contains many configurations. For easy maintenance, those information should be managed by separate class.
Attachments
PATCH (40.02 KB, patch)
2017-06-24 22:18 PDT, Basuke Suzuki
no flags
Fix style (40.29 KB, patch)
2017-06-24 22:44 PDT, Basuke Suzuki
no flags
PATCH2 (40.33 KB, patch)
2017-06-26 12:22 PDT, Basuke Suzuki
no flags
PATH with fix for thread change (40.10 KB, patch)
2017-06-26 15:05 PDT, Basuke Suzuki
achristensen: review-
PATCH with reviewed advices (40.05 KB, patch)
2017-06-28 19:43 PDT, Basuke Suzuki
no flags
Fix style again (40.05 KB, patch)
2017-06-28 19:52 PDT, Basuke Suzuki
no flags
Basuke Suzuki
Comment 1 2017-06-24 22:18:28 PDT
Created attachment 313793 [details] PATCH Extract global configurations from ResourceHandleManager.
Build Bot
Comment 2 2017-06-24 22:19:51 PDT
Attachment 313793 [details] did not pass style-queue: ERROR: Source/WebCore/platform/network/curl/CurlJobManager.cpp:30: Found other header before a header this file implements. Should be: config.h, primary header, blank line, and then alphabetically sorted. [build/include_order] [4] ERROR: Source/WebCore/platform/network/curl/CurlJobManager.cpp:31: Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted. [build/include_order] [4] ERROR: Source/WebCore/platform/network/curl/CurlJobManager.h:38: Bad include order. Mixing system and custom headers. [build/include_order] [4] ERROR: Source/WebCore/platform/network/curl/ResourceHandleManager.cpp:969: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebCore/platform/network/curl/CurlContext.cpp:173: Extra space between CurlProxyType and type [whitespace/declaration] [3] ERROR: Source/WebCore/platform/network/curl/CurlContext.cpp:182: An else should appear on the same line as the preceding } [whitespace/newline] [4] ERROR: Source/WebCore/platform/network/curl/CurlDownload.cpp:30: Found other header before a header this file implements. Should be: config.h, primary header, blank line, and then alphabetically sorted. [build/include_order] [4] ERROR: Source/WebCore/platform/network/curl/CurlContext.h:39: Bad include order. Mixing system and custom headers. [build/include_order] [4] Total errors found: 8 in 10 files If any of these errors are false positives, please file a bug against check-webkit-style.
Basuke Suzuki
Comment 3 2017-06-24 22:44:16 PDT
Created attachment 313794 [details] Fix style
Basuke Suzuki
Comment 4 2017-06-25 23:06:59 PDT
Comment on attachment 313794 [details] Fix style A bug was found. Obsoleted.
Basuke Suzuki
Comment 5 2017-06-26 12:22:36 PDT
Created attachment 313861 [details] PATCH2 Fixed a bug
Basuke Suzuki
Comment 6 2017-06-26 15:05:39 PDT
Created attachment 313871 [details] PATH with fix for thread change Adopt the changes for Thread::create [WTF] Drop Thread::create(obsolete things) API since we can use lambda https://bugs.webkit.org/show_bug.cgi?id=173825
Konstantin Tokarev
Comment 7 2017-06-27 11:05:29 PDT
Comment on attachment 313871 [details] PATH with fix for thread change View in context: https://bugs.webkit.org/attachment.cgi?id=313871&action=review > Source/WebCore/platform/network/curl/CurlContext.h:35 > +#if PLATFORM(WIN) OS(WINDOWS) > Source/WebCore/platform/network/curl/CurlContext.h:68 > + virtual ~CurlContext(); This class is a singleton and is not supposed to be inherited from, it should not have any virtual methods > Source/WebCore/platform/network/curl/CurlContext.h:70 > + CURLSH* getCurlShareHandle() const { return m_curlShareHandle; } According to coding style, it should be just curlShareHandle() https://webkit.org/code-style-guidelines/#names > Source/WebCore/platform/network/curl/CurlContext.h:83 > + std::tuple<CurlProxyType, const String&> getProxyInfo() const; Prefer informatively named structs to pairs and tuples. The latter are mostly useful for generic (template) code
Don Olmstead
Comment 8 2017-06-27 13:58:13 PDT
Comment on attachment 313871 [details] PATH with fix for thread change View in context: https://bugs.webkit.org/attachment.cgi?id=313871&action=review > Source/WebCore/platform/network/curl/CurlContext.cpp:76 > +#if OS(WINDOWS) I'm wondering if this block should be using FileSystem.h functions. I'm fine with that being in another patch if there's more refactoring coming for cookies.
Alex Christensen
Comment 9 2017-06-27 16:20:37 PDT
Comment on attachment 313871 [details] PATH with fix for thread change View in context: https://bugs.webkit.org/attachment.cgi?id=313871&action=review > Source/WebCore/platform/network/curl/CurlContext.h:58 > + static CurlContext& singleton() Can this return a const CurlContext&? > Source/WebCore/platform/network/curl/CurlContext.h:62 > + // Since it's a static variable, if the class has already been created, > + // It won't be created again. > + // And it **is** thread-safe in C++11. I don't think this comment is helpful. >> Source/WebCore/platform/network/curl/CurlContext.h:83 >> + std::tuple<CurlProxyType, const String&> getProxyInfo() const; > > Prefer informatively named structs to pairs and tuples. The latter are mostly useful for generic (template) code Yep. std::tuples of two things are std::pairs, but this should definitely be a struct with named members.
Basuke Suzuki
Comment 10 2017-06-28 14:18:58 PDT
(In reply to Konstantin Tokarev from comment #7) > Comment on attachment 313871 [details] > PATH with fix for thread change > > View in context: > https://bugs.webkit.org/attachment.cgi?id=313871&action=review > > > Source/WebCore/platform/network/curl/CurlContext.h:35 > > +#if PLATFORM(WIN) > > OS(WINDOWS) > > > Source/WebCore/platform/network/curl/CurlContext.h:68 > > + virtual ~CurlContext(); > > This class is a singleton and is not supposed to be inherited from, it > should not have any virtual methods > > > Source/WebCore/platform/network/curl/CurlContext.h:70 > > + CURLSH* getCurlShareHandle() const { return m_curlShareHandle; } > > According to coding style, it should be just curlShareHandle() > > https://webkit.org/code-style-guidelines/#names > > > Source/WebCore/platform/network/curl/CurlContext.h:83 > > + std::tuple<CurlProxyType, const String&> getProxyInfo() const; > > Prefer informatively named structs to pairs and tuples. The latter are > mostly useful for generic (template) code Got it. I'll change them. > Alex I cannot make CurlContext::singleton() as const because it has configuration change method such as setProxyInfo(). > Don I will submit platform-independency bug after this patch accepted.
Basuke Suzuki
Comment 11 2017-06-28 19:43:13 PDT
Created attachment 314094 [details] PATCH with reviewed advices
Build Bot
Comment 12 2017-06-28 19:45:57 PDT
Attachment 314094 [details] did not pass style-queue: ERROR: Source/WebCore/platform/network/curl/CurlContext.h:57: Missing space before { [whitespace/braces] [5] Total errors found: 1 in 10 files If any of these errors are false positives, please file a bug against check-webkit-style.
Basuke Suzuki
Comment 13 2017-06-28 19:52:29 PDT
Created attachment 314095 [details] Fix style again
WebKit Commit Bot
Comment 14 2017-06-29 11:07:36 PDT
Comment on attachment 314095 [details] Fix style again Clearing flags on attachment: 314095 Committed r218947: <http://trac.webkit.org/changeset/218947>
WebKit Commit Bot
Comment 15 2017-06-29 11:07:37 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.