WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
160006
Add success parameter to IOSurface::create() to indicate valid m_surface.
https://bugs.webkit.org/show_bug.cgi?id=160006
Summary
Add success parameter to IOSurface::create() to indicate valid m_surface.
alan baradlay
Reported
2016-07-20 20:05:04 PDT
see
bug 160005
Attachments
Patch
(6.06 KB, patch)
2016-07-21 09:16 PDT
,
alan baradlay
simon.fraser
: review-
Details
Formatted Diff
Diff
Patch
(12.69 KB, patch)
2016-07-21 20:20 PDT
,
alan baradlay
no flags
Details
Formatted Diff
Diff
Patch
(12.80 KB, patch)
2016-07-21 20:37 PDT
,
alan baradlay
no flags
Details
Formatted Diff
Diff
Patch
(12.84 KB, patch)
2016-07-22 07:29 PDT
,
alan baradlay
no flags
Details
Formatted Diff
Diff
Patch
(12.79 KB, patch)
2016-07-22 08:24 PDT
,
alan baradlay
no flags
Details
Formatted Diff
Diff
Patch
(12.85 KB, patch)
2016-07-22 09:18 PDT
,
alan baradlay
no flags
Details
Formatted Diff
Diff
Patch
(12.85 KB, patch)
2016-07-22 09:19 PDT
,
alan baradlay
no flags
Details
Formatted Diff
Diff
Patch
(12.85 KB, patch)
2016-07-22 10:45 PDT
,
alan baradlay
no flags
Details
Formatted Diff
Diff
Patch
(12.96 KB, patch)
2016-07-22 15:13 PDT
,
alan baradlay
no flags
Details
Formatted Diff
Diff
Show Obsolete
(8)
View All
Add attachment
proposed patch, testcase, etc.
alan baradlay
Comment 1
2016-07-21 09:16:30 PDT
Created
attachment 284218
[details]
Patch
Simon Fraser (smfr)
Comment 2
2016-07-21 10:47:16 PDT
Comment on
attachment 284218
[details]
Patch r-. I think you need to look at all the other callers of IOSurface::create()
alan baradlay
Comment 3
2016-07-21 20:20:57 PDT
Created
attachment 284301
[details]
Patch
alan baradlay
Comment 4
2016-07-21 20:37:11 PDT
Created
attachment 284303
[details]
Patch
Tim Horton
Comment 5
2016-07-22 00:17:21 PDT
Comment on
attachment 284303
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=284303&action=review
> Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp:157 > + if (m_data.surface) {
Someday we really need to figure out how to refactor this function, it's pretty crazy.
> Source/WebCore/platform/graphics/cocoa/IOSurface.mm:68 > + auto iosurface = std::unique_ptr<IOSurface>(new IOSurface(size, contextSize, colorSpace, pixelFormat, success));
it's either IOSurface or ioSurface or maybe just surface (my favorite, I think), but surely not 'iosurface'.
> Source/WebCore/platform/graphics/cocoa/IOSurface.mm:189 > + ASSERT(!success);
??? why do you care what the initial value of the out arg is? Shouldn't you just store false to it right away? This makes it weird for callers.
> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:1402 > + viewSnapshot->clearImage();
I don't think we want to clear the original snapshot just because we failed to compress; we should leave it alone.
> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:4245 > + return;
It's definitely not OK to not call the completion handler.
alan baradlay
Comment 6
2016-07-22 07:29:17 PDT
Created
attachment 284330
[details]
Patch
alan baradlay
Comment 7
2016-07-22 08:24:44 PDT
Created
attachment 284334
[details]
Patch
Radar WebKit Bug Importer
Comment 8
2016-07-22 09:16:27 PDT
<
rdar://problem/27495102
>
alan baradlay
Comment 9
2016-07-22 09:18:11 PDT
Created
attachment 284338
[details]
Patch
alan baradlay
Comment 10
2016-07-22 09:19:29 PDT
Created
attachment 284339
[details]
Patch
alan baradlay
Comment 11
2016-07-22 10:45:51 PDT
Created
attachment 284345
[details]
Patch
Simon Fraser (smfr)
Comment 12
2016-07-22 10:50:40 PDT
Comment on
attachment 284339
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=284339&action=review
> Source/WebCore/platform/graphics/cocoa/IOSurface.mm:214 > NSLog(@"Surface creation failed for options %@", options);
Let's use LOG_ALWAYS_ERROR here. Would be nice if we could also dump some stats about memory pressure (in a future patch).
> Source/WebCore/platform/graphics/cocoa/IOSurface.mm:399 > + callback(nullptr);
Did you check that the callers' callbacks are able to handle a null IOSurface?
> Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm:410 > + if (acceleratesDrawing() && m_frontBuffer.surface) { > layer.contents = m_frontBuffer.surface->asLayerContents(); > return; > }
Won't we fall through and ASSERT(!acceleratesDrawing()); on device here? I think we should set layer contents to nil and return.
> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:4242 > + completionHandler(nullptr);
Same comment about the handlers being able to take null.
Tim Horton
Comment 13
2016-07-22 10:53:27 PDT
Comment on
attachment 284345
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=284345&action=review
> Source/WebCore/platform/graphics/cocoa/IOSurface.mm:91 > size_t height = CGImageGetHeight(image);
Did you check the createFromImage callers?
> Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm:407 > + if (acceleratesDrawing() && m_frontBuffer.surface) {
Shouldn't the surface check be inside here? (and still return even if we don't have one) Otherwise we'll assert below (or maybe crash trying to retrieve the bitmap) if the allocation fails, right? We should probably clear the backing store in that case, instead. Probably should read like: if (acceleratesDrawing()) { layer.contents = m_frontBuffer.surface ? m_frontBuffer.surface->asLayerContents() : nil; return; }
Tim Horton
Comment 14
2016-07-22 10:55:52 PDT
(In reply to
comment #12
)
> Comment on
attachment 284339
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=284339&action=review
> > > Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:4242 > > + completionHandler(nullptr); > > Same comment about the handlers being able to take null.
There are already lots of ways to call this completion handler with null.
alan baradlay
Comment 15
2016-07-22 14:52:55 PDT
(In reply to
comment #12
)
> Comment on
attachment 284339
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=284339&action=review
> > > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:214 > > NSLog(@"Surface creation failed for options %@", options); > > Let's use LOG_ALWAYS_ERROR here. Would be nice if we could also dump some > stats about memory pressure (in a future patch). > > > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:399 > > + callback(nullptr); > > Did you check that the callers' callbacks are able to handle a null > IOSurface?
Yes, hence the if (convertedSurface) viewSnapshot->setSurface(WTFMove(convertedSurface)); change.
> > > Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm:410 > > + if (acceleratesDrawing() && m_frontBuffer.surface) { > > layer.contents = m_frontBuffer.surface->asLayerContents(); > > return; > > } > > Won't we fall through and ASSERT(!acceleratesDrawing()); on device here? I > think we should set layer contents to nil and return. > > > Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:4242 > > + completionHandler(nullptr); > > Same comment about the handlers being able to take null.
alan baradlay
Comment 16
2016-07-22 14:55:06 PDT
(In reply to
comment #13
)
> Comment on
attachment 284345
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=284345&action=review
> > > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:91 > > size_t height = CGImageGetHeight(image); > > Did you check the createFromImage callers?
Yes I did. WebViewImpl::takeViewSnapshot() handles nullptr. (and IOSurface::createFromImage() already returns nullptr as an error case.)
alan baradlay
Comment 17
2016-07-22 15:13:54 PDT
Created
attachment 284377
[details]
Patch
WebKit Commit Bot
Comment 18
2016-07-22 18:57:29 PDT
Comment on
attachment 284377
[details]
Patch Clearing flags on attachment: 284377 Committed
r203631
: <
http://trac.webkit.org/changeset/203631
>
WebKit Commit Bot
Comment 19
2016-07-22 18:57:35 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