已合并
add SetOnRenderProcessDiedCallback client API for render process death notification #30442
LyBbq创建于 6月1日
add SetOnRenderProcessDiedCallback client API for render process death notification #30442
已合并
共 7 个文件变更+34-1
| @@ -22,7 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | namespace OHOS { | 23 | namespace OHOS { |
| 24 | namespace Rosen { | 24 | namespace Rosen { |
| 25 | - | 25 | +constexpr uint64_t INVALID_TOKEN_MASK_ID = 0; |
| 26 | class RSIConnectToRenderProcess : public IRemoteBroker { | 26 | class RSIConnectToRenderProcess : public IRemoteBroker { |
| 27 | public: | 27 | public: |
| 28 | DECLARE_INTERFACE_DESCRIPTOR(u"ohos.rosen.ConnectToRenderProcess"); | 28 | DECLARE_INTERFACE_DESCRIPTOR(u"ohos.rosen.ConnectToRenderProcess"); |
| @@ -26,6 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | + | ||
| 29 | 30 | ||
| 30 | 31 | ||
| 31 | 32 | ||
| @@ -221,6 +222,8 @@ public: | |||
| 221 | const FrameStabilityTarget& oldTarget, | 222 | const FrameStabilityTarget& oldTarget, |
| 222 | const FrameStabilityTarget& newTarget | 223 | const FrameStabilityTarget& newTarget |
| 223 | ); | 224 | ); |
| 225 | + | ||
| 226 | + void SetOnRenderProcessDiedCallback(const std::function<void()>& callback); | ||
| 224 | private: | 227 | private: |
| 225 | void TriggerSurfaceCaptureCallback(NodeId id, const RSSurfaceCaptureConfig& captureConfig, | 228 | void TriggerSurfaceCaptureCallback(NodeId id, const RSSurfaceCaptureConfig& captureConfig, |
| 226 | std::shared_ptr<Media::PixelMap> pixelmap, CaptureError captureErrorCode, | 229 | std::shared_ptr<Media::PixelMap> pixelmap, CaptureError captureErrorCode, |
| @@ -278,6 +281,7 @@ private: | |||
| 278 | 281 | ||
| 279 | sptr<RSIClientToRenderConnection> clientToRenderConnection_; | 282 | sptr<RSIClientToRenderConnection> clientToRenderConnection_; |
| 280 | sptr<RSIConnectionToken> token_; | 283 | sptr<RSIConnectionToken> token_; |
| 284 | + uint64_t tokenMaskId_ = INVALID_TOKEN_MASK_ID; | ||
| 281 | 285 | ||
| 282 | friend class SurfaceCaptureCallbackDirector; | 286 | friend class SurfaceCaptureCallbackDirector; |
| 283 | friend class SurfaceBufferCallbackDirector; | 287 | friend class SurfaceBufferCallbackDirector; |
| @@ -28,6 +28,10 @@ RSRenderPipelineClient::RSRenderPipelineClient(sptr<IRemoteObject>& connectToRen | |||
| 28 | { | 28 | { |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | +void RSRenderPipelineClient::SetOnRenderProcessDiedCallback(const std::function<void()>& callback) | ||
| 32 | +{ | ||
| 33 | +} | ||
| 34 | + | ||
| 31 | void RSRenderPipelineClient::CommitTransaction(std::unique_ptr<RSTransactionData>& transactionData) | 35 | void RSRenderPipelineClient::CommitTransaction(std::unique_ptr<RSTransactionData>& transactionData) |
| 32 | { | 36 | { |
| 33 | } | 37 | } |
| @@ -87,6 +87,10 @@ RSRenderPipelineClient::RSRenderPipelineClient(sptr<IRemoteObject>& connectToRen | |||
| 87 | } | 87 | } |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | +void RSRenderPipelineClient::SetOnRenderProcessDiedCallback(const std::function<void()>& callback) | ||
| 91 | +{ | ||
| 92 | +} | ||
| 93 | + | ||
| 90 | void RSRenderPipelineClient::CommitTransaction(std::unique_ptr<RSTransactionData>& transactionData) | 94 | void RSRenderPipelineClient::CommitTransaction(std::unique_ptr<RSTransactionData>& transactionData) |
| 91 | { | 95 | { |
| 92 | if (clientToRenderConnection_ != nullptr) { | 96 | if (clientToRenderConnection_ != nullptr) { |
| @@ -28,6 +28,10 @@ RSRenderPipelineClient::RSRenderPipelineClient(sptr<IRemoteObject>& connectToRen | |||
| 28 | { | 28 | { |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | +void RSRenderPipelineClient::SetOnRenderProcessDiedCallback(const std::function<void()>& callback) | ||
| 32 | +{ | ||
| 33 | +} | ||
| 34 | + | ||
| 31 | void RSRenderPipelineClient::CommitTransaction(std::unique_ptr<RSTransactionData>& transactionData) | 35 | void RSRenderPipelineClient::CommitTransaction(std::unique_ptr<RSTransactionData>& transactionData) |
| 32 | { | 36 | { |
| 33 | } | 37 | } |
| @@ -650,5 +650,14 @@ void RSRenderInterface::SetFreeMultiWindowStatus(bool enable) | |||
| 650 | { | 650 | { |
| 651 | renderPipelineClient_->SetFreeMultiWindowStatus(enable); | 651 | renderPipelineClient_->SetFreeMultiWindowStatus(enable); |
| 652 | } | 652 | } |
| 653 | + | ||
| 654 | +void RSRenderInterface::SetOnRenderProcessDiedCallback(const std::function<void()>& callback) | ||
| 655 | +{ | ||
| 656 | + if (renderPipelineClient_ == nullptr) { | ||
| 657 | + ROSEN_LOGE("RSRenderInterface::SetOnRenderProcessDiedCallback renderPipelineClient_ nullptr"); | ||
| 658 | + return; | ||
| 659 | + } | ||
| 660 | + renderPipelineClient_->SetOnRenderProcessDiedCallback(callback); | ||
| 661 | +} | ||
| 653 | } | 662 | } |
| 654 | } | 663 | } |
| @@ -462,6 +462,14 @@ public: | |||
| 462 | */ | 462 | */ |
| 463 | void SetFreeMultiWindowStatus(bool enable); | 463 | void SetFreeMultiWindowStatus(bool enable); |
| 464 | 464 | ||
| 465 | + /** | ||
| 466 | + * @brief Set callback for render process died event. | ||
| 467 | + * @param callback Callback function triggered when render process dies. | ||
| 468 | + * @note The callback may be invoked from a different thread. Callers must ensure | ||
| 469 | + * that variables accessed within the callback are thread-safe. | ||
| 470 | + */ | ||
| 471 | + void SetOnRenderProcessDiedCallback(const std::function<void()>& callback); | ||
| 472 | + | ||
| 465 | private: | 473 | private: |
| 466 | RSRenderInterface(); | 474 | RSRenderInterface(); |
| 467 | RSRenderInterface(sptr<IRemoteObject>& connectToRenderRemote); | 475 | RSRenderInterface(sptr<IRemoteObject>& connectToRenderRemote); |