Commit c77be1dd authored by Nico Weber's avatar Nico Weber

Build ui/gfx with -Wexit-time-destructors.

Bug: 101600
Change-Id: Ide53ff3455d66ec222dd7a92441161ae7a1f5962
Reviewed-on: https://chromium-review.googlesource.com/1251322Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
Reviewed-by: default avatarGreg Kerr <kerrnel@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595496}
parent 780e7440
......@@ -35,6 +35,7 @@ jumbo_component("geometry_skia") {
public_deps = [
":gfx_export",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
deps = [
"//base",
"//gpu/vulkan:buildflags",
......@@ -231,6 +232,7 @@ jumbo_component("gfx") {
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
"//build/config/compiler:no_size_t_to_int_warning",
"//build/config/compiler:wexit_time_destructors",
]
# This is part of the gfx component in the component build.
......@@ -404,20 +406,6 @@ jumbo_component("color_space") {
defines = [ "COLOR_SPACE_IMPLEMENTATION" ]
}
# Depend on this to use half_float.h without pulling in all of gfx.
source_set("half_float") {
sources = [
"half_float.h",
]
defines = [ "GFX_IMPLEMENTATION" ]
public_deps = [
":gfx_export",
"//base",
]
}
# Depend on this to use native_widget_types.h without pulling in all of gfx.
source_set("native_widget_types") {
public = [
......@@ -452,6 +440,8 @@ source_set("selection_bound_sources") {
"selection_bound.h",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
defines = [ "GFX_IMPLEMENTATION" ]
public_deps = [
......@@ -519,6 +509,8 @@ jumbo_source_set("memory_buffer_sources") {
]
}
configs += [ "//build/config/compiler:wexit_time_destructors" ]
defines = [ "GFX_IMPLEMENTATION" ]
public_deps = [
......
......@@ -13,6 +13,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/no_destructor.h"
#include "build/build_config.h"
#include "third_party/skia/include/core/SkTypeface.h"
#include "ui/gfx/render_text.h"
......@@ -285,10 +286,11 @@ hb_font_t* CreateHarfBuzzFont(sk_sp<SkTypeface> skia_face,
SkScalar text_size,
const FontRenderParams& params,
bool subpixel_rendering_suppressed) {
// TODO(ckocagil): This shouldn't grow indefinitely. Maybe use base::MRUCache?
static std::map<SkFontID, FaceCache> face_caches;
// TODO(https://crbug.com/890298): This shouldn't grow indefinitely.
// Maybe use base::MRUCache?
static base::NoDestructor<std::map<SkFontID, FaceCache>> face_caches;
FaceCache* face_cache = &face_caches[skia_face->uniqueID()];
FaceCache* face_cache = &(*face_caches)[skia_face->uniqueID()];
if (face_cache->first.get() == NULL)
face_cache->first.Init(skia_face.get());
......
......@@ -13,6 +13,10 @@
#include "mojo/public/cpp/system/scope_to_message_pipe.h"
#endif
#if !defined(OS_LINUX)
#include "base/no_destructor.h"
#endif
namespace mojo {
// static
......@@ -74,8 +78,8 @@ StructTraits<gfx::mojom::GpuMemoryBufferHandleDataView,
#if defined(OS_LINUX)
return handle.native_pixmap_handle;
#else
static gfx::NativePixmapHandle pixmap_handle;
return pixmap_handle;
static base::NoDestructor<gfx::NativePixmapHandle> pixmap_handle;
return *pixmap_handle;
#endif
}
......
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