【ResourceManagerService 分析】第二篇:持有便解码器资源的进程状态大管家 ProcessInfo

本文详细分析了Android多媒体框架中ProcessInfoInterface的代码定义,探讨了ProcessInfo如何管理进程状态和优先级,以此作为清理编解码器资源的依据。同时,文章提到了DISALLOW_EVIL_CONSTRUCTORS宏的作用,防止意外的拷贝构造和赋值操作。随后,对ProcessInfo.cpp中的缓存操作进行了注释和分析,指出ResourceManagerService与MediaPlayerService在实现风格上的差异,如对锁和智能指针的使用。
摘要由CSDN通过智能技术生成

从代码可以看出,重要的结构体 ProcessInfoInterface , 先看一下代码定义
在这里插入图片描述

frameworks/av/media/libstagefright/include/media/stagefright/ProcessInfoInterface.h

struct ProcessInfoInterface : public RefBase {
   
    // 根据 pid 获取 该进程的优先级
    virtual bool getPriority(int pid, int* priority) = 0;
    // 校验pid是否是合法
    virtual bool isValidPid(int pid) = 0;
    // 覆盖进程信息,如果已经缓存这个pid的进程信息,那么就替换成新的进程信息
    virtual bool overrideProcessInfo(int pid, int procState, int oomScore);
    // 移除缓存中的 pid 进程信息
    virtual void removeProcessInfoOverride(int pid);

protected:
    virtual ~ProcessInfoInterface() {
   }
};

frameworks/av/media/libstagefright/include/media/stagefright/ProcessInfo.h

struct ProcessInfo : public ProcessInfoInterface {
   
    ProcessInfo();
    virtual bool getPriority(int pid, int* priority);
    virtual bool isValidPid(int pid);
    virtual bool overrideProcessInfo(int pid, int procState, int oomScore);
    virtual void removeProcessInfoOverride(
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

智者向内寻求力量

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值