Commit 37995b91 authored by dhollowa@chromium.org's avatar dhollowa@chromium.org

Fix statics in NativeTheme*::instance() to avoid destruction post main

Intentionally leaks NativeTheme* singletons to avoid destructor firing after main.  Memory bots will need suppressions for this.

Avoids clang error:

  time make -k -j16 compositor_unittests
    CXX(target) out/Debug/obj.target/ui/ui/gfx/native_theme_aura.o
  ui/gfx/native_theme_aura.cc:27:32: error: declaration requires an exit-time destructor [-Werror,-Wexit-time-destructors]
    static const NativeThemeAura s_native_theme;

BUG=none
TEST=compiles under clang -Wexit-time-destructors
R=jamescook@chromium.org, ben@chromium.org

Review URL: http://codereview.chromium.org/8520026

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110334 0039d316-1c4b-4281-b951-d872f2087c98
parent aa22b24e
......@@ -6,6 +6,7 @@
#include <limits>
#include "base/basictypes.h"
#include "base/logging.h"
#include "grit/gfx_resources.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
......@@ -52,8 +53,7 @@ static SkColor BrightenColor(const color_utils::HSL& hsl,
// static
NativeThemeAndroid* NativeThemeAndroid::instance() {
// The global NativeThemeAndroid instance.
static NativeThemeAndroid s_native_theme;
CR_DEFINE_STATIC_LOCAL(NativeThemeAndroid, s_native_theme, ());
return &s_native_theme;
}
......
......@@ -4,6 +4,7 @@
#include "ui/gfx/native_theme_aura.h"
#include "base/basictypes.h"
#include "grit/gfx_resources.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/size.h"
......@@ -24,7 +25,7 @@ const NativeTheme* NativeTheme::instance() {
// static
const NativeThemeAura* NativeThemeAura::instance() {
static const NativeThemeAura s_native_theme;
CR_DEFINE_STATIC_LOCAL(NativeThemeAura, s_native_theme, ());
return &s_native_theme;
}
......
......@@ -4,6 +4,7 @@
#include "ui/gfx/native_theme_chromeos.h"
#include "base/basictypes.h"
#include "base/logging.h"
#include "grit/gfx_resources.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
......@@ -239,7 +240,6 @@ const NativeTheme* NativeTheme::instance() {
// static
const NativeThemeChromeos* NativeThemeChromeos::instance() {
// The global NativeThemeChromeos instance.
CR_DEFINE_STATIC_LOCAL(NativeThemeChromeos, s_native_theme, ());
return &s_native_theme;
}
......
......@@ -4,6 +4,8 @@
#include "ui/gfx/native_theme_gtk.h"
#include "base/basictypes.h"
namespace gfx {
// static
......
......@@ -9,6 +9,7 @@
#include <vsstyle.h>
#include <vssym32.h>
#include "base/basictypes.h"
#include "base/logging.h"
#include "base/memory/scoped_handle.h"
#include "base/memory/scoped_ptr.h"
......@@ -65,8 +66,7 @@ const NativeTheme* NativeTheme::instance() {
// static
const NativeThemeWin* NativeThemeWin::instance() {
// The global NativeThemeWin instance.
static const NativeThemeWin s_native_theme;
CR_DEFINE_STATIC_LOCAL(NativeThemeWin, s_native_theme, ());
return &s_native_theme;
}
......
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