Skip to content

Commit

Permalink
Build cc/ with -Wexit-time-destructors.
Browse files Browse the repository at this point in the history
Bug: 101600
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I39cc247a432861bf8e7ac815dc2d1a2834a2cf08
Reviewed-on: https://chromium-review.googlesource.com/1240975
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593986}
  • Loading branch information
nico authored and Commit Bot committed Sep 25, 2018
1 parent e228478 commit 803e0a5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion cc/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ cc_component("cc") {
defines = [ "CC_IMPLEMENTATION=1" ]
}

cc_static_library("test_support") {
cc_test_static_library("test_support") {
testonly = true
sources = [
"test/animation_test_common.cc",
Expand Down
24 changes: 11 additions & 13 deletions cc/cc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,16 @@ import("//build/config/jumbo.gni")
import("//testing/test.gni")

cc_remove_configs = []
cc_add_configs = [ "//build/config:precompiled_headers" ]
cc_add_configs = [
"//build/config:precompiled_headers",
"//build/config/compiler:wexit_time_destructors",
]

if (!is_debug && (is_win || is_android)) {
cc_remove_configs += [ "//build/config/compiler:default_optimization" ]
cc_add_configs += [ "//build/config/compiler:optimize_max" ]
}

template("cc_source_set") {
jumbo_source_set(target_name) {
forward_variables_from(invoker, "*", [ "configs" ])
if (defined(invoker.configs)) {
configs += invoker.configs
}
configs -= cc_remove_configs
configs += cc_add_configs
}
}

template("cc_component") {
jumbo_component(target_name) {
forward_variables_from(invoker, "*", [ "configs" ])
Expand All @@ -35,14 +27,17 @@ template("cc_component") {
}
}

template("cc_static_library") {
template("cc_test_static_library") {
jumbo_static_library(target_name) {
forward_variables_from(invoker, "*", [ "configs" ])
if (defined(invoker.configs)) {
configs += invoker.configs
}
configs -= cc_remove_configs
configs += cc_add_configs

# Not needed in test code.
configs -= [ "//build/config/compiler:wexit_time_destructors" ]
}
}

Expand All @@ -54,5 +49,8 @@ template("cc_test") {
}
configs -= cc_remove_configs
configs += cc_add_configs

# Not needed in test code.
configs -= [ "//build/config/compiler:wexit_time_destructors" ]
}
}
5 changes: 3 additions & 2 deletions cc/layers/picture_layer_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <set>

#include "base/metrics/histogram_macros.h"
#include "base/no_destructor.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event_argument.h"
#include "build/build_config.h"
Expand Down Expand Up @@ -666,11 +667,11 @@ bool PictureLayerImpl::UpdateTiles() {
!layer_tree_impl()->SmoothnessTakesPriority();
}

static const Occlusion kEmptyOcclusion;
static const base::NoDestructor<Occlusion> kEmptyOcclusion;
const Occlusion& occlusion_in_content_space =
layer_tree_impl()->settings().use_occlusion_for_tile_prioritization
? draw_properties().occlusion_in_content_space
: kEmptyOcclusion;
: *kEmptyOcclusion;

// Pass |occlusion_in_content_space| for |occlusion_in_layer_space| since
// they are the same space in picture layer, as contents scale is always 1.
Expand Down
5 changes: 3 additions & 2 deletions cc/paint/discardable_image_map.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "base/auto_reset.h"
#include "base/containers/adapters.h"
#include "base/metrics/histogram_macros.h"
#include "base/no_destructor.h"
#include "base/trace_event/trace_event.h"
#include "cc/paint/paint_filter.h"
#include "cc/paint/paint_op_buffer.h"
Expand Down Expand Up @@ -456,9 +457,9 @@ void DiscardableImageMap::GetDiscardableImagesInRect(

const DiscardableImageMap::Rects& DiscardableImageMap::GetRectsForImage(
PaintImage::Id image_id) const {
static const Rects kEmptyRects;
static const base::NoDestructor<Rects> kEmptyRects;
auto it = image_id_to_rects_.find(image_id);
return it == image_id_to_rects_.end() ? kEmptyRects : it->second;
return it == image_id_to_rects_.end() ? *kEmptyRects : it->second;
}

void DiscardableImageMap::Reset() {
Expand Down

0 comments on commit 803e0a5

Please sign in to comment.