Commit 35137ce6 authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Remove static initializers in hud_display.cc.

std::unique_ptr should not be used at the global scope. Switch to a raw
pointer.

Bug: 537099
Change-Id: I2d3b6ba65cf528003cfae21edb683405d62f9082
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2430726
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811585}
parent fb87b8ba
......@@ -33,14 +33,14 @@ namespace {
constexpr size_t kHUDGraphsInset = 5;
// Default HUDDisplayView height.
static constexpr size_t kDefaultHUDGraphHeight = 300;
constexpr size_t kDefaultHUDGraphHeight = 300;
// Top border + Header height + margin + graph height + bottom border..
constexpr int kHUDViewDefaultHeight =
kHUDInset + (kHUDSettingsIconSize + 2 * kSettingsIconBorder) +
kHUDGraphsInset + kDefaultHUDGraphHeight + kHUDInset;
std::unique_ptr<views::Widget> g_hud_widget;
views::Widget* g_hud_widget = nullptr;
// ClientView that return HTNOWHERE by default. A child view can receive event
// by setting kHitTestComponentKey property to HTCLIENT.
......@@ -79,9 +79,11 @@ END_METADATA
// static
void HUDDisplayView::Destroy() {
g_hud_widget.reset();
delete g_hud_widget;
g_hud_widget = nullptr;
}
// static
void HUDDisplayView::Toggle() {
if (g_hud_widget) {
Destroy();
......@@ -101,7 +103,7 @@ void HUDDisplayView::Toggle() {
widget->GetLayer()->SetName("HUDDisplayView");
widget->Show();
g_hud_widget = base::WrapUnique(widget);
g_hud_widget = widget;
}
HUDDisplayView::HUDDisplayView() {
......
......@@ -36,7 +36,6 @@ _CROS_SI_FILE_ALLOWLIST = {
'debugallocation_shim.cc', # TODO(crbug.com/973552): Remove.
'iostream.cpp', # TODO(crbug.com/973554): Remove.
'spinlock.cc', # TODO(crbug.com/973556): Remove.
'hud_display.cc', # TODO(crbug.com/537099): Remove.
'int256.cc', # TODO(crbug.com/537099): Remove.
'native_message_host_chromeos.cc', # TODO(crbug.com/537099): Remove.
'protobuf_http_status.cc', # TODO(crbug.com/537099): Remove.
......
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