Skyline调研

一、JavascriptCore介绍

JavaScriptCore是一个在WebKit中提供JavaScript引擎的框架,而且在OS X作为其他内容的脚本引擎。JavaScriptCore最初是为KDE的JavaScript引擎(KJS)库及PCRE正则表达式库,JavaScriptCore从KJS及PCRE复刻之后,已比原先进步了许多,有了新的特色以及极大的性能改进。

WebCore

WebCore是一个由WebKit项目所开发的布局(Layout)、渲染(Rendering)及HTML和SVG的DOM库,完整的代码皆由GNU宽通用公共许可证所授权,WebKit框架包装了WebCore及JavaScriptCore(Nitro),并提供一个Objective-C应用程序接口来接介由C++所开发的WebCore渲染引擎及JavaScriptCore脚本引擎,透过Cocoa API就可以在应用程序中很简单的使用这些组件。之后的版本同时包含了一个跨平台的C++抽象平台,并且提供各种API使用。

WebKit中渲染采用CoreGraphics,相对Skia未利用到GPU加速能力,性能较差。

image.png
Nitro(SFX)

在2008年6月2日,WebKit项目宣布,JavaScriptCore将被重写为"SquirrelFish",它是一个字节码解释器,这个项目演变成SquirrelFish Extreme(简称为SFX,市场称之为Nitro),首次公开于2008年9月18日,它会将Javascript编译为本地的机器语言,不再需要字节码解释器,同时加速了JavaScript的执行效率。

2009年6月30日,在Firefox 3.5发布的最新技术能“使某些情况下的速度提升20到40倍”。

从Safari 4 Beta开始采用,在Safari 5中进行了优化。

在Safari 5刚发布时,Nitro在Mac上执行JavaScript的速度比之前Safari 4快40%,比Chrome 5快3%,并且是Firefox 3.6的两倍以上。

JIT

JIT(Just In Time)编译器:是指程序逻辑以代码(或字节码)形式下发到目标机(如客户端)上,在系统即将运行此逻辑的前一刻,目标机系统上的编译器才将这些代码编译成机器指令,然后再交给系统执行。因为它的编译发生成运行前一刻,刚刚能赶得上执行,所以叫做Just In Time编译器。

JavascriptCore framework

iOS中WebKit使用的js解释引擎是Nitro(或者叫做重写的JavascriptCore)。但内置JavascriptCore framework是个阉割版本,不支持JIT及WASM,setTimeout等。因为不支持JIT,通信性能表现略差。

JSI

JSI 的全称是 JavaScript Interface,即 JS Interface 接口,它是对 JS引擎 与 Native (C++) 之间相互调用的封装,通过 HostObject 接口实现双边映射,官方也称它为映射框架。

有了这层封装,在 ReactNative 中有了两方面的提升:

可以自由切换引擎,比如: JavaScriptCore、V8、Hermes等。
在 JS 中调用 C++ 注入到 JS 引擎中的方法,数据载体格式是通过 HostObject 接口规范化后的,摒弃了旧架构中以 JSON 作为数据载体的异步机制,从而使得 JS 与 Native 之间的调用可以实现同步感知。

JSI 与 JSC(不是JavaScriptCore脚本引擎) 对比

相同点:

首先在底层实现上来说,JSI 与 JSC 都是通过向 JS 引擎中注入方法,来实现的 JS 与 Native 通信,同时 注入的方法也都是挂载到了 JS global 全局对象上面。

不同点:

旧架构中的 JSC 处理的注入对象是JSON 对象与C++ 对象,内部涉及复杂且频繁的类型转换。且在

JSBridge 这种异步传输的设计中存在三个线程之间的通信:UI线程、Layout线程、JS线程,在典型的列表快速滑动时出现空白页的例子中,效率低下得到明显的体现。

而对于 JSI 来讲,弃用了异步的bridge,传输的数据也不再依赖于 JSON 的数据格式,而是将HostObject 接口作为了双边通信的协议,实现了双边同步通信下的高效信息传输。

另外编写 NativeModule 的方式与旧架构中相比发生了改变,除了功能之外的逻辑,需要在一个 C++ 类中来完成。 因此,一个 TurboModule 的实现分为两部分: C++ & Java (OC)。

一句话概括 JSI 提效的本质: JSI 实现了通信桥 Bridge 的自定义,并通过 HostObjec 接口协议的方式取代了 旧架构中基于异步 bridge 的JSON数据结构,从而实现了同步通信,并且避免了 JSON 序列化与反序列化的繁琐操作,大大提升了 JS 与 Native 的通信效率。

重点总结

