Bug 158222 - Use more references in ResourceLoader related code
Summary: Use more references in ResourceLoader related code
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-31 01:18 PDT by youenn fablet
Modified: 2016-06-02 08:58 PDT (History)
5 users (show)

See Also:


Attachments
Patch (46.73 KB, patch)
2016-05-31 01:27 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Fixing mac build (46.89 KB, patch)
2016-05-31 01:45 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (50.42 KB, patch)
2016-05-31 02:50 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews102 for mac-yosemite (645.21 KB, application/zip)
2016-05-31 03:24 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews106 for mac-yosemite-wk2 (267.74 KB, application/zip)
2016-05-31 03:26 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews124 for ios-simulator-wk2 (672.56 KB, application/zip)
2016-05-31 03:30 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews114 for mac-yosemite (397.85 KB, application/zip)
2016-05-31 03:30 PDT, Build Bot
no flags Details
Fixing counter issue (49.46 KB, patch)
2016-05-31 05:39 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Fixing changelog (49.42 KB, patch)
2016-05-31 05:41 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews102 for mac-yosemite (918.35 KB, application/zip)
2016-05-31 06:19 PDT, Build Bot
no flags Details
Fixing according comments (49.53 KB, patch)
2016-06-01 02:10 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (51.62 KB, patch)
2016-06-02 00:42 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (51.62 KB, patch)
2016-06-02 01:13 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2016-05-31 01:18:15 PDT
We should use more references in ResourceLoader related code
Comment 1 youenn fablet 2016-05-31 01:27:20 PDT
Created attachment 280124 [details]
Patch
Comment 2 youenn fablet 2016-05-31 01:45:59 PDT
Created attachment 280126 [details]
Fixing mac build
Comment 3 youenn fablet 2016-05-31 02:50:50 PDT
Created attachment 280130 [details]
Patch
Comment 4 Build Bot 2016-05-31 03:23:57 PDT
Comment on attachment 280130 [details]
Patch

Attachment 280130 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/1411707

Number of test failures exceeded the failure limit.
Comment 5 Build Bot 2016-05-31 03:24:00 PDT
Created attachment 280131 [details]
Archive of layout-test-results from ews102 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews102  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 6 Build Bot 2016-05-31 03:26:21 PDT
Comment on attachment 280130 [details]
Patch

Attachment 280130 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/1411718

Number of test failures exceeded the failure limit.
Comment 7 Build Bot 2016-05-31 03:26:24 PDT
Created attachment 280132 [details]
Archive of layout-test-results from ews106 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 8 Build Bot 2016-05-31 03:29:58 PDT
Comment on attachment 280130 [details]
Patch

Attachment 280130 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/1411708

Number of test failures exceeded the failure limit.
Comment 9 Build Bot 2016-05-31 03:30:00 PDT
Created attachment 280134 [details]
Archive of layout-test-results from ews124 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews124  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.4
Comment 10 Build Bot 2016-05-31 03:30:06 PDT
Comment on attachment 280130 [details]
Patch

Attachment 280130 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/1411710

Number of test failures exceeded the failure limit.
Comment 11 Build Bot 2016-05-31 03:30:08 PDT
Created attachment 280135 [details]
Archive of layout-test-results from ews114 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews114  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 12 youenn fablet 2016-05-31 05:39:25 PDT
Created attachment 280141 [details]
Fixing counter issue
Comment 13 youenn fablet 2016-05-31 05:41:01 PDT
Created attachment 280142 [details]
Fixing changelog
Comment 14 Build Bot 2016-05-31 06:19:50 PDT
Comment on attachment 280142 [details]
Fixing changelog

Attachment 280142 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/1412330

