4 ms·
Chromium's codebase isn't so bad for a first timer. Years ago our product had a bug on Windows where if you paste an image from the clipboard, the image had gar
by kgeist 2y ago
Chromium's codebase isn't so bad for a first timer. Years ago our product had a bug on Windows where if you paste an image from the clipboard, the image had garbage in it (something to do with alpha channels). I realized Chrome has no such bug so they probably had a workaround. It took me like 30 minutes of lurking around in the codebase for the first time to find their workaround and apply it to our code.
- bgirard 2y ago> Chromium's codebase isn't so bad for a first timer. Agreed > It took me like 30 minutes I can tell you didn't need to build it ;)
- kccqzy 2y agoWhy build it if you are just reading? I find https://source.chromium.org/chromium https://source.chromium.org/chromium wonderful. With things like go-to-definition and find-all-overridden-functions working wonderfully well. I find this to be ideal when working with a large codebase. I don't even need an editor with fancy intelligence features and LSP integration; a bare bones vim or emacs paired with a website with all the intelligence already there.
- bgirard 2y ago> Why build it if you are just reading? Is this a serious question? Assuming it is, to insert printf statement, or attach a debugger and step through the program and take backtraces to supplement or confirm the information you gather from reading the code.
- kccqzy 2y agoYes 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.
- bgirard 2y agoMy 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.
- creesch 2y agoSure. 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.
- bgirard 2y agoIt's a tool. It's never required. Even for complex code. But it's helpful to some. Even for simple code.
- kgeist 2y ago>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. To clear myself of any wrongdoing in regards to copyright :) They had a very nice comment explaining how the workaround works, and we used a different image manipulation library, so I couldn't, and didn't, copy it as is. So not only it was easy to find the workaround in their huge codebase, they also explained it well so I could replicate it in our codebase from scratch.
- skobes 2y agoOne thing Chromium does really well is hooking up cross references in the code search tool (source.chromium.org). This makes it easy to browse, see where things are called from, subclassed, etc. Github feels far behind on this.
- dieortin 2y agoI’m pretty sure that code search webpage is the external facing version or Google’s internal code search, which they use to index their huge internal monorepo, so it makes sense that it works well.
- hnben 2y agolast year I worked with js and chrome gave me a weird exception (I think it was something with websockets and ssl? I don't remember). I googled the exception, and found the exception in the chromium sourcecode and quickly found out when exactly that exception was triggered, and could then easily fix my js. I too was pleasantly surprised how readable it was.