WebKit(WKWebView)的一个缺点是渲染是通过CoreGraphics实现,CoreGraphics渲染主要运算工作在CPU运行,并没有充分利用GPU的硬件加速能力。因此在一些复杂或者大量的图形绘制任务时表现性能比较差。像flutter的渲染是通过skia完成,相比webkit提升了渲染能力。(可参考:webGL调研(iOS渲染原理)

WebKit的另一个缺点是过于庞大,加载慢。目前小程序每个页面都创建对应的一个webview,会造成很大的性能浪费。

WebKit内置的JSCore是支持JIT,但是对外提供的JSCore framework却不支持JIT,所以这导致了JSCore framework在通信上的表现比较差。

参考资料:

https://zh.wikipedia.org/wiki/WebKit

https://zh.wikipedia.org/wiki/JavaScript%E5%BC%95%E6%93%8E#%E5%81%9C%E6%AD%A2%E9%96%8B%E7%99%BC

https://trac.webkit.org/browser/webkit/trunk/Source/JavaScriptCore?order=name

https://trac.webkit.org/wiki/JavaScriptCore

https://www.jianshu.com/p/b5c6207edb98/

https://blog.51cto.com/u_11887782/5848984

https://blog.csdn.net/m0_49508485/article/details/122622251

二、Skyline介绍

介绍:https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html

三、Skyline分析

下图为未使用Skyline的小程序视图层级:

image.png

下图为使用了Skyline的微信小程序视图层级:

image.png

下面两图为基本的flutter iOS原生混合项目的内存计数及视图层级:

image.png

image.png

WAFlutterViewController继承自FlutterViewController。

@interface WAFlutterViewController : FlutterViewController

可以得出:

  1. Flutter开头的相关类都是flutter自动生成,包括FlutterView,FlutterViewController,FlutterEngine等,而不是微信自身实现。
  2. 微信Skyline用SkylineView代替了webview,但skylineView的渲染都是由flutter自身实现。

支持skyline的版本中,pageVC中增加了一个skylineView属性,比起webView多支持IWASkylineView接口:

@property(retain, nonatomic) UIView<YYWebViewInterface> *webView;

@property(retain, nonatomic) UIView<IWASkylineView><YYWebViewInterface> *skylineView;

pageVC中和Skyline相关的方法及用法(个人理解):

处理路由事件navigateBack

- (void)notifySkylineNavigateBack:(long long)arg1 animated:(_Bool)arg2;

自动处理ReLaunch路由事件
- (void)notifySkylineAutoReLaunch;

处理ReLaunch路由事件
- (void)notifySkylineReLaunch;

处理RedirectTo路由事件
- (void)notifySkylineRedirectTo;

处理NavigateTo路由事件
- (void)notifySkylineNavigateTo;

处理暗黑模式变化
- (void)notifySkylineDarkModeUpdate;

处理SwitchTab
- (void)notifySkylineSwitchTab;

处理AppLaunch
- (void)notifySkylineAppLaunch;

获取Skyline相关页面数据
- (id)getSkylineSinglePageData:(_Bool)arg1;

设置Skyline相关页面数据
- (void)setSkylineSinglePageRouteData:(id)arg1;

找回skyline View?
- (void)findBackSkylineView;

IWASkylineView接口定位如下:

@protocol IWASkylineView
@property(nonatomic) _Bool innerPopAnim;
@property(nonatomic) long long innerPopCnt;
@property(nonatomic) _Bool isNewEngineHomePage;
@property(readonly, nonatomic) _Bool isReady;
@property(readonly, nonatomic) long long windowId;
@property(nonatomic) __weak id <IWASkylineRuntime> skylineRuntime;
- (void)snapshotEnd;
- (void)snapshotBegin;
- (UIImage *)snapshotSkyline;
- (void)removeNativeView:(long long)arg1;
- (void)insertNativeView:(UIView *)arg1 viewId:(long long)arg2;
- (void)startMoveViewToOldPage;
- (void)startMoveViewToNewPage;
@end

WASkylineView的声明如下,可以看到还实现了FlutterEngineDelegate,说明内部渲染应该是通过flutter引擎实现。

@interface WASkylineView : UIView <FlutterEngineDelegate, IWASkylineView, YYWebViewInterface>

skyline处理在页面跳转时,函数调用栈如下。loadIndexData会在执行IndexData之前,发送路由事件并通知skylineView。

image.png

小程序进入新页面会分别交给skylineView执行5个脚本。

从方法名来看分别是mainPluginPageFrame,MainModuleSharedCommonJS,文件moduleScriptData,和之前发给webview作为page层的js基本上一致。

image.png

image.png

image.png

skylineView持有了 WASkyLineRuntime的弱引用,强引用持有了WAFlutterViewController。

从视图层级可以看出,skylineView addSubView: WAFlutterViewController.FlutterView(伪代码)。

@property(nonatomic) __weak WASkyLineRuntime *runtime; // @synthesize runtime=_runtime;
@property(nonatomic) __weak id <IWASkylineRuntime> skylineRuntime; // @synthesize skylineRuntime=_skylineRuntime;@property(retain, nonatomic) WAFlutterViewController *flutterVC; // @synthesize flutterVC=_flutterVC

目前实现IWASkylineRuntime接口的类只有WASkyLineRuntime。

@interface WASkyLineRuntime : NSObject <IWASkylineRuntime>

分析:

skylineView在收到js脚本后,从逆向来看并未交给其它OC类来进行处理,个人认为可能调用了C/C++代码进行解析(因为逆向暂时获取不到C/C++方法)。C/C++解析后的结果再交给Flutter进行渲染。

JSCore的预创建
微信启动到聊天页面,还未进入小程序前,JSCoreService已经被创建((WAJSCoreService *)0x129b53cd0)。

image.png

服务中心MMServiceCenter管理微信内的所有服务:

@interface MMServiceCenter : NSObject
{
NSMutableDictionary *m_dictService;

}

服务如下,其中包括WAPreloadAppTaskMgr,小程序预加载任务管理服务。

每个服务受到了MMServiceWrapper包裹,并在MMServiceWrapper内重写了消息转发,将消息转发给WAPreloadAppTaskMgr。

{

    UpdateProfileMgr = "<UpdateProfileMgr: 0x281d4bcc0>";
    WCCommonService = "<WCCommonService: 0x280b2c9c0>";
    MultiTalkSessionMgr = "<MultiTalkSessionMgr: 0x286561d60>";
    WCTimelineTrashMgr = "<WCTimelineTrashMgr: 0x282631900>";
    WCLabsMgr = "<WCLabsMgr: 0x282cd46c0>";
    TrackRoomMgr = "<TrackRoomMgr: 0x28312eb50>";
    MMWebPrefetcherMgr = "<MMWebPrefetcherMgr: 0x282e71260>";
    WAConfigMgr = "<WAConfigMgr: 0x28390a940>";
    WCPayLogicMgr = "<WCPayLogicMgr: 0x12e637a00>";
    EmoticonInputRecommendMgr = "<EmoticonInputRecommendMgr: 0x28314ab50>";
    WXCTalkMgr = "<WXCTalkMgr: 0x283f6a760>";
    WCTextStateDB = "<WCTextStateDB: 0x282cdfa80>";
    MMClientCacheManager = "<MMClientCacheManager: 0x280adb510>";
    OpenApiMgr = "<OpenApiMgr: 0x11e4d59e0>";
    VoIPOrientationService = "<VoIPOrientationService: 0x281d97300>";
    MMMsgRemindReporter = "<MMMsgRemindReporter: 0x282c9ad00>";
    MMFICImageCache = "<MMFICImageCache: 0x2811038a0>";
    QuickReplyMsgMgr = "<QuickReplyMsgMgr: 0x282d499d0>";
    WAContactMgr = "<WAContactMgr: 0x282e51c70>";
    CdnComMgr = "<CdnComMgr: 0x2826340a0>";
    MMTextLayoutManager = "<MMTextLayoutManager: 0x283730b40>";
    WCSiriMgr = "<WCSiriMgr: 0x28656d3b0>";
    RebootWarningService = "<RebootWarningService: 0x28023e1a0>";
    MMNewSessionMgr = "<MMNewSessionMgr: 0x283d36f20>";
    WAPackageDownloadUrlFetcher = "<WAPackageDownloadUrlFetcher: 0x2865a75c0>";
    WCFinderVideoDownLoadMgr = "<WCFinderVideoDownLoadMgr: 0x283d43cf0>";
    WCTempChatMgr = "<WCTempChatMgr: 0x281c8a380>";
    WCFinderSyncReportMgr = "<WCFinderSyncReportMgr: 0x2865096d0>";
    WCGroupUndoneMgr = "<WCGroupUndoneMgr: 0x28657db30>";
    FTSFacade = "<FTSFacade: 0x283f26920>";
    WCAdvertiseLogMgr = "<WCAdvertiseLogMgr: 0x28650ab20>";
    VoIPRMRemoteService = "<VoIPRMRemoteService: 0x281d96e80>";
    MsgVideoPreloadMgr = "<MsgVideoPreloadMgr: 0x28004d5e0>";
    WASessionMgr = "<WASessionMgr: 0x2811ce2b0>";
    MMFinderLiveGiftResourceCDNMgr = "<MMFinderLiveGiftResourceCDNMgr: 0x282dabd40>";
    WCWebSearchService = "<WCWebSearchService: 0x282d32a00>";
    MiniTaskUIMgr = "<MiniTaskUIMgr: 0x282ca5740>";
    CheckMobileSIMType = "<CheckMobileSIMType: 0x2825d2fd0>";
    EventService = "<EventService: 0x281d1f6c0>";
    WeVisModelResMgr = "<WeVisModelResMgr: 0x28024f5c0>";
    TingManager = "<TingManager: 0x283731040>";
    KFContactMgr = "<KFContactMgr: 0x281c8a340>";
    MinimizeRecMgr = "<MinimizeRecMgr: 0x286583070>";
    WXCTalkPresentMgr = "<WXCTalkPresentMgr: 0x281c9ddc0>";
    WAPublicResCacheMgr = "<WAPublicResCacheMgr: 0x28344ba80>";
    WXTalkPresentMgr = "<WXTalkPresentMgr: 0x281012d90>";
    WCFinderReportService = "<WCFinderReportService: 0x286508f00>";
    WCDurationLogMgr = "<WCDurationLogMgr: 0x281cb8700>";
    MMShareExtMgr = "<MMShareExtMgr: 0x2825bce60>";
    FriendAsistSessionMgr = "<FriendAsistSessionMgr: 0x2811494a0>";
    AppDataMgr = "<AppDataMgr: 0x283147910>";
    VOIPMgr = "<VOIPMgr: 0x11eb8f000>";
    WXGRoamService = "<WXGRoamService: 0x282929e00>";
    MMWebViewKeepHolderMgr = "<MMWebViewKeepHolderMgr: 0x28372a080>";
    MainFrameGroupLiveReporter = "<MainFrameGroupLiveReporter: 0x28112b570>";
    EnterpriseBrandContactMgr = "<EnterpriseBrandContactMgr: 0x2800433c0>";
    WCCardPkgMgr = "<WCCardPkgMgr: 0x2833c2580>";
    CContactMgr = "<CContactMgr: 0x2831109a0>";
    MagicPkgCheckListener = "<MagicPkgCheckListener: 0x281d26080>";
    VoIPMSService = "<VoIPMSService: 0x286581540>";
    WCDeviceBrandMgr = "<WCDeviceBrandMgr: 0x28332bcc0>";
    NewSyncPluginMgr = "<NewSyncPluginMgr: 0x2811862b0>";
    WCDeviceAccountMgr = "<WCDeviceAccountMgr: 0x281148930>";
    MMOnlineDeviceStatusMgr = "<MMOnlineDeviceStatusMgr: 0x28260d2c0>";
    StoreEmotionBackupMgr = "<StoreEmotionBackupMgr: 0x2811a2ca0>";
    ExptService = "<ExptService: 0x28287b480>";
    SendMessageMgr = "<SendMessageMgr: 0x282cfd140>";
    EmoticonCameraRecoverMgr = "<EmoticonCameraRecoverMgr: 0x281d9d340>";
    MMWebDebugPkgMgr = "<MMWebDebugPkgMgr: 0x2811cbe70>";
    VoIPEventLogService = "<VoIPEventLogService: 0x2802329e0>";
    IDCHostMgr = "<IDCHostMgr: 0x281d97240>";
    WCFinderLongVideoService = "<WCFinderLongVideoService: 0x281d9ca00>";
    MiniGameVideoService = "<MiniGameVideoService: 0x281d24940>";
    HeartBeatMgr = "<HeartBeatMgr: 0x281d94100>";
    MMNewTipsMgr = "<MMNewTipsMgr: 0x281ceda40>";
    WeVisSettingsMgr = "<WeVisSettingsMgr: 0x282dbd180>";
    QQMailMgr = "<QQMailMgr: 0x286589e50>";
    VoiceReminderMgr = "<VoiceReminderMgr: 0x2811cca50>";
    WACacheVersionPreCheckerMgr = "<WACacheVersionPreCheckerMgr: 0x2865b0230>";
    MPPageMessageMgr = "<MPPageMessageMgr: 0x2811cc150>";
    WCJdBussinessMgr = "<WCJdBussinessMgr: 0x281cb2900>";
    GameCenterManager = "<GameCenterManager: 0x283a2d500>";
    StoreEmotionRecoverMgr = "<StoreEmotionRecoverMgr: 0x282cf5fe0>";
    MMLiveDBMgr = "<MMLiveDBMgr: 0x280912fa0>";
    WCFinderDataService = "<WCFinderDataService: 0x11e4dacd0>";
    BrandNewSessionMgr = "<BrandNewSessionMgr: 0x282cf7cc0>";
    MMSUserBehaviorMgr = "<MMSUserBehaviorMgr: 0x2801dce80>";
    AudioReceiver = "<AudioReceiver: 0x281d26200>";
    WADatabaseMgr = "<WADatabaseMgr: 0x283a64c00>";
    WCSessionFlowMgr = "<WCSessionFlowMgr: 0x283d255f0>";
    FavoritesMgr = "<FavoritesMgr: 0x2833692c0>";
    MinimizeTaskMgr = "<MinimizeTaskMgr: 0x283399a40>";
    MMEnterpriseBrandSessionMgr = "<MMEnterpriseBrandSessionMgr: 0x2811cc120>";
    CGroupMgr = "<CGroupMgr: 0x2828d1000>";
    WALoadPerformanceMgr = "<WALoadPerformanceMgr: 0x2862218c0>";
    MMGroupLiveDBMgr = "<MMGroupLiveDBMgr: 0x2817ea4c0>";
    MMPackageDownloadMgr = "<MMPackageDownloadMgr: 0x2825d33e0>";
    StrongNotificationMgr = "<StrongNotificationMgr: 0x282275b00>";
    MMFinderLiveRewardDBMgr = "<MMFinderLiveRewardDBMgr: 0x280913420>";
    WCHardLinkService = "<WCHardLinkService: 0x28122e2e0>";
    NewSyncService = "<NewSyncService: 0x282882a00>";
    BrandSessionMgr = "<BrandSessionMgr: 0x282cf7240>";
    MMFinderLiveMgr = "<MMFinderLiveMgr: 0x283735220>";
    WCWatchNativeMgr = "<WCWatchNativeMgr: 0x2822704e0>";
    BrandTLCanvasCardMgr = "<BrandTLCanvasCardMgr: 0x281248d80>";
    ChatBoxMgr = "<ChatBoxMgr: 0x281d893c0>";
    TemplateSessionMgr = "<TemplateSessionMgr: 0x282da9ea0>";
    BrandAttrMgr = "<BrandAttrMgr: 0x281d9f600>";
    SearchCgiConfigMgr = "<SearchCgiConfigMgr: 0x281d49c00>";
    WeVisionCameraLogger = "<WeVisionCameraLogger: 0x28024f6c0>";
    WCPaySynthesizeSpeechMgr = "<WCPaySynthesizeSpeechMgr: 0x2825d0410>";
    ImageAutoDownloadMgr = "<ImageAutoDownloadMgr: 0x286588140>";
    MPChannelMgr = "<MPChannelMgr: 0x28112a640>";
    FunctionMsgMgr = "<FunctionMsgMgr: 0x281c95940>";
    "WeChat.GOGService" = "<WeChat.GOGService: 0x281056850>";
    OCRTransMgr = "<OCRTransMgr: 0x2825d2bc0>";
    CMessageMgr = "<CMessageMgr: 0x12e420300>";
    WCAudioSessionLogic = "<WCAudioSessionLogic: 0x280769260>";
    WCRedEnvelopesControlMgr = "<WCRedEnvelopesControlMgr: 0x281138a80>";
    iAPMgr = "<iAPMgr: 0x28656a580>";
    MMHeavyUserMonitorMgr = "<MMHeavyUserMonitorMgr: 0x282d174f0>";
    WCSessionFlowMonitorService = "<WCSessionFlowMonitorService: 0x282d47330>";
    WXGBackupMgr = "<WXGBackupMgr: 0x283f0a840>";
    NotificationActionsMgr = "<NotificationActionsMgr: 0x286515c20>";
    DeviceILinkService = "<DeviceILinkService: 0x281d97ec0>";
    WCNewClickStatMgr = "<WCNewClickStatMgr: 0x283434ea0>";
    MMLiteAppDBMgr = "<MMLiteAppDBMgr: 0x2825f4820>";
    WACommonMarkMgr = "<WACommonMarkMgr: 0x280a3a010>";
    WCAutoSaveService = "<WCAutoSaveService: 0x280773a40>";
    TokenRegisterService = "<TokenRegisterService: 0x28650ac10>";
    MMWindowMgr = "<MMWindowMgr: 0x28105ba50>";
    PushLoginURLMgr = "<PushLoginURLMgr: 0x280ae4fc0>";
    GameCenterCommonDb = "<GameCenterCommonDb: 0x280b1fa50>";
    SystemAuthorizationCheck = "<SystemAuthorizationCheck: 0x2800aeda0>";
    DarkModeManager = "<DarkModeManager: 0x2817292c0>";
    MMAuthService = "<MMAuthService: 0x28227cb40>";
    VoIPFirstMessageStatisticsService = "<VoIPFirstMessageStatisticsService: 0x280adb870>";
    MMConfigMgr = "<MMConfigMgr: 0x282d46d80>";
    NewArrivalCountMgr = "<NewArrivalCountMgr: 0x2811cc720>";
    WCGPUCounterSamplingMgr = "<WCGPUCounterSamplingMgr: 0x282c9daa0>";
    DeviceModelConfigMgr = "<DeviceModelConfigMgr: 0x281158780>";
    WWKFSessionMgr = "<WWKFSessionMgr: 0x2811cda40>";
    WCTopicService = "<WCTopicService: 0x282c9b000>";
    MMGroupLiveMgr = "<MMGroupLiveMgr: 0x286578ff0>";
    MMConfSDKService = "<MMConfSDKService: 0x12e4adb90>";
    MMLiveReportEventMgr = "<MMLiveReportEventMgr: 0x281035e60>";
    AccountStorageMgr = "<AccountStorageMgr: 0x28227c780>";
    FingertipSearchMgr = "<FingertipSearchMgr: 0x282642a80>";
    MMHeadImageMgr = "<MMHeadImageMgr: 0x281d0a380>";
    EnterpriseSessionMgr = "<EnterpriseSessionMgr: 0x286589d10>";
    PresentHelperMgr = "<PresentHelperMgr: 0x280ac6700>";
    MainSessionMgr = "<MainSessionMgr: 0x28260ce10>";
    TextStateMgr = "<TextStateMgr: 0x283f457a0>";
    SolitaireMgr = "<SolitaireMgr: 0x2825d3250>";
    MonoServiceMsgMgr = "<MonoServiceMsgMgr: 0x2825f7930>";
    BannerToastMgr = "<BannerToastMgr: 0x2813d0940>";
    AutoSetRemarkMgr = "<AutoSetRemarkMgr: 0x286554eb0>";
    FavoritesOnTopLogic = "<FavoritesOnTopLogic: 0x2813d0480>";
    VoIPPMService = "<VoIPPMService: 0x282dbd880>";
    WePkgFacade = "<WePkgFacade: 0x283145130>";
    DataReportExposeMonitor = "<DataReportExposeMonitor: 0x28313eec0>";
    MuteBrandMgr = "<MuteBrandMgr: 0x2811bba20>";
    MsgSolitaireDB = "<MsgSolitaireDB: 0x281d77380>";
    MMDBMigrationUtil = "<MMDBMigrationUtil: 0x280aeb450>";
    IntelligentMsgImgConfigurationMgr = "<IntelligentMsgImgConfigurationMgr: 0x281cfd5c0>";
    EmoticonRecommendMgr = "<EmoticonRecommendMgr: 0x281d25280>";
    DataReportPageConfig = "<DataReportPageConfig: 0x281d4b440>";
    WCCalRqtDataMgr = "<WCCalRqtDataMgr: 0x280165b00>";
    WAProfileService = "<WAProfileService: 0x281e3f800>";
    WALaunchTimeAxisMgr = "<WALaunchTimeAxisMgr: 0x282913e00>";
    MMResPackageMgr = "<MMResPackageMgr: 0x281149470>";
    WCFileBrowseService = "<WCFileBrowseService: 0x2828cc880>";
    MMMusicPlayerMgr = "<MMMusicPlayerMgr: 0x28344a1c0>";
    VOIPMessageMgr = "<VOIPMessageMgr: 0x2811cc000>";
    EnterpriseMsgMgr = "<EnterpriseMsgMgr: 0x282927180>";
    WXGMigrationClientMgr = "<WXGMigrationClientMgr: 0x283d37260>";
    BrandFinderLiveMgr = "<BrandFinderLiveMgr: 0x2828c3e80>";
    WALaunchResourceFetcher = "<WALaunchResourceFetcher: 0x281248480>";
    EmoticonBackUpMgr = "<EmoticonBackUpMgr: 0x281d9d100>";
    "WeChat.Kara" = "<WeChat.Kara: 0x2817fccc0>";
    WABackgroundFetchMgr = "<WABackgroundFetchMgr: 0x2801dcf80>";
    WePkgStatReport = "<WePkgStatReport: 0x280add590>";
    WCTuringMgr = "<WCTuringMgr: 0x28111b750>";
    AUAudioDevice = "<AUAudioDevice: 0x12e4639b0>";
    WCOutFacade = "<WCOutFacade: 0x283151290>";
    MMLanguagePackageDownloadMgr = "<MMLanguagePackageDownloadMgr: 0x281155860>";
    GameLifeDataService = "<GameLifeDataService: 0x286588af0>";
    WAOpenEventSpeedStatMgr = "<WAOpenEventSpeedStatMgr: 0x283a69f00>";
    WCNearbyMgr = "<WCNearbyMgr: 0x281145530>";
    BrandTimelineMsgMgr = "<BrandTimelineMsgMgr: 0x12e60c8f0>";
    VideoRingAudioFileProducer = "<VideoRingAudioFileProducer: 0x281daec40>";
    "WeChat.PredownloadService" = "<WeChat.PredownloadService: 0x281035b00>";
    VOIPModelResMgr = "<VOIPModelResMgr: 0x280230f80>";
    SightFacade = "<SightFacade: 0x28391e940>";
    VoipCSUIManager = "<VoipCSUIManager: 0x281d74340>";
    MMLocationMgr = "<MMLocationMgr: 0x282894100>";
    MMWebCanvasPkgMgr = "<MMWebCanvasPkgMgr: 0x281e2e500>";
    WAAppItemManager = "<WAAppItemManager: 0x281c9d4c0>";
    VoIPMiniInAppService = "<VoIPMiniInAppService: 0x281d978c0>";
    MMDiskUsageMgr = "<MMDiskUsageMgr: 0x282ca4a20>";
    WAPreloadAppTaskMgr = "<WAPreloadAppTaskMgr: 0x281260ae0>";
    MainFrameHideSessionReporter = "<MainFrameHideSessionReporter: 0x28652f7a0>";
    MMLiteAppMgr = "<MMLiteAppMgr: 0x283430120>";
    WSRecommendMgr = "<WSRecommendMgr: 0x283f4c000>";
    KindaBizMgr = "<KindaBizMgr: 0x280a81b00>";
    WCSettingRedPointMgr = "<WCSettingRedPointMgr: 0x28113d590>";
    DataReportService = "<DataReportService: 0x282d46fb0>";
    WCUpdateBootsMgr = "<WCUpdateBootsMgr: 0x281d25d80>";
    WAAppTaskMgr = "<WAAppTaskMgr: 0x28342de60>";
    EdgeComputingMgr = "<EdgeComputingMgr: 0x282d3aca0>";
    MMLiveTaskMgr = "<MMLiveTaskMgr: 0x12e63ac30>";
    MMMyChatRoomSessionMgr = "<MMMyChatRoomSessionMgr: 0x281066c70>";
    VoipUIManager = "<VoipUIManager: 0x11e4ac4c0>";
    MMUserDataOperateDB = "<MMUserDataOperateDB: 0x280b45590>";
    WXCNetWorkEngine = "<WXCNetWorkEngine: 0x2813c9440>";
    BrandService = "<BrandService: 0x282d46530>";
    MultiTalkMgr = "<MultiTalkMgr: 0x12e46a0d0>";
    WALocalCacheMgr = "<WALocalCacheMgr: 0x281e4b980>";
    WCAccountControlMgr = "<WCAccountControlMgr: 0x282d3f480>";
    WXGMigrationMgr = "<WXGMigrationMgr: 0x28650aad0>";
    WAUpdatableMsgMgr = "<WAUpdatableMsgMgr: 0x2811cca80>";
    MMLiveResUpdateMgr = "<MMLiveResUpdateMgr: 0x280913450>";
    WCMomentsMediaPredictor = "<WCMomentsMediaPredictor: 0x280b217a0>";
    WCCoinMgr = "<WCCoinMgr: 0x2813b7f40>";
    TrackPresentMgr = "<TrackPresentMgr: 0x28103cc30>";
    MonoServiceMgr = "<MonoServiceMgr: 0x286580fa0>";
    WCPreparedUpdateMgr = "<WCPreparedUpdateMgr: 0x281035a10>";
    AudioSender = "<AudioSender: 0x282c9c9c0>";
    FavoritesFileMgr = "<FavoritesFileMgr: 0x281782a30>";
    MMWebJsWAPkgMgr = "<MMWebJsWAPkgMgr: 0x2812a1c50>";
    CNetworkStatusMgr = "<CNetworkStatusMgr: 0x282882980>";
    BypSyncService = "<BypSyncService: 0x282cecfc0>";
    WACampusVoipMsgMgr = "<WACampusVoipMsgMgr: 0x2825f6530>";
    MainFrameCellDataManager = "<MainFrameCellDataManager: 0x280acb330>";
    WCCanvasDownloadMgr = "<WCCanvasDownloadMgr: 0x28004f8a0>";
    WCFacade = "<WCFacade: 0x11e79dbc0>";
    WCMallLogicMgr = "<WCMallLogicMgr: 0x281d25b40>";
    PublicWifiManager = "<PublicWifiManager: 0x2833118c0>";
    CEmoticonMgr = "<CEmoticonMgr: 0x2865399a0>";
    WCFinderMsgSessionMgr = "<WCFinderMsgSessionMgr: 0x282e374f0>";
    NewABTestLogic = "<NewABTestLogic: 0x281cc5d00>";
    FavWebCacheMgr = "<FavWebCacheMgr: 0x283734aa0>";
    WAPrefetchMgr = "<WAPrefetchMgr: 0x282e32990>";
    MMAddressBookMgr = "<MMAddressBookMgr: 0x282cb9a40>";
    DataReportMultiEventMonitor = "<DataReportMultiEventMonitor: 0x280a74b70>";
    MsgUploadRetryMgr = "<MsgUploadRetryMgr: 0x281197bd0>";
    WCPayReporter = "<WCPayReporter: 0x286582d50>";
    WCSessionDataReporter = "<WCSessionDataReporter: 0x28342ee20>";
    WCShareCardMgr = "<WCShareCardMgr: 0x28292f900>";
    MMLiveMgr = "<MMLiveMgr: 0x281da0fc0>";
    MainSessionReporter = "<MainSessionReporter: 0x282ca40c0>";
    IlinkAppContextService = "<IlinkAppContextService: 0x281d95a00>";
    VideoRingDataService = "<VideoRingDataService: 0x282d3dff0>";
    EmoticonPackageMgr = "<EmoticonPackageMgr: 0x28653ab20>";
    WCFinderSyncManager = "<WCFinderSyncManager: 0x281d10b00>";
    OnlineClientMgr = "<OnlineClientMgr: 0x28343f060>";
    VoIPTerminationService = "<VoIPTerminationService: 0x281051320>";
    WATemplateMsgManager = "<WATemplateMsgManager: 0x282286ca0>";
    WABluetoothDeviceMonitorMgr = "<WABluetoothDeviceMonitorMgr: 0x286580eb0>";
    ScanQRCodeResultsMgr = "<ScanQRCodeResultsMgr: 0x281d76f00>";
    VoIPAPNSPushSyncService = "<VoIPAPNSPushSyncService: 0x281053c60>";
    WAPreDownloadMgr = "<WAPreDownloadMgr: 0x282e70000>";
    EnterpriseContactMgr = "<EnterpriseContactMgr: 0x282933b80>";
    WeVisModelMgr = "<WeVisModelMgr: 0x2865877f0>";
    MMLimitedModeMgr = "<MMLimitedModeMgr: 0x282241560>";
    NewABTestMgr = "<NewABTestMgr: 0x280a3b0f0>";
    WAAdapterMgr = "<WAAdapterMgr: 0x280a3a3a0>";
    MMUserDataOperateMgr = "<MMUserDataOperateMgr: 0x281daea80>";
    MMSessionRefreshService = "<MMSessionRefreshService: 0x281d0b4c0>";
    VoIPRMLocalService = "<VoIPRMLocalService: 0x281d96f80>";
}

WAPreloadAppTaskMgr如下,里面包含一个WAPreloadAppTask小程序加载任务。

@interface WAPreloadAppTaskMgr : MMUserService <MMServiceProtocol>
{
WAPreloadAppTask *_preloadTask;
}

预加载任务会预创建WAJSCoreService。

@interface WAPreloadAppTask : NSObject
{
WAApptaskPublicResLogic *_publicResLogic;
WAWebViewController *_webView;
WAJSCoreService *_appService;
}

调用栈如下,微信在启动后通过performSelector:afterDelay:延迟调用,预创建小程序service。

image.png

当微信进入最近小程序页面,微信又预创建了小游戏的service。

<WAJSGameService: 0x13769bea0>

image.png
WAFlutterMgr

WAFlutterMgr负责管理flutter,包含唯一个flutter引擎(FlutterEngine),及多个skylineRuntime。

@interface WAFlutterMgr : MMRootService <MMServiceProtocol>

@property(retain, nonatomic) NSMutableArray *skylineRuntimeArr; // @synthesize skylineRuntimeArr=_skylineRuntimeArr;
@property(retain, nonatomic) FlutterEngine *firstEngine; // @synthesize firstEngine=_firstEngine;
@property(retain, nonatomic) FlutterEngineGroup *engineGroup; // @synthesize engineGroup=_engineGroup;

- (void)removeSkylineRuntime:(id)arg1;
- (void)addSkylineRuntime:(id)arg1;
- (id)makeSkylineEngine:(id)arg1;

启动时,flutter引擎会创建一系列flutter管道(FlutterMethodChannel),

包括flutter/platform_views,flutter/navigation,

fllutter/platform,

flutter/textinput,

flutter/localization等

image.png

补充:

SkylineGlobal
SkylineRuntimeCore
workletModule
SkylineGlobal.runtime.registerJsValue
SkylineGlobal.workletModule.stopMappers
onSkylineGlobalReady

以上绑定的关键对象或方法在逆向OC代码都找不到对应的,可能对应的实现在C++中,就像JSI。

JSCore提供封装C api后的面向对象JSExport方式,js对象与oc对象绑定,但这种方式效率比较低。

目前小游戏是采用JSCore C api + runtime模拟成JSExport的绑定对象方式,这种方式可以利用C api的效率更高,又可以利用对象绑定的编码便捷。

我估计微信可能采用的是类似JSI方式,绑定的对象在C++中处理,因此逆向找不到相关类(逆向只看的到OC)。

JSI相关资料:

https://blog.csdn.net/ImagineCode/article/details/125148600

https://blog.csdn.net/m0_49508485/article/details/122622251

https://blog.csdn.net/YoungOne2333/article/details/122962607

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 212,657评论 6 492
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,662评论 3 385
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 158,143评论 0 348
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,732评论 1 284
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 65,837评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,036评论 1 291
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,126评论 3 410
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,868评论 0 268
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,315评论 1 303
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,641评论 2 327
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,773评论 1 341
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,470评论 4 333
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,126评论 3 317
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,859评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,095评论 1 267
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,584评论 2 362
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,676评论 2 351

推荐阅读更多精彩内容