diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-02-04 17:20:24 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-02-12 08:15:25 +0000 |
commit | 8fa0776f1f79e91fc9c0b9c1ba11a0a29c05196b (patch) | |
tree | 788d8d7549712682703a0310ca4a0f0860d4802b /chromium/styleguide | |
parent | 606d85f2a5386472314d39923da28c70c60dc8e7 (diff) | |
download | qtwebengine-chromium-8fa0776f1f79e91fc9c0b9c1ba11a0a29c05196b.tar.gz |
BASELINE: Update Chromium to 98.0.4758.90
Change-Id: Ib7c41539bf8a8e0376bd639f27d68294de90f3c8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/styleguide')
-rw-r--r-- | chromium/styleguide/c++/c++.md | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/chromium/styleguide/c++/c++.md b/chromium/styleguide/c++/c++.md index b5a8767a08b..c405826a1e7 100644 --- a/chromium/styleguide/c++/c++.md +++ b/chromium/styleguide/c++/c++.md @@ -23,12 +23,10 @@ Blink code in `third_party/blink` uses [Blink style](blink-c++.md). Google style [targets C++17](https://google.github.io/styleguide/cppguide.html#C++_Version). -Chromium targets C++14; [C++17 support](https://crbug.com/752720) is not -expected before -[mid-2021](https://blog.chromium.org/2020/01/moving-forward-from-chrome-apps.html). -Additionally, some features of supported C++ versions remain forbidden. The -status of Chromium's C++ support is covered in more detail in -[Modern C++ use in Chromium](c++11.md). +Chromium targets C++14; C++17 support is not expected before 2022. (See the +[tracking bug](https://crbug.com/752720) for more details.) Additionally, some +features of supported C++ versions remain forbidden. The status of Chromium's +C++ support is covered in more detail in [Modern C++ use in Chromium](c++11.md). ## Naming @@ -223,6 +221,21 @@ scoped_refptr<T>&` instead of `T*`, or return `T*` instead of `scoped_refptr<T>` (to avoid refcount churn pre-C++11). Try to clean up such code when you find it, or at least not make such usage any more widespread. +## Non-owning pointers in class fields + +Use `raw_ptr<T>` for class and struct fields in place of a raw C++ pointer `T*` +whenever possible, except in paths that include `/renderer/` or +`blink/public/web/`. `raw_ptr<T>` is a non-owning smart pointer that has +improved memory-safety over raw pointers, and can prevent exploitation of a +significant percentage of Use-after-Free bugs. + +Using `raw_ptr<T>` may not be possible in rare cases for +[performance reasons](../../base/memory/raw_ptr.md#Performance). +Additionally, `raw_ptr<T>` doesn’t support some C++ scenarios (e.g. `constexpr`, +ObjC pointers). Tooling will help to encourage use of `raw_ptr<T>`. See +[raw_ptr.md](../../base/memory/raw_ptr.md#When-to-use-raw_ptr_T) +for how to add exclusions. + ## Forward declarations vs. #includes Unlike the Google style guide, Chromium style prefers forward declarations to |