Number of test failures exceeded the failure limit.
Comment 15 Build Bot 2016-05-31 06:19:53 PDT
Created attachment 280143 [details]
Archive of layout-test-results from ews102 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews102  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 16 youenn fablet 2016-05-31 06:40:44 PDT
(In reply to comment #15)
> Created attachment 280143 [details]
> Archive of layout-test-results from ews102 for mac-yosemite
> 
> The attached test failures were seen while running run-webkit-tests on the
> mac-ews.
> Bot: ews102  Port: mac-yosemite  Platform: Mac OS X 10.10.5

Mac bot errors are due to issues with wpt server (see bug 158137) and are unrelated to this patch.

DEBUG:web-platform-tests:Traceback (most recent call last):
  File "/Volumes/Data/EWS/WebKit/LayoutTests/imported/w3c/web-platform-tests/tools/wptserve/wptserve/handlers.py", line 133, in __call__
    data = self.get_data(response, path, byte_ranges)
  File "/Volumes/Data/EWS/WebKit/LayoutTests/imported/w3c/web-platform-tests/tools/wptserve/wptserve/handlers.py", line 183, in get_data
    return open(path, 'rb')
IOError: [Errno 24] Too many open files: '/Volumes/Data/EWS/WebKit/LayoutTests/imported/w3c/web-platform-tests/resources/testharness.js'
Comment 17 Darin Adler 2016-05-31 10:16:01 PDT
Comment on attachment 280142 [details]
Fixing changelog

View in context: https://bugs.webkit.org/attachment.cgi?id=280142&action=review

> Source/WebCore/loader/cache/CachedResource.cpp:221
>      if (cachedResourceLoader.frame()->page() && cachedResourceLoader.frame()->page()->inPageCache()) {

This code should use the new local variable, frame.

> Source/WebCore/loader/cache/CachedResourceLoader.cpp:1015
> +void CachedResourceLoader::incrementRequestCount(const CachedResource& res)

Should rename "res" to "resource" when touching this code.
Comment 18 youenn fablet 2016-06-01 02:10:56 PDT
Created attachment 280225 [details]
Fixing according comments
Comment 19 youenn fablet 2016-06-01 02:13:44 PDT
Thanks for the review.

> > Source/WebCore/loader/cache/CachedResource.cpp:221
> >      if (cachedResourceLoader.frame()->page() && cachedResourceLoader.frame()->page()->inPageCache()) {
> 
> This code should use the new local variable, frame.

Done

> > Source/WebCore/loader/cache/CachedResourceLoader.cpp:1015
> > +void CachedResourceLoader::incrementRequestCount(const CachedResource& res)
> 
> Should rename "res" to "resource" when touching this code.

Done
Comment 20 Alex Christensen 2016-06-01 09:56:02 PDT
Comment on attachment 280225 [details]
Fixing according comments

View in context: https://bugs.webkit.org/attachment.cgi?id=280225&action=review

> Source/WebCore/css/CSSFontFaceSource.cpp:127
> -    fontSelector.beginLoadingFontSoon(m_font.get());
> +    fontSelector.beginLoadingFontSoon(*m_font);

I don't think m_font is guaranteed to not be null.

> Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp:298
>      for (HashMap<unsigned long, RefPtr<WebResourceLoader>>::iterator i = m_webResourceLoaders.begin(); i != end; ++i)

This should be made into a c++11-style forloop.
Comment 21 youenn fablet 2016-06-01 11:09:21 PDT
(In reply to comment #20)
> Comment on attachment 280225 [details]
> Fixing according comments
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=280225&action=review
> 
> > Source/WebCore/css/CSSFontFaceSource.cpp:127
> > -    fontSelector.beginLoadingFontSoon(m_font.get());
> > +    fontSelector.beginLoadingFontSoon(*m_font);
> 
> I don't think m_font is guaranteed to not be null.

If m_font is null, status is set to Success and load() will not be called.
But I agree it may be easy to break that assumption.
I will add an ASSERT(m_font).

> > Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp:298
> >      for (HashMap<unsigned long, RefPtr<WebResourceLoader>>::iterator i = m_webResourceLoaders.begin(); i != end; ++i)
> 
> This should be made into a c++11-style forloop.

OK
Comment 22 Darin Adler 2016-06-01 23:12:04 PDT
Comment on attachment 280225 [details]
Fixing according comments

View in context: https://bugs.webkit.org/attachment.cgi?id=280225&action=review

> Source/WebCore/loader/NetscapePlugInStreamLoader.cpp:60
>      RefPtr<NetscapePlugInStreamLoader> loader(adoptRef(new NetscapePlugInStreamLoader(frame, client)));

Should use auto.

> Source/WebCore/loader/ResourceLoader.cpp:63
> +    : m_frame(&frame)

m_frame should be a Ref instead a RefPtr, I think

> Source/WebCore/loader/ResourceLoader.cpp:68
>      , m_identifier(0)
>      , m_reachedTerminalState(false)
>      , m_notifiedLoadComplete(false)
>      , m_cancellationStatus(NotCancelled)

Should initialize these scalars in the header instead of here. Same for m_resourceType and m_isQuickLookResource.
Comment 23 youenn fablet 2016-06-02 00:42:42 PDT
Created attachment 280314 [details]
Patch for landing
Comment 24 WebKit Commit Bot 2016-06-02 01:08:05 PDT
Comment on attachment 280314 [details]
Patch for landing

Rejecting attachment 280314 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-03', 'build', '--no-clean', '--no-update', '--build-style=release', '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit

Last 500 characters of output:
/EWS/WebKit/Source/WebKit2/WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp -o /Volumes/Data/EWS/WebKit/WebKitBuild/WebKit2.build/Release/WebKit.build/Objects-normal/x86_64/WebPasteboardOverrides.o

** BUILD FAILED **


The following build commands failed:
	CompileC /Volumes/Data/EWS/WebKit/WebKitBuild/WebKit2.build/Release/WebKit.build/Objects-normal/x86_64/WebLoaderStrategy.o WebProcess/Network/WebLoaderStrategy.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Full output: http://webkit-queues.webkit.org/results/1421983
Comment 25 youenn fablet 2016-06-02 01:13:35 PDT
Created attachment 280317 [details]
Patch for landing
Comment 26 WebKit Commit Bot 2016-06-02 01:43:55 PDT
Comment on attachment 280317 [details]
Patch for landing

Clearing flags on attachment: 280317

Committed r201596: <http://trac.webkit.org/changeset/201596>
Comment 27 WebKit Commit Bot 2016-06-02 01:44:01 PDT
All reviewed patches have been landed.  Closing bug.
Comment 28 youenn fablet 2016-06-02 08:58:24 PDT
Thanks for both reviews.
Except for m_frame which currently needs to be a RefPtr, I integrated all feedback.