Remove usages of XInternAtom
Previously, there were multiple places in Chrome where ui::GetAtom or
XInternAtom was used without caching. This requires a blocking
round-trip to the X server for each of these. Other code used
X11AtomCache. However, there were multiple separate caches which each
require a round-trip on construction. This CL makes X11AtomCache a
singleton. There will be only a single round-trip to get all atoms on
browser startup.
This CL:
* Replaces most usage of XInternAtom(s) with ui::GetAtom or
ui::X11AtomCache::GetAtom()
* Makes ui::GetAtom use X11AtomCache
* Makes X11AtomCache a singleton
* Previously there were separate caches, many of which had duplicate
atoms. This change consolidates them into one place.
* Adds a PRESUBMIT warning to prevent usage of XInternAtom
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
BUG=730889
Review-Url: https://codereview.chromium.org/2914103002
Cr-Commit-Position: refs/heads/master@{#477836}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 79b3f70a..c0324ab8 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -189,6 +189,17 @@
),
),
(
+ r'XInternAtom|xcb_intern_atom',
+ (
+ 'Use ui::GetAtom() or ui::X11AtomCache::GetAtom() instead of',
+ 'interning atoms directly.',
+ ),
+ True,
+ (
+ r"^ui[\\\/]gfx[\\\/]x[\\\/]x11_atom_cache\.cc$",
+ ),
+ ),
+ (
'ScopedAllowIO',
(
'New production code should not use ScopedAllowIO (using it in',