Commit 5ca659f0 authored by Mario Bianucci's avatar Mario Bianucci Committed by Commit Bot

Add comment explaining when |display_private_| can be null

Based on discussions here[1], it isn't obvious why |display_private_|
should be null checked before use. Adding a comment here from this
discussion should make this clearer.

[1]: https://chromium-review.googlesource.com/c/chromium/src/+/2259015/21/ui/compositor/compositor.cc#774

Bug: 1107926
Change-Id: I5109c72bb6223a4b79ab1706a9dffe08d6a23299
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2315091Reviewed-by: default avatarkylechar <kylechar@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Mario Bianucci <mabian@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#791402}
parent f1228c44
...@@ -416,6 +416,13 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, ...@@ -416,6 +416,13 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient,
ui::ContextFactory* context_factory_; ui::ContextFactory* context_factory_;
// |display_private_| can be null for:
// 1. Tests that don't set |display_private_|.
// 2. Intermittently on creation or if there is some kind of error (GPU crash,
// GL context loss, etc.) that triggers reinitializing message pipes to the
// GPU process RootCompositorFrameSinkImpl.
// Therefore, it should always be null checked for safety before use.
//
// These pointers are owned by |context_factory_|, and must be reset before // These pointers are owned by |context_factory_|, and must be reset before
// calling RemoveCompositor(); // calling RemoveCompositor();
viz::mojom::DisplayPrivate* display_private_ = nullptr; viz::mojom::DisplayPrivate* display_private_ = nullptr;
......
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