Cef应用资源布局

Application Layout
应用资源布局

Application layout can differ significantly depending on the platform. For example, on Mac OS X your application layout must follow a specific app bundle structure. Windows and Linux are more flexible, allowing you to customize the location where CEF libraries and resources are stored. For a complete working example of the required layout you can download a client archive from the project Downloads page. Some files are optional and some are required as detailed in the README.txt file for each platform.

应用资源布局依赖于平台,有很大的不同。比如,在Mac OS X上,你的资源布局必须遵循特定的app bundles结构;Window与Linux则更灵活,允许你定制CEF库文件与资源文件所在的位置。为了获取到特定地、可以正常工作的示例,你可以从工程的下载页面,下载到一个client压缩包,每个平台对应的README.txt文件详细说明了哪些文件是可选的,哪些文件是必须的。

Windows
Windows操作系统

On Windows the default layout places the libcef library and related resources next to the application executable. The directory structure looks like this:

在Windows平台上,默认的资源布局将libcef库文件、相关资源与可执行文件放置在同级目录,文件夹结构如下类似:

  
  
  1. Application/
  2. cefclient.exe <= cefclient application executable <= cefclient可执行程序
  3. libcef.dll <= main CEF library <= CEF基本库
  4. icudt.dll <= ICU unicode support library <= ICU unicode支持库
  5. ffmpegsumo.dll <= HTML5 audio/video support library <= HTML5音频视频支持库
  6. libEGL.dll, libGLESv2.dll, <= accelerated compositing support libraries <= 加速合成支持库
  7. cef.pak, devtools_resources.pak <= non-localized resources and strings <= 非本地语言资源与字符串
  8. locales/
  9. en-US.pak, <= locale-specific resources and strings <= 本地语言相关资源与字符串

The location of the CEF libraries and resource files can be customized using the CefSettings structure (see the README.txt file or “CefSettings” section for details). The cefclient application on Windows compiles in resources via the BINARY resource type in cefclient.rc but an application could just as easily load resources from the local file system.

使用结构体CefSettings可以定制CEF库文件、资源文件的位置(查看README.txt文件或者本文中CefSettings部分获取更详细的信息)。虽然在Windows平台上,cefclient项目将资源文件以二进制形式编译进cefclient.rc文件,但是改为从文件系统加载资源也很容易。

Linux
Linux操作系统

On Linux the default layout places the libcef library and related resources next to the application executable. Note however that there’s a discrepancy between where libcef.so is located in the client distribution and where it’s located in the binary distribution that you build yourself. The location depends on how the linker rpath value is set when building the application executable. For example, a value of “-Wl,-rpath,.” (“.” meaning the current directory) will allow you to place libcef.so next to the application executable. The path to libcef.so can also be specified using the LD_LIBRARY_PATH environment variable.

在Linux平台上,默认的资源布局将libcef库文件、相关资源与可执行文件放置在同级目录。注意:在你编译的版本与发行版本应用程序中,libcef.so的位置是有差异的,此文件的位置取决于编译可执行程序时,编译器rpath的值。比如,编译选项为“-Wl,-rpath,.”(“.”意思是当前文件夹),这样libcef.so与可执行文件处于同级目录。libcef.so文件的路径可以通过环境变量中的“LD_LIBRARY_PATH”指定。

  
  
  1. Application/
  2. cefclient <= cefclient application executable <= cefclient可执行程序
  3. libcef.so <= main CEF library <= CEF基本库
  4. ffmpegsumo.so <-- HTML5 audio/video support library <-- HTML5音频视频支持库
  5. cef.pak, devtools_resources.pak <= non-localized resources and strings <= 非本地语言资源与字符串
  6. locales/
  7. en-US.pak, <= locale-specific resources and strings <= 本地语言相关资源与字符串
  8. files/
  9. binding.html, <= cefclient application resources <= cefclient程序需要的资源

The location of the CEF libraries and resource files can be customized using the CefSettings structure (see the README.txt file of “CefSettings” section for details).

使用结构体CefSettings可以定制CEF库文件、资源文件(查看README.txt文件或者本文中CefSettings部分获取更详细的信息)。

Mac OS X
Mac X平台

The application (app bundle) layout on Mac OS X is mandated by the Chromium implementation and consequently is not very flexible. The directory structure looks like this:

在Mac X平台上,app bundles委托给了Chromium实现,因此不是很灵活。文件夹结构如下类似:

  
  
  1. cefclient.app/
  2. Contents/
  3. Frameworks/
  4. Chromium Embedded Framework.framework/
  5. Libraries/
  6. ffmpegsumo.so <= HTML5 audio/video support library <= HTML5音频视频文件
  7. libcef.dylib <= main CEF library <= CEF基本库
  8. Resources/
  9. cef.pak, devtools_resources.pak <= non-localized resources and strings
  10. *.png, *.tiff <= Blink image and cursor resources <= Blink图片与光标样式资源
  11. en.lproj/, <= locale-specific resources and strings <= 本地语言资源与字符串
  12. libplugin_carbon_interpose.dylib <= plugin support library <= 插件支持库
  13. cefclient Helper.app/
  14. Contents/
  15. Info.plist
  16. MacOS/
  17. cefclient Helper <= helper executable <= 可执行的帮助器
  18. Pkginfo
  19. cefclient Helper EH.app/
  20. Contents/
  21. Info.plist
  22. MacOS/
  23. cefclient Helper EH <= helper executable <= 可执行的帮助器
  24. Pkginfo
  25. cefclient Helper NP.app/
  26. Contents/
  27. Info.plist
  28. MacOS/
  29. cefclient Helper NP <= helper executable <= 可执行的帮助器
  30. Pkginfo
  31. Info.plist
  32. MacOS/
  33. cefclient <= cefclient application executable <= cefclient可执行程序
  34. Pkginfo
  35. Resources/
  36. binding.html, <= cefclient application resources <= cefclient程序需要的资源

The "Chromium Embedded Framework.framework" is an unversioned framework that contains all CEF binaries and resources. Executables (cefclient, cefclient Helper, etc) are linked to libcef.dylib using install_name_tool and a path relative to @executable_path.

列表中的“Chromium Embedded Framework.framework”,这个未受版本管控的框架包含了所有的CEF库文件、资源文件。使用install_name_tool与@executable_path,将cefclient,cefclient helper等可执行文件,连接到了libcef.dylib上。

The "cefclient Helper" apps are used for executing separate processes (renderer, plugin, etc) with different characteristics. They need to have separate app bundles and Info.plist files so that, among other things, they don't show dock icons. The "EH" helper, which is used when launching plugin processes, has the MH_NO_HEAP_EXECUTION bit cleared to allow an executable heap. The "NP" helper, which is used when launching NaCl plugin processes only, has the MH_PIE bit cleared to disable ASLR. This is set up as part of the build process using scripts from the tools/ directory. Examine the Xcode project included with the binary distribution or the originating cefclient.gyp file for a better idea of the script dependencies.

应用程序cefclient helper用来执行不同特点、独立的进程(renderer,plugin等),这些进程需要独立的资源布局与Info.plist等文件,它们没有显示停靠图标。用来启动插件进程的EH Helper清除了MH_NO_HEAP_EXECUTION标志位,这样就允许一个可执行堆。只能用来启动NaCL插件进程的NP Helper,清除了MH_PIE标志位,这样就禁用了ASLR。这些都是tools文件夹下面,用来构建进程脚本的一部分。为了理清脚本的依赖关系,更好的做法是检查发行版本中的Xcode工程或者原始文件cefclient.gyp。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值