Commit 01b0ec51 authored by Daniel Cheng's avatar Daniel Cheng Committed by Commit Bot

Update Blink C++ style guide to prefer WTF over STL types.

Change-Id: Ic18b465206f29e854a7a463e75436f6ea7c37812
Reviewed-on: https://chromium-review.googlesource.com/957591
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542904}
parent aebdfc4f
...@@ -47,6 +47,28 @@ FrameLoader::FrameLoader(LocalFrame* frame) ...@@ -47,6 +47,28 @@ FrameLoader::FrameLoader(LocalFrame* frame)
} }
``` ```
## Prefer WTF types over STL types
Outside of `//third_party/WebKit/common`, Blink should use WTF types. STL string
and container types should only be used at the boundary to interoperate with
'//base', `//third_party/WebKit/common`, and other Chromium-side code.
Similarly, Blink should prefer `KURL` over `GURL` and `SecurityOrigin` over
`url::Origin`.
**Good:**
```c++
String title;
Vector<KURL> urls;
HashMap<int, Deque<RefPtr<SecurityOrigin>>> origins;
```
**Bad:**
```c++
std::string title;
std::vector<GURL> urls;
std::unordered_map<int, std::deque<url::Origin>> origins;
```
## Use Filename_h as the header include guard ## Use Filename_h as the header include guard
Header include guards in Blink should match the filename exactly, replacing the Header include guards in Blink should match the filename exactly, replacing the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment