Chromium 硬件加速开关c++

选项页控制硬件加速开关

1、前端代码

javascript 复制代码
<settings-toggle-button id="hardwareAcceleration"

        pref="{{prefs.hardware_acceleration_mode.enabled}}"

        label="$i18n{hardwareAccelerationLabel}">

      <template is="dom-if" if="[[shouldShowRestart_(

          prefs.hardware_acceleration_mode.enabled.value)]]">

        <cr-button on-click="onRestartClick_" slot="more-actions">

          $i18n{restart}

        </cr-button>

      </template>

</settings-toggle-button>

2、c++代码

cpp 复制代码
​
// Set to true if hardware acceleration mode is enabled on this browser.

inline constexpr char kHardwareAccelerationModeEnabled[] =

    "hardware_acceleration_mode.enabled";

​

chrome\browser\gpu\gpu_mode_manager.cc

cpp 复制代码
// static
void GpuModeManager::RegisterPrefs(PrefRegistrySimple* registry) {
  registry->RegisterBooleanPref(
      prefs::kHardwareAccelerationModeEnabled, true);
  registry->RegisterBooleanPref(
      prefs::kHardwareAccelerationModePrevious, true);
}

修改此kHardwareAccelerationModeEnabled值即可控制。

相关推荐
·薯条大王3 小时前
经济实惠玩云服务器|一台云服务器多人共用,子账号配置教程
java·linux·运维·服务器·汇编·c++·python
用户938515635073 小时前
从零在浏览器里跑 DeepSeek-R1:WebGPU + Transformer.js 全链路实战
前端·设计模式·typescript
CodeSheep3 小时前
稚晖君公司人事大变动,来了!
前端·后端·程序员
鱼樱前端3 小时前
用 AI 做内容变收入
前端·人工智能·ai编程
浮生望4 小时前
React + TypeScript 组件设计进阶:从类型约束到无状态组件的三次进化
前端
90后的晨仔4 小时前
Mac 开发 uni-app 终极方案:让安卓模拟器彻底脱离 Android Studio 独立运行
前端·vue.js
90后的晨仔4 小时前
别再搞混了!uni-app 中 node_modules 和 uni_modules 到底是什么关系?
前端
kyriewen5 小时前
面试官问"这段逻辑为什么这样写"——我才发现,这半年我写的代码,我自己都解释不了
前端·javascript·面试
谢小飞5 小时前
大文件上传很难?学会这招,GB文件秒传不是梦
前端·node.js
ZJH__GO6 小时前
网络编程v4pro--实现聊天室文件传输功能
java·服务器·网络·计算机网络