>_ DevTrendsen

Language

Home

Languages

Sections

Frontend Backend Mobile DevOps AI / ML GameDev Blockchain Embedded Security
Unknown

Looking Under the Hood of Chromium and Figuring Out Why a Regular git clone Won't Work Here

Logo

If you've ever tried running the git clone https://github.com/chromium/chromium.git command, you probably regretted it within a couple of minutes. The repository has ballooned to over 60 gigabytes, and the README greets you with a terse warning: don't do this with a regular git.

Chromium is the foundation of a good half of the desktop applications on our computers. It powers Google Chrome, Microsoft Edge, Brave, Opera, the Telegram desktop client, VS Code, and Slack via Electron. However, the project's GitHub repository is just a public mirror of Google's internal infrastructure. Let's explore how this monstrous project is structured, how to navigate it, and why an ordinary engineer would need to open its source code.

Why the standard workflow doesn't work here

Most open-source projects are set up the same way: clone the repository, install dependencies, open your editor, and make a pull request. That won't fly with Chromium.

There's no familiar Issues tab or Pull Requests section on GitHub. All development happens through an internal Gerrit system at chromium-review.googlesource.com, and bugs are tracked on a dedicated portal at crbug.com.

To fetch the source code to your local machine, the project team developed their own set of utilities called depot_tools. Inside it lives the gclient tool, which manages hundreds of dependencies, third-party libraries, and cross-compilers. The repository itself is large, but with the full commit history, toolchain, and build dependencies, you'll need about 100 gigabytes of free space on a fast SSD and at least 16 gigabytes of RAM.

# Типичный процесс получения исходников через depot_tools выглядит так
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH="$PATH:/path/to/depot_tools"

mkdir chromium && cd chromium
fetch --nohooks chromium
gclient sync

If you try to build the entire project on a typical quad-core laptop, the compiler will max out all cores for several hours. To speed up builds, Chromium engineers use a distributed compilation and caching system called Reclient, along with their own build system GN (Generate Ninja) paired with Ninja.

How the directory structure is organized

When you open the Chromium root folder, your eyes start spinning. Inside are millions of lines of code in C++, Rust, Python, Java, and JavaScript. The documentation describes strict rules for directory organization:

  1. src/content — the browser core. This is where the multi-process engine is implemented: tab management, isolated rendering sandboxes, network request handling, and security mechanisms.
  2. src/third_party/blink — the page rendering engine (a WebKit fork). This is where HTML and CSS specification implementations live, along with DOM tree parsing and layout calculations.
  3. src/v8 — the JavaScript and WebAssembly engine. In the Chromium repository, it's included as an external dependency.
  4. src/chrome — the Chrome browser code itself. This includes the user interface, bookmarks, extensions, user profiles, and settings.

Beyond these four main building blocks, the project contains a components/ directory with modules that can be reused across different products, such as Android WebView or the Ash shell for ChromeOS.

What's interesting hidden in the architecture

Chromium is interesting not only as a finished browser but also as an example of incredibly complex system architecture. The codebase holds answers to questions that arise when reading web specifications.

Multi-process model and sandboxes

The browser is deliberately split into isolated processes. The Browser Process manages windows and user input, the Network Process handles resource downloads, and Renderer Processes render pages.

If a script on a tab freezes or a page triggers a critical memory error, only that specific renderer process will crash—the browser keeps running. Isolation mechanisms are implemented separately for each operating system through Linux namespaces and seccomp-bpf system calls, or Windows integrity levels.

Inter-process communication via Mojo

Since different parts of the browser live in isolated processes, they need a fast, type-safe mechanism to communicate. Chromium uses the Mojo system for this.

Developers describe interfaces in .mojom files, and a code generator creates bindings for C++, Java, and JS. This protects against passing incorrect data types between the untrusted renderer process and the privileged browser process.

// Пример описания интерфейса в Mojo
module example.mojom;

interface PingResponder {
  Ping() => (string response);
};

Why frontend and systems developers should read this code

It might seem like an ordinary web developer has no reason to dig into C++ source code. But in practice, the Chromium source code is the most accurate source of truth about how the browser interprets your pages.

Here are four real scenarios where the project's codebase comes in handy:

  • Debugging complex browser bugs. When CSS Grid or Flexbox behaves strangely in Chrome but the W3C specification is vaguely written, you can open the code in src/third_party/blink/renderer/core/layout and examine the math behind box size calculations.
  • Learning how Web APIs work. All browser JavaScript methods like IntersectionObserver, WebSockets, or ServiceWorker have a direct counterpart in Blink's code. By reading their implementation, you immediately understand which operations create memory and CPU overhead.
  • Developing embedded browsers. If you need to embed web page rendering into your own C++ or Rust application, the Chromium Embedded Framework (CEF) relies on the public interfaces in src/content.
  • Finding examples of high-load systems code. Here you can find implementations of custom memory allocators (PartitionAlloc), compression algorithms, streaming network protocols, and cryptographic primitives.

Where to start learning

If you're just interested in browsing the source code, you don't need to spend 100 gigabytes of disk space. For code search, the project team maintains an excellent web interface called Source Search at source.chromium.org. It features instant symbol search, navigation to function declarations, and viewing the change history of any file.

The Chromium codebase is intimidating in its scale, but it's one of the most well-structured projects in the industry. Even a superficial familiarity with the docs/ directory and the Blink subsystem helps you better understand the web platform and write more optimized frontend code.

Related projects