Effects Bug Fix
Certain compilers in an effort to optimize code chop off files that are never
used. By adding a flag to common conditions and variables we can force skia to
recompile with global static initializers off. By making a call to
SkGraphics::Init we now register all those functions that had been previously
automatically excluded by the compiler.
Review URL: https://codereview.appspot.com/6443112
git-svn-id: http://skia.googlecode.com/svn/trunk@5057 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp
index e2d4bf9..a311916 100644
--- a/debugger/QT/SkDebuggerGUI.cpp
+++ b/debugger/QT/SkDebuggerGUI.cpp
@@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
-#include <iostream>
#include "SkDebuggerGUI.h"
+#include "SkGraphics.h"
#include <QListWidgetItem>
SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) :
@@ -91,9 +91,13 @@
fMenuEdit.setDisabled(true);
fMenuNavigate.setDisabled(true);
fMenuView.setDisabled(true);
+
+ SkGraphics::Init();
}
-SkDebuggerGUI::~SkDebuggerGUI() {}
+SkDebuggerGUI::~SkDebuggerGUI() {
+ SkGraphics::Term();
+}
void SkDebuggerGUI::actionBreakpoints() {
fBreakpointsActivated = !fBreakpointsActivated;
diff --git a/debugger/make_debugger.sh b/debugger/make_debugger.sh
new file mode 100755
index 0000000..86a7ff9
--- /dev/null
+++ b/debugger/make_debugger.sh
@@ -0,0 +1,12 @@
+# Used to recompile required skia libraries with static initializers turned
+# off. This fixes a bug in which the linux compiler was incorrectly stripping
+# required global static methods in an optimization effort.
+
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+CWD=$SCRIPT_DIR/../
+
+DEFINES="skia_static_initializers=0"
+export GYP_DEFINES="$DEFINES"
+
+make clean -C $CWD
+make -C $CWD debugger -j
diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi
index 2b9800f..eff47bf 100644
--- a/gyp/common_conditions.gypi
+++ b/gyp/common_conditions.gypi
@@ -1,6 +1,9 @@
# conditions used in both common.gypi and skia.gyp in chromium
#
{
+ 'defines': [
+ 'SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=<(skia_static_initializers)',
+ ],
'conditions' : [
['skia_gpu == 1',
{
@@ -135,7 +138,7 @@
},
],
- ['skia_os == "mac"',
+ ['skia_os == "mac"',
{
'defines': [
'SK_BUILD_FOR_MAC',
@@ -195,7 +198,7 @@
},
],
- ['skia_os == "ios"',
+ ['skia_os == "ios"',
{
'defines': [
'SK_BUILD_FOR_IOS',
@@ -212,8 +215,8 @@
},
},
],
-
- ['skia_os == "android"',
+
+ ['skia_os == "android"',
{
'defines': [
'SK_BUILD_FOR_ANDROID',
@@ -285,7 +288,7 @@
}],
],
}],
- ],
+ ],
},
],
diff --git a/gyp/common_variables.gypi b/gyp/common_variables.gypi
index f738b8a..fd2c7e7 100644
--- a/gyp/common_variables.gypi
+++ b/gyp/common_variables.gypi
@@ -72,6 +72,7 @@
'skia_arch_type%': 'x86',
'android_make_apk%': 1,
'skia_gpu%': 1,
+ 'skia_static_initializers%': 1,
},
# Re-define all variables defined within the level-2 'variables' dict,
@@ -86,7 +87,8 @@
'skia_arch_width%': '<(skia_arch_width)',
'android_make_apk%': '<(android_make_apk)',
'skia_gpu%': '<(skia_gpu)',
-
+ 'skia_static_initializers%': '<(skia_static_initializers)',
+
# These are referenced by our .gypi files that list files (e.g. core.gypi)
#
'skia_src_path%': '../src',
diff --git a/gyp/debugger.gyp b/gyp/debugger.gyp
index 8848832..d3cf674 100644
--- a/gyp/debugger.gyp
+++ b/gyp/debugger.gyp
@@ -10,7 +10,7 @@
'../src/gpu', # To pull gl/GrGLUtil.h
],
'sources': [
- '../debugger/debuggermain.cpp',
+ '../debugger/debuggermain.cpp',
'../debugger/SkDebugCanvas.h',
'../debugger/SkDebugCanvas.cpp',
'../debugger/SkDebugger.cpp',