chromium のソースコードにある //chrome と //content

//chrome の README には以下の様に書かれています。

Chrome


This directory contains the open source, application layer of Google Chrome.

Unlike other parts of Chromium like //content, which provide framework intended to support multiple products, this directory contains code that is focused on building specific products with opinionated UX.

 

そして //chrome と 対になるのが //content

Content module


High-level overview
The "content" module is located in src/content, and is the core code needed to render a page using a multi-process sandboxed browser. It includes all the web platform features (i.e. HTML5) and GPU acceleration. It does not include Chrome features, e.g. extensions/autofill/spelling etc.

Motivation
As the Chromium code has grown, features inevitably hooked into the wrong places, causing layering violations and dependencies that shouldn't exist. It's been hard for developers to figure out what the "best" way is because the APIs (when they existed) and features were together in the same directory. To avoid this happening, and to add a clear separation between the core pieces of the code that render a page using a multi-process browser, consensus was reached to move the core Chrome code into src/content (content not chrome :) ).

ここまで読んでも実際の違いがよくわからなかったけど //content の READMEを読み続けたらわかりやすかった。

content vs chrome


content should only contain code that is required to implement the web platform. Generally, a feature belongs in this category if and only if all of the following are true:

 


In contrast, many features that are common to modern web browsers do not satisfy these criteria and thus, are not implemented in content. A non-exhaustive list:

  • Extensions
  • NaCl
  • SpellCheck
  • Autofill
  • Sync
  • Safe Browsing
  • Translate

 

chromium slackを読んでわかったこと。

it's name is not "Chrome" the product, it's "chrome" the UI concept

//chrome は プロダクトの "Chrome" を意味するのではなく UI の 思想についてである。

 

//chrome のコードが変更された時にChromium-based browsers がその影響を受けるかは //chrome codeをどれくらい使うかによる。

 

For example, Edge uses a lot of the browser chrome, Vivaldi uses less.  But I don't know the exact fractions

Edge は chrome をたくさん使うけど Vivaldi はより独自の部分が多い。

 

 

 

nhiroki さんの説明。

nhiroki.jp

より勝手に引用。

コンポーネントによるディレクトリ分け (chrome / content / third_party / base)

 

まずはコンポーネントによるディレクトリ分けです。ウェブページの表示枠(ページフレーム)を表示する最低限のコンポーネントは Content モジュールにまとめられています。Content モジュールは content/ 以下に配置されます。よく Blink/Chromium という表記方法をすることがありますが、開発者はこの content/ ディレクトリを指して Chromium と呼ぶことが多いです。

ページフレームをラップし、さらに Chrome 独自の機能 (ブラウザ拡張とかプロファイルの同期機能など) を実装しているのが Chrome モジュールです。Chrome モジュールは chrome/ ディレクトリにまとめられています。ブラウザ拡張の API 実装が見たい場合はこのディレクトリ以下を探すことになります。

Chromium が依存しているライブラリは third_party/ 以下に配置されます。このディレクトリには動画処理ライブラリ FFmpeg やグラフィックスライブラリ Skia、シリアライザの Protocol Buffers など、様々なライブラリが含まれています。その中でもとりわけ重要なのは Blink モジュールでしょう。Blink は Chromiumレンダリングエンジンです。レンダリングエンジンという名前ですが、実際にはレンダリング以外にも JavaScript を実行したり、JavaScriptC++バインディングを提供したりします。Blink は Chromium プロジェクトの一部で現在は同じリポジトリ内で開発されていますが、WebKit からフォークされた (公式ブログ記事) という歴史的な経緯により third_party/ ディレクトリに配置されていて、さらにディレクトリ名も WebKit のままになっています1 (2018/04/09 追記: WebKit ディレクトリ内の大部分のファイルが新しい blink ディレクトリに移動されました。しかし LayoutTests など一部のファイルは依然として WebKit ディレクトリに残っています)。

v8/ ディレクトリは JavaScript の実行エンジン V8 が配置されます。V8 は Blink のコアコンポーネントですが、開発は別のリポジトリで行われていて、サブモジュールとしてインポートされます。一見すると third_party/ に置かれるべきものですが、必須コンポーネントであるという理由からトップレベディレクトリに置かれています。

base/ は chrome/ や content/ で使われる共通ライブラリで、OS の提供するシステムコールなどを抽象化した API を提供します。ChromiumWindows, Mac, Linux, Android, iOS など様々なプラットフォームをサポートしていますが、この base/ ライブラリのおかげで開発者は下位プラットフォームの差をあまり気にせずプログラミングすることができるようになっています。