--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CABg10jwWSo94-F4MvQHhmjhFzW4Z9ym6oE2_ua%2BZn4EvTiKBWA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAPVAxLUr-8eK1J%2BjhBhxSaJz_056u4HqfqqxW4YzkGWZ7SJ9_A%40mail.gmail.com.
KURL vs GURL is a pretty major change in my opinion.Some things off the top of my head:- KURL is backed by WTF::String and GURL is backed by std::string so we'd be facing a lot of challenges with string conversions around usage of the GURL API.- We copy KURLs around a lot since it is relatively cheap because we're backed by AtomicString in most cases. If we switched to GURL we will risk memory or CPU regressions. Some URLs like data URLs can be quite large (in the MBs).- KURL has some specially optimized methods for e.g. accessing- whether the URL is http or https- the atomic string protocol (http and https stored as a static string for fast comparisons)I'm nervous a conversion could have significant CPU and memory regressions unless we made major changes to the consuming code. I'm also not confident it would be a code-health win due to introducing a std::string API to a huge portion of Blink.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAPVAxLUPb5iCUKn2x6_Q79gGRCKQ4H5k-x2h5FK21HC5ZWtryQ%40mail.gmail.com.
HiThe arch team has been discussing what types should be allowed or disallowed in core/ and modules/ and reached the following decision [1].Principle:- We should share as much code between Chromium and Blink as possible and reduce the pain of using different types between the two code base. However, there are a couple of types that really need to be optimized for Blink's workload (WTF::Vector, WTF::HashTable, WTF::String etc). For those types we want to keep using Blink-specific types.Guideline:- core/ and modules/ can now directly use //base types and other primitive types in Chromium. You no longer need to define thin wrapper classes or aliases in platform/wtf/ to let core/ and modules/ use the //base types.- For types that really need to be optimized for Blink's workload, you should use Blink-specific types defined in platform/wtf/. You should use WTF::Vector, WTF::HashTable, WTF::String, KURL etc instead of std::vector, std::map, std::string, GURL etc.
- We check the rule using a presubmit check. Only types that are whitelisted in the presubmit check are allowed in core/ and modules/. (This is not going to be a perfect check but it will work in 99% of the cases in practice.)- platform/wtf/ provides helper functions to convert between Blink-specific types and Chromium types (e.g., std::string <=> WTF::String, GURL <=> KURL). Code that lives at the boundary between Blink and Chromium can use the helper functions.I'm planning to add the guideline to a markdown file. If you have any question or concern, let me know! :D[1] https://groups.google.com/a/chromium.org/d/topic/platform-architecture-dev/eNLScUUWjCg/discussion--Kentaro Hara, Tokyo, Japan
--
On Thu, Jul 13, 2017 at 7:02 PM, Kentaro Hara <har...@chromium.org> wrote:HiThe arch team has been discussing what types should be allowed or disallowed in core/ and modules/ and reached the following decision [1].Principle:- We should share as much code between Chromium and Blink as possible and reduce the pain of using different types between the two code base. However, there are a couple of types that really need to be optimized for Blink's workload (WTF::Vector, WTF::HashTable, WTF::String etc). For those types we want to keep using Blink-specific types.Guideline:- core/ and modules/ can now directly use //base types and other primitive types in Chromium. You no longer need to define thin wrapper classes or aliases in platform/wtf/ to let core/ and modules/ use the //base types.- For types that really need to be optimized for Blink's workload, you should use Blink-specific types defined in platform/wtf/. You should use WTF::Vector, WTF::HashTable, WTF::String, KURL etc instead of std::vector, std::map, std::string, GURL etc.Is there any documentation explaining how WTF:Vector is better optimized for blink than std::vector? Similarly for HashTable and so on.
--- We check the rule using a presubmit check. Only types that are whitelisted in the presubmit check are allowed in core/ and modules/. (This is not going to be a perfect check but it will work in 99% of the cases in practice.)- platform/wtf/ provides helper functions to convert between Blink-specific types and Chromium types (e.g., std::string <=> WTF::String, GURL <=> KURL). Code that lives at the boundary between Blink and Chromium can use the helper functions.I'm planning to add the guideline to a markdown file. If you have any question or concern, let me know! :D[1] https://groups.google.com/a/chromium.org/d/topic/platform-architecture-dev/eNLScUUWjCg/discussion--Kentaro Hara, Tokyo, Japan
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CABg10jwWSo94-F4MvQHhmjhFzW4Z9ym6oE2_ua%2BZn4EvTiKBWA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CABg10jwJNOeGmtMZs5gmPza%3DWvRjfeb6eVcYKOAXz2hzNtGvAA%40mail.gmail.com.
This update sounds great. It will reduce friction and duplicated code between Blink and Chromium.I have a request, however: when expanding the list of allowed types in a non-trivial way, I would like it to be required to have a PSA blink-dev email, plan for migration, and buy-in from leads in the affected code areas. This will avoid any inadvertent performance issues, and also avoid situations where half of the code is converted to a new type and the other half is not.
One set of examples I have in mind is graphics types like float rects, points and matrices. We should aim to unify those types between Blink and Chromium, but it will be a lot of work and should not be pursued until we have a well-thought-out and staffed plan to do so.Also, is the mentioned presubmit already in place? I'd like to take a look and make sure examples like I mentioned above are excluded for the moment, with appropriate comment.
SGre: KURL and GURL, I'm not sure if it is really because KURL is currently "optimized for Blink's workload".The only reason I can think of is that by having KURL you can selectively alter web exposing URL behavior (compared to GURL affecting the entire codebase).If that's the only reason I'm leaning toward unifying KURL/GURL, but I am likely missing some additional context. Any thoughts welcome :)
+yutakOn Sat, Jul 15, 2017 at 12:25 AM, Raymond Toy <rt...@google.com> wrote:On Thu, Jul 13, 2017 at 7:02 PM, Kentaro Hara <har...@chromium.org> wrote:HiThe arch team has been discussing what types should be allowed or disallowed in core/ and modules/ and reached the following decision [1].Principle:- We should share as much code between Chromium and Blink as possible and reduce the pain of using different types between the two code base. However, there are a couple of types that really need to be optimized for Blink's workload (WTF::Vector, WTF::HashTable, WTF::String etc). For those types we want to keep using Blink-specific types.Guideline:- core/ and modules/ can now directly use //base types and other primitive types in Chromium. You no longer need to define thin wrapper classes or aliases in platform/wtf/ to let core/ and modules/ use the //base types.- For types that really need to be optimized for Blink's workload, you should use Blink-specific types defined in platform/wtf/. You should use WTF::Vector, WTF::HashTable, WTF::String, KURL etc instead of std::vector, std::map, std::string, GURL etc.Is there any documentation explaining how WTF:Vector is better optimized for blink than std::vector? Similarly for HashTable and so on.Regarding WTF::Vector, the inline capacity is important for many performance-sensitive code paths. std::vector doesn't support the inline capacity.Regarding WTF::HashTable, yutak@ would know better.