Changeset 286048 in webkit
- Timestamp:
- Nov 18, 2021 11:27:51 PM (8 months ago)
- Location:
- trunk/Source
- Files:
-
- 22 edited
-
WTF/ChangeLog (modified) (1 diff)
-
WTF/wtf/PlatformEnableCocoa.h (modified) (1 diff)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/Modules/model-element/HTMLModelElement.cpp (modified) (2 diffs)
-
WebCore/Modules/model-element/HTMLModelElement.h (modified) (2 diffs)
-
WebCore/Modules/model-element/HTMLModelElement.idl (modified) (1 diff)
-
WebCore/Modules/model-element/ModelPlayer.h (modified) (1 diff)
-
WebCore/Modules/model-element/dummy/DummyModelPlayer.cpp (modified) (1 diff)
-
WebCore/Modules/model-element/dummy/DummyModelPlayer.h (modified) (1 diff)
-
WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.h (modified) (1 diff)
-
WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.mm (modified) (1 diff)
-
WebCore/PAL/ChangeLog (modified) (1 diff)
-
WebCore/PAL/pal/spi/ios/SystemPreviewSPI.h (modified) (1 diff)
-
WebCore/PAL/pal/spi/mac/SystemPreviewSPI.h (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/UIProcess/Cocoa/ModelElementControllerCocoa.mm (modified) (3 diffs)
-
WebKit/UIProcess/ModelElementController.h (modified) (1 diff)
-
WebKit/UIProcess/WebPageProxy.cpp (modified) (3 diffs)
-
WebKit/UIProcess/WebPageProxy.h (modified) (1 diff)
-
WebKit/UIProcess/WebPageProxy.messages.in (modified) (1 diff)
-
WebKit/WebProcess/Model/ARKitInlinePreviewModelPlayer.h (modified) (1 diff)
-
WebKit/WebProcess/Model/ARKitInlinePreviewModelPlayer.mm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r286019 r286048 1 2021-11-18 Antoine Quint <graouts@webkit.org> 2 3 [Model] add support for pausing and resuming animations 4 https://bugs.webkit.org/show_bug.cgi?id=233319 5 <rdar://problem/85428464> 6 7 Reviewed by Wenson Hsieh. 8 9 Add a new compile-time flag for the new ARQL SPIs we are using. 10 11 * wtf/PlatformEnableCocoa.h: 12 1 13 2021-11-18 Antoine Quint <graouts@webkit.org> 2 14 -
trunk/Source/WTF/wtf/PlatformEnableCocoa.h
r286019 r286048 747 747 #if (ENABLE(ARKIT_INLINE_PREVIEW_MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 120400) || (ENABLE(ARKIT_INLINE_PREVIEW_IOS) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 150400) 748 748 #define ENABLE_ARKIT_INLINE_PREVIEW_CAMERA_TRANSFORM 1 749 #endif 749 #define ENABLE_ARKIT_INLINE_PREVIEW_ANIMATIONS_CONTROL 1 750 #endif -
trunk/Source/WebCore/ChangeLog
r286046 r286048 1 2021-11-18 Antoine Quint <graouts@webkit.org> 2 3 [Model] add support for pausing and resuming animations 4 https://bugs.webkit.org/show_bug.cgi?id=233319 5 <rdar://problem/85428464> 6 7 Reviewed by Wenson Hsieh. 8 9 We add three new promise-based methods to the HTMLModelElement IDL to control the playback state 10 of the animation built into the USDZ asset: isPlayingAnimation(), playAnimation() and pauseAnimation(). 11 All these methods are promise-based. 12 13 * Modules/model-element/HTMLModelElement.cpp: 14 (WebCore::HTMLModelElement::isPlayingAnimation): 15 (WebCore::HTMLModelElement::setAnimationIsPlaying): 16 (WebCore::HTMLModelElement::playAnimation): 17 (WebCore::HTMLModelElement::pauseAnimation): 18 * Modules/model-element/HTMLModelElement.h: 19 * Modules/model-element/HTMLModelElement.idl: 20 * Modules/model-element/ModelPlayer.h: 21 * Modules/model-element/dummy/DummyModelPlayer.cpp: 22 (WebCore::DummyModelPlayer::isPlayingAnimation): 23 (WebCore::DummyModelPlayer::setAnimationIsPlaying): 24 * Modules/model-element/dummy/DummyModelPlayer.h: 25 * Modules/model-element/scenekit/SceneKitModelPlayer.h: 26 * Modules/model-element/scenekit/SceneKitModelPlayer.mm: 27 (WebCore::SceneKitModelPlayer::isPlayingAnimation): 28 (WebCore::SceneKitModelPlayer::setAnimationIsPlaying): 29 1 30 2021-11-18 Fujii Hironori <Hironori.Fujii@sony.com> 2 31 -
trunk/Source/WebCore/Modules/model-element/HTMLModelElement.cpp
r286019 r286048 364 364 } 365 365 366 // MARK: –Camera support.366 // MARK: - Camera support. 367 367 368 368 void HTMLModelElement::getCamera(CameraPromise&& promise) … … 396 396 } 397 397 398 // MARK: - Animations support. 399 400 void HTMLModelElement::isPlayingAnimation(IsPlayingAnimationPromise&& promise) 401 { 402 if (!m_modelPlayer) { 403 promise.reject(); 404 return; 405 } 406 407 m_modelPlayer->isPlayingAnimation([promise = WTFMove(promise)] (std::optional<bool> isPlaying) mutable { 408 if (!isPlaying) 409 promise.reject(); 410 else 411 promise.resolve(*isPlaying); 412 }); 413 } 414 415 void HTMLModelElement::setAnimationIsPlaying(bool isPlaying, DOMPromiseDeferred<void>&& promise) 416 { 417 if (!m_modelPlayer) { 418 promise.reject(); 419 return; 420 } 421 422 m_modelPlayer->setAnimationIsPlaying(isPlaying, [promise = WTFMove(promise)] (bool success) mutable { 423 if (success) 424 promise.resolve(); 425 else 426 promise.reject(); 427 }); 428 } 429 430 void HTMLModelElement::playAnimation(DOMPromiseDeferred<void>&& promise) 431 { 432 setAnimationIsPlaying(true, WTFMove(promise)); 433 } 434 435 void HTMLModelElement::pauseAnimation(DOMPromiseDeferred<void>&& promise) 436 { 437 setAnimationIsPlaying(false, WTFMove(promise)); 438 } 439 398 440 } 399 441 -
trunk/Source/WebCore/Modules/model-element/HTMLModelElement.h
r286019 r286048 76 76 void setCamera(HTMLModelElementCamera, DOMPromiseDeferred<void>&&); 77 77 78 using IsPlayingAnimationPromise = DOMPromiseDeferred<IDLBoolean>; 79 void isPlayingAnimation(IsPlayingAnimationPromise&&); 80 void playAnimation(DOMPromiseDeferred<void>&&); 81 void pauseAnimation(DOMPromiseDeferred<void>&&); 82 78 83 bool isDraggableIgnoringAttributes() const final { return true; } 79 84 … … 106 111 void dragDidEnd(MouseEvent&); 107 112 113 void setAnimationIsPlaying(bool, DOMPromiseDeferred<void>&&); 114 108 115 URL m_sourceURL; 109 116 CachedResourceHandle<CachedRawResource> m_resource; -
trunk/Source/WebCore/Modules/model-element/HTMLModelElement.idl
r286019 r286048 37 37 Promise<HTMLModelElementCamera> getCamera(); 38 38 Promise<undefined> setCamera(HTMLModelElementCamera camera); 39 40 Promise<boolean> isPlayingAnimation(); 41 Promise<undefined> playAnimation(); 42 Promise<undefined> pauseAnimation(); 39 43 }; -
trunk/Source/WebCore/Modules/model-element/ModelPlayer.h
r286019 r286048 51 51 virtual void handleMouseUp(const LayoutPoint&, MonotonicTime) = 0; 52 52 virtual void getCamera(CompletionHandler<void(std::optional<HTMLModelElementCamera>&&)>&&) = 0; 53 virtual void setCamera(HTMLModelElementCamera, CompletionHandler<void(bool&&)>&&) = 0; 53 virtual void setCamera(HTMLModelElementCamera, CompletionHandler<void(bool success)>&&) = 0; 54 virtual void isPlayingAnimation(CompletionHandler<void(std::optional<bool>&&)>&&) = 0; 55 virtual void setAnimationIsPlaying(bool, CompletionHandler<void(bool success)>&&) = 0; 54 56 }; 55 57 -
trunk/Source/WebCore/Modules/model-element/dummy/DummyModelPlayer.cpp
r286019 r286048 75 75 } 76 76 77 void DummyModelPlayer::setCamera(WebCore::HTMLModelElementCamera, CompletionHandler<void(bool&&)>&&) 77 void DummyModelPlayer::setCamera(WebCore::HTMLModelElementCamera, CompletionHandler<void(bool success)>&&) 78 { 79 } 80 81 void DummyModelPlayer::isPlayingAnimation(CompletionHandler<void(std::optional<bool>&&)>&&) 82 { 83 } 84 85 void DummyModelPlayer::setAnimationIsPlaying(bool, CompletionHandler<void(bool success)>&&) 78 86 { 79 87 } -
trunk/Source/WebCore/Modules/model-element/dummy/DummyModelPlayer.h
r286019 r286048 49 49 void handleMouseUp(const LayoutPoint&, MonotonicTime) override; 50 50 void getCamera(CompletionHandler<void(std::optional<WebCore::HTMLModelElementCamera>&&)>&&) override; 51 void setCamera(WebCore::HTMLModelElementCamera, CompletionHandler<void(bool&&)>&&) override; 51 void setCamera(WebCore::HTMLModelElementCamera, CompletionHandler<void(bool success)>&&) override; 52 void isPlayingAnimation(CompletionHandler<void(std::optional<bool>&&)>&&) override; 53 void setAnimationIsPlaying(bool, CompletionHandler<void(bool success)>&&) override; 52 54 53 55 WeakPtr<ModelPlayerClient> m_client; -
trunk/Source/WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.h
r286019 r286048 63 63 void handleMouseUp(const LayoutPoint&, MonotonicTime) override; 64 64 void getCamera(CompletionHandler<void(std::optional<HTMLModelElementCamera>&&)>&&) override; 65 void setCamera(HTMLModelElementCamera, CompletionHandler<void(bool&&)>&&) override; 65 void setCamera(HTMLModelElementCamera, CompletionHandler<void(bool success)>&&) override; 66 void isPlayingAnimation(CompletionHandler<void(std::optional<bool>&&)>&&) override; 67 void setAnimationIsPlaying(bool, CompletionHandler<void(bool success)>&&) override; 66 68 67 69 // SceneKitModelLoaderClient overrides. -
trunk/Source/WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.mm
r286019 r286048 93 93 } 94 94 95 void SceneKitModelPlayer::setCamera(HTMLModelElementCamera, CompletionHandler<void(bool&&)>&&) 95 void SceneKitModelPlayer::setCamera(HTMLModelElementCamera, CompletionHandler<void(bool success)>&&) 96 { 97 } 98 99 void SceneKitModelPlayer::isPlayingAnimation(CompletionHandler<void(std::optional<bool>&&)>&&) 100 { 101 } 102 103 void SceneKitModelPlayer::setAnimationIsPlaying(bool, CompletionHandler<void(bool success)>&&) 96 104 { 97 105 } -
trunk/Source/WebCore/PAL/ChangeLog
r286019 r286048 1 2021-11-18 Antoine Quint <graouts@webkit.org> 2 3 [Model] add support for pausing and resuming animations 4 https://bugs.webkit.org/show_bug.cgi?id=233319 5 <rdar://problem/85428464> 6 7 Reviewed by Wenson Hsieh. 8 9 Add the new ARQL SPIs we are using. 10 11 * pal/spi/ios/SystemPreviewSPI.h: 12 * pal/spi/mac/SystemPreviewSPI.h: 13 1 14 2021-11-18 Antoine Quint <graouts@webkit.org> 2 15 -
trunk/Source/WebCore/PAL/pal/spi/ios/SystemPreviewSPI.h
r286019 r286048 109 109 - (void)setCameraTransform:(simd_float3)transform; 110 110 111 @property (nonatomic, readonly) BOOL isPlaying; 112 typedef void (^ASVSetIsPlayingReplyBlock) (BOOL isPlaying, NSError * _Nullable error); 113 - (void)setIsPlaying:(BOOL)isPlaying reply:(ASVSetIsPlayingReplyBlock)reply; 114 111 115 @end 112 116 -
trunk/Source/WebCore/PAL/pal/spi/mac/SystemPreviewSPI.h
r286019 r286048 59 59 - (void)setCameraTransform:(simd_float3)transform; 60 60 61 @property (nonatomic, readonly) BOOL isPlaying; 62 typedef void (^ASVSetIsPlayingReplyBlock) (BOOL isPlaying, NSError * _Nullable error); 63 - (void)setIsPlaying:(BOOL)isPlaying reply:(ASVSetIsPlayingReplyBlock)reply; 64 61 65 @end 62 66 -
trunk/Source/WebKit/ChangeLog
r286047 r286048 1 2021-11-18 Antoine Quint <graouts@webkit.org> 2 3 [Model] add support for pausing and resuming animations 4 https://bugs.webkit.org/show_bug.cgi?id=233319 5 <rdar://problem/85428464> 6 7 Reviewed by Wenson Hsieh. 8 9 Expose new WebPageProxy messages to let the WebProcess message the UIProcess 10 to call into ASVInlinePreview methods to get and set the animation's playback 11 state. 12 13 * UIProcess/Cocoa/ModelElementControllerCocoa.mm: 14 (WebKit::previewHasAnimationSupport): 15 (WebKit::ModelElementController::isPlayingAnimationForModelElement): 16 (WebKit::ModelElementController::setAnimationIsPlayingForModelElement): 17 * UIProcess/ModelElementController.h: 18 * UIProcess/WebPageProxy.cpp: 19 (WebKit::WebPageProxy::modelElementIsPlayingAnimation): 20 (WebKit::WebPageProxy::modelElementSetAnimationIsPlaying): 21 * UIProcess/WebPageProxy.h: 22 * UIProcess/WebPageProxy.messages.in: 23 * WebProcess/Model/ARKitInlinePreviewModelPlayer.h: 24 * WebProcess/Model/ARKitInlinePreviewModelPlayer.mm: 25 (WebKit::ARKitInlinePreviewModelPlayer::isPlayingAnimation): 26 (WebKit::ARKitInlinePreviewModelPlayer::setAnimationIsPlaying): 27 1 28 2021-11-18 Myles C. Maxfield <mmaxfield@apple.com> 2 29 -
trunk/Source/WebKit/UIProcess/Cocoa/ModelElementControllerCocoa.mm
r286023 r286048 246 246 { 247 247 auto* preview = previewForModelIdentifier(modelIdentifier); 248 if (!preview || !previewHasCameraSupport(preview)) {248 if (!previewHasCameraSupport(preview)) { 249 249 callOnMainRunLoop([weakThis = WeakPtr { *this }, completionHandler = WTFMove(completionHandler), error = WebCore::ResourceError { WebCore::ResourceError::Type::General }] () mutable { 250 250 if (weakThis) … … 281 281 { 282 282 auto* preview = previewForModelIdentifier(modelIdentifier); 283 if (!preview || !previewHasCameraSupport(preview)) {283 if (!previewHasCameraSupport(preview)) { 284 284 callOnMainRunLoop([weakThis = WeakPtr { *this }, completionHandler = WTFMove(completionHandler)] () mutable { 285 285 if (weakThis) … … 303 303 } 304 304 305 #endif 306 307 } 308 309 #endif 305 static bool previewHasAnimationSupport(ASVInlinePreview *preview) 306 { 307 #if ENABLE(ARKIT_INLINE_PREVIEW_ANIMATIONS_CONTROL) 308 return [preview respondsToSelector:@selector(isPlaying)]; 309 #else 310 return false; 311 #endif 312 } 313 314 void ModelElementController::isPlayingAnimationForModelElement(ModelIdentifier modelIdentifier, CompletionHandler<void(Expected<bool, WebCore::ResourceError>)>&& completionHandler) 315 { 316 auto* preview = previewForModelIdentifier(modelIdentifier); 317 if (!previewHasAnimationSupport(preview)) { 318 callOnMainRunLoop([weakThis = WeakPtr { *this }, completionHandler = WTFMove(completionHandler), error = WebCore::ResourceError { WebCore::ResourceError::Type::General }] () mutable { 319 if (weakThis) 320 completionHandler(makeUnexpected(error)); 321 }); 322 return; 323 } 324 325 #if ENABLE(ARKIT_INLINE_PREVIEW_ANIMATIONS_CONTROL) 326 auto isPlaying = [preview isPlaying]; 327 #else 328 auto isPlaying = false; 329 #endif 330 callOnMainRunLoop([isPlaying, weakThis = WeakPtr { *this }, completionHandler = WTFMove(completionHandler)] () mutable { 331 if (weakThis) 332 completionHandler(isPlaying); 333 }); 334 } 335 336 void ModelElementController::setAnimationIsPlayingForModelElement(ModelIdentifier modelIdentifier, bool isPlaying, CompletionHandler<void(bool)>&& completionHandler) 337 { 338 auto* preview = previewForModelIdentifier(modelIdentifier); 339 if (!previewHasAnimationSupport(preview)) { 340 callOnMainRunLoop([weakThis = WeakPtr { *this }, completionHandler = WTFMove(completionHandler)] () mutable { 341 if (weakThis) 342 completionHandler(false); 343 }); 344 return; 345 } 346 347 #if ENABLE(ARKIT_INLINE_PREVIEW_ANIMATIONS_CONTROL) 348 [preview setIsPlaying:isPlaying reply:makeBlockPtr([weakThis = WeakPtr { *this }, completionHandler = WTFMove(completionHandler)] (BOOL, NSError *error) mutable { 349 callOnMainRunLoop([error, weakThis = WTFMove(weakThis), completionHandler = WTFMove(completionHandler)] () mutable { 350 if (weakThis) 351 completionHandler(!error); 352 }); 353 }).get()]; 354 #else 355 callOnMainRunLoop([weakThis = WeakPtr { *this }, completionHandler = WTFMove(completionHandler)] () mutable { 356 if (weakThis) 357 completionHandler(false); 358 }); 359 #endif 360 } 361 362 #endif 363 364 } 365 366 #endif -
trunk/Source/WebKit/UIProcess/ModelElementController.h
r286019 r286048 55 55 void getCameraForModelElement(ModelIdentifier, CompletionHandler<void(Expected<WebCore::HTMLModelElementCamera, WebCore::ResourceError>)>&&); 56 56 void setCameraForModelElement(ModelIdentifier, WebCore::HTMLModelElementCamera, CompletionHandler<void(bool)>&&); 57 void isPlayingAnimationForModelElement(ModelIdentifier, CompletionHandler<void(Expected<bool, WebCore::ResourceError>)>&&); 58 void setAnimationIsPlayingForModelElement(ModelIdentifier, bool, CompletionHandler<void(bool)>&&); 57 59 #endif 58 60 #if ENABLE(ARKIT_INLINE_PREVIEW_IOS) -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r286019 r286048 10834 10834 10835 10835 #if ENABLE(ARKIT_INLINE_PREVIEW) 10836 void WebPageProxy::modelElementGetCamera(ModelIdentifier modelIdentifier, CompletionHandler<void(Expected<WebCore::HTMLModelElementCamera, WebCore::ResourceError>)>&& completionHandler)10836 void WebPageProxy::modelElementGetCamera(ModelIdentifier modelIdentifier, CompletionHandler<void(Expected<WebCore::HTMLModelElementCamera, ResourceError>)>&& completionHandler) 10837 10837 { 10838 10838 modelElementController()->getCameraForModelElement(modelIdentifier, WTFMove(completionHandler)); … … 10842 10842 { 10843 10843 modelElementController()->setCameraForModelElement(modelIdentifier, camera, WTFMove(completionHandler)); 10844 } 10845 10846 void WebPageProxy::modelElementIsPlayingAnimation(ModelIdentifier modelIdentifier, CompletionHandler<void(Expected<bool, ResourceError>)>&& completionHandler) 10847 { 10848 modelElementController()->isPlayingAnimationForModelElement(modelIdentifier, WTFMove(completionHandler)); 10849 } 10850 10851 void WebPageProxy::modelElementSetAnimationIsPlaying(ModelIdentifier modelIdentifier, bool isPlaying, CompletionHandler<void(bool)>&& completionHandler) 10852 { 10853 modelElementController()->setAnimationIsPlayingForModelElement(modelIdentifier, isPlaying, WTFMove(completionHandler)); 10844 10854 } 10845 10855 #endif … … 10853 10863 10854 10864 #if ENABLE(ARKIT_INLINE_PREVIEW_MAC) 10855 void WebPageProxy::modelElementDidCreatePreview(const URL& url, const String& uuid, const FloatSize& size, CompletionHandler<void(Expected<std::pair<String, uint32_t>, WebCore::ResourceError>)>&& completionHandler)10865 void WebPageProxy::modelElementDidCreatePreview(const URL& url, const String& uuid, const FloatSize& size, CompletionHandler<void(Expected<std::pair<String, uint32_t>, ResourceError>)>&& completionHandler) 10856 10866 { 10857 10867 modelElementController()->modelElementDidCreatePreview(url, uuid, size, WTFMove(completionHandler)); -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r286019 r286048 591 591 void modelElementGetCamera(ModelIdentifier, CompletionHandler<void(Expected<WebCore::HTMLModelElementCamera, WebCore::ResourceError>)>&&); 592 592 void modelElementSetCamera(ModelIdentifier, WebCore::HTMLModelElementCamera, CompletionHandler<void(bool)>&&); 593 void modelElementIsPlayingAnimation(ModelIdentifier, CompletionHandler<void(Expected<bool, WebCore::ResourceError>)>&&); 594 void modelElementSetAnimationIsPlaying(ModelIdentifier, bool, CompletionHandler<void(bool)>&&); 593 595 #endif 594 596 #if ENABLE(ARKIT_INLINE_PREVIEW_IOS) -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r286019 r286048 598 598 ModelElementGetCamera(struct WebKit::ModelIdentifier modelIdentifier) -> (Expected<WebCore::HTMLModelElementCamera, WebCore::ResourceError> result) Async 599 599 ModelElementSetCamera(struct WebKit::ModelIdentifier modelIdentifier, struct WebCore::HTMLModelElementCamera camera) -> (bool success) Async 600 ModelElementIsPlayingAnimation(struct WebKit::ModelIdentifier modelIdentifier) -> (Expected<bool, WebCore::ResourceError> result) Async 601 ModelElementSetAnimationIsPlaying(struct WebKit::ModelIdentifier modelIdentifier, bool isPlaying) -> (bool success) Async 600 602 #endif 601 603 -
trunk/Source/WebKit/WebProcess/Model/ARKitInlinePreviewModelPlayer.h
r286019 r286048 55 55 void enterFullscreen() override; 56 56 void getCamera(CompletionHandler<void(std::optional<WebCore::HTMLModelElementCamera>&&)>&&) override; 57 void setCamera(WebCore::HTMLModelElementCamera, CompletionHandler<void(bool&&)>&&) override; 57 void setCamera(WebCore::HTMLModelElementCamera, CompletionHandler<void(bool success)>&&) override; 58 void isPlayingAnimation(CompletionHandler<void(std::optional<bool>&&)>&&) override; 59 void setAnimationIsPlaying(bool, CompletionHandler<void(bool success)>&&) override; 58 60 59 61 WeakPtr<WebPage> m_page; -
trunk/Source/WebKit/WebProcess/Model/ARKitInlinePreviewModelPlayer.mm
r286019 r286048 82 82 } 83 83 84 void ARKitInlinePreviewModelPlayer::setCamera(WebCore::HTMLModelElementCamera camera, CompletionHandler<void(bool &&)>&& completionHandler)84 void ARKitInlinePreviewModelPlayer::setCamera(WebCore::HTMLModelElementCamera camera, CompletionHandler<void(bool success)>&& completionHandler) 85 85 { 86 86 auto modelIdentifier = this->modelIdentifier(); … … 97 97 98 98 CompletionHandler<void(bool)> remoteCompletionHandler = [completionHandler = WTFMove(completionHandler)] (bool success) mutable { 99 completionHandler( WTFMove(success));99 completionHandler(success); 100 100 }; 101 101 … … 103 103 } 104 104 105 void ARKitInlinePreviewModelPlayer::isPlayingAnimation(CompletionHandler<void(std::optional<bool>&&)>&& completionHandler) 106 { 107 auto modelIdentifier = this->modelIdentifier(); 108 if (!modelIdentifier) { 109 completionHandler(std::nullopt); 110 return; 111 } 112 113 auto* strongPage = m_page.get(); 114 if (!strongPage) { 115 completionHandler(std::nullopt); 116 return; 117 } 118 119 CompletionHandler<void(Expected<bool, WebCore::ResourceError>)> remoteCompletionHandler = [completionHandler = WTFMove(completionHandler)] (Expected<bool, WebCore::ResourceError> result) mutable { 120 if (!result) { 121 completionHandler(std::nullopt); 122 return; 123 } 124 125 completionHandler(*result); 126 }; 127 128 strongPage->sendWithAsyncReply(Messages::WebPageProxy::ModelElementIsPlayingAnimation(*modelIdentifier), WTFMove(remoteCompletionHandler)); 129 } 130 131 void ARKitInlinePreviewModelPlayer::setAnimationIsPlaying(bool isPlaying, CompletionHandler<void(bool success)>&& completionHandler) 132 { 133 auto modelIdentifier = this->modelIdentifier(); 134 if (!modelIdentifier) { 135 completionHandler(false); 136 return; 137 } 138 139 auto* strongPage = m_page.get(); 140 if (!strongPage) { 141 completionHandler(false); 142 return; 143 } 144 145 CompletionHandler<void(bool)> remoteCompletionHandler = [completionHandler = WTFMove(completionHandler)] (bool success) mutable { 146 completionHandler(success); 147 }; 148 149 strongPage->sendWithAsyncReply(Messages::WebPageProxy::ModelElementSetAnimationIsPlaying(*modelIdentifier, isPlaying), WTFMove(remoteCompletionHandler)); 150 } 151 105 152 } 106 153
Note: See TracChangeset
for help on using the changeset viewer.