Live data from Hacker News

Fixing a bug in Google Chrome as a first-time contributor

cprimozic.net

141–150 of 170 posts

Re: Fixing a bug in Google Chrome as a first-time contributor

#141

Congratulations! And thank you for the great write-up. I work with the Chromium code base a lot, and it can indeed be daunting. I use Sublime Text, which treats the code as plain text, apart from syntax highlighting. But it's also possible with at least VS Code to get some more intelligence, such as going to the definition or declaration of a function, etc. People who have now become interested in creating their own…

I was a C++ Chrome developer till 2020, and I primarily used Sublime Text because of speed, and I found VSCode weekly releases too distracting.

I indexed code locally with CTags, and then used SublimeText CTags extension for navigation. This worked great for my local branches. When I needed to dig deep, I'd use source.chromium.org which indexes perfectly.

# ctags command that indexes just Google's chrome code ctags --languages=C++ --exclude=third_party --exclude=.git --exclude=build --exclude=out --exclude=tools --exclude=mojo --exclude=base -R -f .tmp_tags ctags --languages=C++ -a -R -f .tmp_tags third_party/blink mv .tmp_tags .tags

Re: Fixing a bug in Google Chrome as a first-time contributor

#142

Earlier quoted context omitted.

Why are you running your own fork, if I may ask.

When you sit down at the dinner table, do you have your own fork or share one with the guests? Exact same logic applies.

Because you don’t want to share germs with other users of the browser? The logic makes no sense and I honestly can’t tell if you’re joking.

Re: Fixing a bug in Google Chrome as a first-time contributor

#143
post #140

Earlier quoted context omitted.

Cpp compile times are shame as hell This shit shouldnt need this many resources for debug builds

45 minute build for 32 million lines of code seems pretty reasonable, to me. What are some projects of equal complexity with lower build time in other languages?

There are no projects with equal complexity, let alone in other langs that im aware of

Re: Fixing a bug in Google Chrome as a first-time contributor

#145
post #114

Earlier quoted context omitted.

Yes it's a serious question. And no, "reading" doesn't involve inserting printf statements or taking backtraces. These are different activities. That's called debugging and not reading. The OP's scenario is being curious how Chromium does something: so it suffices to find the relevant snippet and then copy it elsewhere. The Chromium code is assumed to be already working and does not need debugging.

My point is that for engineers like myself, it's much easier to read code if I can also have access to debugging features. > The Chromium code is assumed to be already working and does not need debugging. Even if it doesn't need debugging, debugging features can help engineers understand the code better.

Sure. Doesn't that depend on the complexity of the code you are looking at though? In many cases you can go through code, find the bit you are looking for and have pretty good idea of what it does. Which sometimes is all you need.

Re: Fixing a bug in Google Chrome as a first-time contributor

#146
post #110

Earlier quoted context omitted.

That little snippet doesn't quite provide enough historical context for me to agree or disagree with it.

Huh?

The thing you linked starts with

> The phrase "patches welcome" has come not to be.

Which I am already missing context for to make sense out of. Where was this phrase used, by who?

I get a general idea of what it is about and what the intention is but it isn't all that clear as I am missing the surrounding context.

Re: Fixing a bug in Google Chrome as a first-time contributor

#147

Congratulations! And thank you for the great write-up. I work with the Chromium code base a lot, and it can indeed be daunting. I use Sublime Text, which treats the code as plain text, apart from syntax highlighting. But it's also possible with at least VS Code to get some more intelligence, such as going to the definition or declaration of a function, etc. People who have now become interested in creating their own…

I haven’t looked too closely at Chrome’s build process but there might be a way to get LSP or something set up for it?

For Chromium IntelliSence at least in the form of VSCode plug-in works pretty much out of the box with recent releases of VSCode. It is not as precise as clang LSP but the latter can easily consume over 10GB for Chromium.

Re: Fixing a bug in Google Chrome as a first-time contributor

#148
post #79

>Because of this huge codebase size, I wasn't able to get VS Code's C++ extension to work very well with the project. Features like go-to definition (which I usually rely on heavily when navigating codebases) and find references didn't work well or at all, and one of my CPU cores would stay stuck at 100% permanently while the project was open. Chromium Code Search [1] tool is very helpful with that and I believe ther…

It's also possible to get go-to-definition etc working in VSCode locally. You need to switch from Microsoft's C++ extension to the clangd extension. Clangd scales better and is more accurate for projects using clang like Chromium. Instructions here: https://chromium.googlesource.com/chromium/src.git/+/HEAD/do... The Chromium code search site is still very useful too.

[deleted]

Re: Fixing a bug in Google Chrome as a first-time contributor

#149
post #92
post #79

>Because of this huge codebase size, I wasn't able to get VS Code's C++ extension to work very well with the project. Features like go-to definition (which I usually rely on heavily when navigating codebases) and find references didn't work well or at all, and one of my CPU cores would stay stuck at 100% permanently while the project was open. Chromium Code Search [1] tool is very helpful with that and I believe ther…

I've been working on an extension https://github.com/phil294/search-plus-plus-vscode-extension for instant search results in gigantic repos like this one because it's a recurring pattern that bothers me. And eventually I'd like it to use its index to provide full go-to, autocomplete etc. on a pure plain text basis, because why not? I don't get the obsession with full-fledged language integration when plain text-based…

For Visual Studio on Windows Google provides a search extension that indexes Chromium locally and gives instant results for search. I was always puzzled why such functionality is not available in most IDE by default.

Re: Fixing a bug in Google Chrome as a first-time contributor

#150
post #109

I noticed in Chrome based browsers that when I copied an image to clipboard, whole UI would freeze. For large images it would become unresponsive for 5-10 seconds. I dug into the source and turns out they PNG encode it, I believe at highest compression. (The comments indicate this is something to do with how old versions of MS WORD handle transparency..?) My "workaround" was to change the compression level to 0. Not…

As someone who had the misfortune of working on clipboard support in Chrome, I thought "wow, there's no way we do that in places other than Linux".

... turns out we do and I helped review that patch. Doh!

For how widely the clipboard is, the actual implementation (both in the OS and in the browser) is surprisingly unloved and unmaintained.

FWIW, Chrome intentionally doesn't plumb through the original image bytes. I wasn't around when it was initially implemented, but even for many years afterwards, there were no (Windows) platform conventions for passing around non-bitmap images on the (Windows) clipboard. And another (probably unintentional) benefit was "the encoded image bytes are from an untrustworthy source and could trigger bugs in buggy image decoders", while bitmaps are (relatively) safe in comparison.

Of course, this is a rather arbitrary line, because it's easy to get the original image bytes out of the sandboxed renderer, e.g. by dragging out the image or by saving the image.

At this point, someone could probably try plumbing through the original bytes or even implementing delayed rendering... but it's quite expensive in terms of time, especially to test all the random things that might break. :(

Post reply on HN