Changeset 276473 in webkit
- Timestamp:
- Apr 22, 2021, 3:33:20 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r276448 r276473 1 2021-04-22 Simon Fraser <simon.fraser@apple.com> 2 3 Add trace points for WKWebView snapshotting 4 https://bugs.webkit.org/show_bug.cgi?id=224943 5 6 Reviewed by Tim Horton. 7 8 New snapshot values. 9 10 * wtf/SystemTracing.h: 11 1 12 2021-04-22 Martin Robinson <mrobinson@webkit.org> 2 13 -
trunk/Source/WTF/wtf/SystemTracing.h
r276360 r276473 120 120 CreateInjectedBundleStart, 121 121 CreateInjectedBundleEnd, 122 PaintSnapshotStart, 123 PaintSnapshotEnd, 124 RenderServerSnapshotStart, 125 RenderServerSnapshotEnd, 126 TakeSnapshotStart, 127 TakeSnapshotEnd, 122 128 123 129 UIProcessRange = 14000, -
trunk/Source/WebKit/ChangeLog
r276472 r276473 1 2021-04-22 Simon Fraser <simon.fraser@apple.com> 2 3 Add trace points for WKWebView snapshotting 4 https://bugs.webkit.org/show_bug.cgi?id=224943 5 6 Reviewed by Tim Horton. 7 8 Add new trace points to make snapshotting-related issues easier to diagnose. In the UI 9 process we start/end a trace scope when requested to snapshot, and before calling the 10 client's completion handler. 11 12 Trace CARenderServer snapshots which happen in the UI process, and in the web process, trace 13 the start and end of the snapshot painting. 14 15 * UIProcess/API/Cocoa/WKWebView.mm: 16 (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]): 17 * UIProcess/API/Cocoa/_WKThumbnailView.mm: 18 (-[_WKThumbnailView requestSnapshot]): 19 * UIProcess/API/ios/WKWebViewIOS.mm: 20 (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]): 21 * WebProcess/WebPage/WebPage.cpp: 22 (WebKit::WebPage::paintSnapshotAtSize): 23 1 24 2021-04-22 Lauro Moura <lmoura@igalia.com> 2 25 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r276347 r276473 149 149 #import <wtf/Optional.h> 150 150 #import <wtf/RetainPtr.h> 151 #import <wtf/SystemTracing.h> 151 152 #import <wtf/UUID.h> 152 153 #import <wtf/cocoa/VectorCocoa.h> … … 1105 1106 - (void)takeSnapshotWithConfiguration:(WKSnapshotConfiguration *)snapshotConfiguration completionHandler:(void(^)(CocoaImage *, NSError *))completionHandler 1106 1107 { 1108 constexpr bool snapshotFailedTraceValue = false; 1109 tracePoint(TakeSnapshotStart); 1110 1107 1111 CGRect rectInViewCoordinates = snapshotConfiguration && !CGRectIsNull(snapshotConfiguration.rect) ? snapshotConfiguration.rect : self.bounds; 1108 1112 CGFloat snapshotWidth; … … 1129 1133 _page->takeSnapshot(WebCore::enclosingIntRect(rectInViewCoordinates), bitmapSize, WebKit::SnapshotOptionsInViewCoordinates, [handler, snapshotWidth, imageHeight](const WebKit::ShareableBitmap::Handle& imageHandle) { 1130 1134 if (imageHandle.isNull()) { 1135 tracePoint(TakeSnapshotEnd, snapshotFailedTraceValue); 1131 1136 handler(nil, createNSError(WKErrorUnknown).get()); 1132 1137 return; … … 1135 1140 RetainPtr<CGImageRef> cgImage = bitmap ? bitmap->makeCGImage() : nullptr; 1136 1141 auto image = adoptNS([[NSImage alloc] initWithCGImage:cgImage.get() size:NSMakeSize(snapshotWidth, imageHeight)]); 1142 tracePoint(TakeSnapshotEnd, true); 1137 1143 handler(image.get(), nil); 1138 1144 }); … … 1149 1155 else 1150 1156 image = adoptNS([[UIImage alloc] initWithCGImage:snapshotImage scale:deviceScale orientation:UIImageOrientationUp]); 1151 1157 1158 tracePoint(TakeSnapshotEnd, !!snapshotImage); 1152 1159 handler(image.get(), error.get()); 1153 1160 }]; … … 1161 1168 _page->callAfterNextPresentationUpdate([callSnapshotRect = WTFMove(callSnapshotRect), handler](WebKit::CallbackBase::Error error) { 1162 1169 if (error != WebKit::CallbackBase::Error::None) { 1170 tracePoint(TakeSnapshotEnd, snapshotFailedTraceValue); 1163 1171 handler(nil, createNSError(WKErrorUnknown).get()); 1164 1172 return; -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKThumbnailView.mm
r272628 r276473 37 37 #import <pal/spi/cg/CoreGraphicsSPI.h> 38 38 #import <wtf/NakedPtr.h> 39 #import <wtf/SystemTracing.h> 39 40 40 41 // FIXME: Make it possible to leave a snapshot of the content presented in the WKView while the thumbnail is live. … … 123 124 } 124 125 126 tracePoint(TakeSnapshotStart); 125 127 _waitingForSnapshot = YES; 126 128 … … 145 147 auto bitmap = WebKit::ShareableBitmap::create(imageHandle, WebKit::SharedMemory::Protection::ReadOnly); 146 148 RetainPtr<CGImageRef> cgImage = bitmap ? bitmap->makeCGImage() : nullptr; 149 tracePoint(TakeSnapshotEnd, !!cgImage); 147 150 [thumbnailView _didTakeSnapshot:cgImage.get()]; 148 151 }); -
trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
r276331 r276473 61 61 #import <pal/spi/ios/GraphicsServicesSPI.h> 62 62 #import <wtf/BlockPtr.h> 63 #import <wtf/SystemTracing.h> 63 64 #import <wtf/cocoa/VectorCocoa.h> 64 65 … … 3075 3076 NSString *displayName = self.window.screen.displayConfiguration.name; 3076 3077 if (displayName && !self.window.hidden) { 3078 TraceScope snapshotScope(RenderServerSnapshotStart, RenderServerSnapshotEnd); 3077 3079 auto surface = WebCore::IOSurface::create(WebCore::expandedIntSize(WebCore::FloatSize(imageSize)), WebCore::sRGBColorSpaceRef()); 3078 3080 if (!surface) { -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r276351 r276473 260 260 #include <wtf/RunLoop.h> 261 261 #include <wtf/SetForScope.h> 262 #include <wtf/SystemTracing.h> 262 263 #include <wtf/text/TextStream.h> 263 264 … … 2539 2540 void WebPage::paintSnapshotAtSize(const IntRect& rect, const IntSize& bitmapSize, SnapshotOptions options, Frame& frame, FrameView& frameView, GraphicsContext& graphicsContext) 2540 2541 { 2542 TraceScope snapshotScope(PaintSnapshotStart, PaintSnapshotEnd, options); 2543 2541 2544 IntRect snapshotRect = rect; 2542 2545 float horizontalScaleFactor = static_cast<float>(bitmapSize.width()) / rect.width(); -
trunk/Tools/ChangeLog
r276457 r276473 1 2021-04-22 Simon Fraser <simon.fraser@apple.com> 2 3 Add trace points for WKWebView snapshotting 4 https://bugs.webkit.org/show_bug.cgi?id=224943 5 6 Reviewed by Tim Horton. 7 8 New snapshot descriptions. 9 10 * Tracing/SystemTracePoints.plist: 11 1 12 2021-04-22 Tim Nguyen <ntim@apple.com> 2 13 -
trunk/Tools/Tracing/SystemTracePoints.plist
r276360 r276473 513 513 <dict> 514 514 <key>Name</key> 515 <string>Paint snapshot</string> 516 <key>Type</key> 517 <string>Interval</string> 518 <key>Component</key> 519 <string>47</string> 520 <key>CodeBegin</key> 521 <string>12019</string> 522 <key>CodeEnd</key> 523 <string>12020</string> 524 <key>ArgNamesBegin</key> 525 <dict> 526 <key>Arg1</key> 527 <string>Options</string> 528 </dict> 529 </dict> 530 <dict> 531 <key>Name</key> 532 <string>Render server snapshot</string> 533 <key>Type</key> 534 <string>Interval</string> 535 <key>Component</key> 536 <string>47</string> 537 <key>CodeBegin</key> 538 <string>12021</string> 539 <key>CodeEnd</key> 540 <string>12022</string> 541 </dict> 542 <dict> 543 <key>Name</key> 544 <string>Take snapshot</string> 545 <key>Type</key> 546 <string>Interval</string> 547 <key>Component</key> 548 <string>47</string> 549 <key>CodeBegin</key> 550 <string>12023</string> 551 <key>CodeEnd</key> 552 <string>12024</string> 553 <key>ArgNamesEnd</key> 554 <dict> 555 <key>Arg1</key> 556 <string>Succeeded</string> 557 </dict> 558 </dict> 559 <dict> 560 <key>Name</key> 515 561 <string>Commit RemoteLayerTree transaction</string> 516 562 <key>Type</key>
Note:
See TracChangeset
for help on using the changeset viewer.