- Revision
- 97998
- Author
- [email protected]
- Date
- 2011-10-20 10:46:23 -0700 (Thu, 20 Oct 2011)
Log Message
[Chromium] Reduce dependencies of ImageDiff to compile it for Android.
https://bugs.webkit.org/show_bug.cgi?id=69997
Patch by Hao Zheng <[email protected]> on 2011-10-20
Reviewed by Tony Chang.
This change is required to make ImageDiff for Android, and can benefit
other platforms, too. On Android, most targets are built as
toolsets:target. while ImageDiff needs to be built as toolsets:host.
Currently, building the standalone target of ImageDiff depends on about
85 other targets (try make ImageDiff'), which is inefficient. After the
change, ImageDiff only depends on webkit_support_gfx, which in turn
depends on libpng and zlib.
Source/WebKit/chromium:
* WebKit.gyp:
Tools:
* DumpRenderTree/chromium/ImageDiff.cpp:
(main):
Modified Paths
Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (97997 => 97998)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-10-20 17:33:40 UTC (rev 97997)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-10-20 17:46:23 UTC (rev 97998)
@@ -1,3 +1,20 @@
+2011-10-20 Hao Zheng <[email protected]>
+
+ [Chromium] Reduce dependencies of ImageDiff to compile it for Android.
+ https://bugs.webkit.org/show_bug.cgi?id=69997
+
+ Reviewed by Tony Chang.
+
+ This change is required to make ImageDiff for Android, and can benefit
+ other platforms, too. On Android, most targets are built as
+ toolsets:target. while ImageDiff needs to be built as toolsets:host.
+ Currently, building the standalone target of ImageDiff depends on about
+ 85 other targets (try make ImageDiff'), which is inefficient. After the
+ change, ImageDiff only depends on webkit_support_gfx, which in turn
+ depends on libpng and zlib.
+
+ * WebKit.gyp:
+
2011-10-20 Sheriff Bot <[email protected]>
Unreviewed, rolling out r97917.
Modified: trunk/Source/WebKit/chromium/WebKit.gyp (97997 => 97998)
--- trunk/Source/WebKit/chromium/WebKit.gyp 2011-10-20 17:33:40 UTC (rev 97997)
+++ trunk/Source/WebKit/chromium/WebKit.gyp 2011-10-20 17:46:23 UTC (rev 97998)
@@ -1024,9 +1024,7 @@
'target_name': 'ImageDiff',
'type': 'executable',
'dependencies': [
- 'webkit',
- '../../_javascript_Core/_javascript_Core.gyp/_javascript_Core.gyp:wtf',
- '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support',
+ '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support_gfx',
],
'include_dirs': [
'../../_javascript_Core',
@@ -1035,13 +1033,17 @@
'sources': [
'../../../Tools/DumpRenderTree/chromium/ImageDiff.cpp',
],
+ 'conditions': [
+ ['OS=="android"', {
+ 'toolsets': ['host'],
+ }],
+ ],
},
{
'target_name': 'DumpRenderTree',
'type': 'executable',
'mac_bundle': 1,
'dependencies': [
- 'ImageDiff',
'inspector_resources',
'webkit',
'../../_javascript_Core/_javascript_Core.gyp/_javascript_Core.gyp:wtf_config',
@@ -1190,11 +1192,16 @@
['exclude', 'Gtk\\.cpp$']
]
}],
- ['OS!="android"', {
+ ['OS=="android"', {
+ 'dependencies': [
+ 'ImageDiff#host',
+ ],
+ },{ # OS!="android"
'sources/': [
['exclude', '(Android)\\.cpp$']
],
'dependencies': [
+ 'ImageDiff',
'copy_TestNetscapePlugIn',
'<(chromium_src_dir)/third_party/mesa/mesa.gyp:osmesa',
],
Modified: trunk/Tools/ChangeLog (97997 => 97998)
--- trunk/Tools/ChangeLog 2011-10-20 17:33:40 UTC (rev 97997)
+++ trunk/Tools/ChangeLog 2011-10-20 17:46:23 UTC (rev 97998)
@@ -1,3 +1,21 @@
+2011-10-20 Hao Zheng <[email protected]>
+
+ [Chromium] Reduce dependencies of ImageDiff to compile it for Android.
+ https://bugs.webkit.org/show_bug.cgi?id=69997
+
+ Reviewed by Tony Chang.
+
+ This change is required to make ImageDiff for Android, and can benefit
+ other platforms, too. On Android, most targets are built as
+ toolsets:target. while ImageDiff needs to be built as toolsets:host.
+ Currently, building the standalone target of ImageDiff depends on about
+ 85 other targets (try make ImageDiff'), which is inefficient. After the
+ change, ImageDiff only depends on webkit_support_gfx, which in turn
+ depends on libpng and zlib.
+
+ * DumpRenderTree/chromium/ImageDiff.cpp:
+ (main):
+
2011-10-20 Leandro Pereira <[email protected]>
[EFL] Unreviewed DumpRenderTree build fix.
Modified: trunk/Tools/DumpRenderTree/chromium/ImageDiff.cpp (97997 => 97998)
--- trunk/Tools/DumpRenderTree/chromium/ImageDiff.cpp 2011-10-20 17:33:40 UTC (rev 97997)
+++ trunk/Tools/DumpRenderTree/chromium/ImageDiff.cpp 2011-10-20 17:46:23 UTC (rev 97998)
@@ -39,17 +39,25 @@
#include "webkit/support/webkit_support_gfx.h"
#include <algorithm>
#include <iterator>
+#include <limits.h>
+#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <vector>
-#include <wtf/OwnArrayPtr.h>
-#include <wtf/Vector.h>
#if OS(WINDOWS)
#include <windows.h>
#define PATH_MAX MAX_PATH
#endif
+// Define macro here to make ImageDiff independent of _javascript_Core.
+#define ASSERT(assertion) do \
+ if (!(assertion)) { \
+ fprintf(stderr, "ASSERT failed at %s:%s: " #assertion ".", __FILE__, __LINE__); \
+ exit(1); \
+ } \
+while (0)
+
using namespace std;
// Causes the app to remain open, waiting for pairs of filenames on stdin.
@@ -97,14 +105,18 @@
if (!byteLength)
return false;
- OwnArrayPtr<unsigned char> source = adoptArrayPtr(new unsigned char[byteLength]);
- if (fread(source.get(), 1, byteLength, stdin) != byteLength)
+ unsigned char* source = new unsigned char[byteLength];
+ if (fread(source, 1, byteLength, stdin) != byteLength) {
+ delete [] source;
return false;
+ }
- if (!webkit_support::DecodePNG(source.get(), byteLength, &m_data, &m_width, &m_height)) {
+ if (!webkit_support::DecodePNG(source, byteLength, &m_data, &m_width, &m_height)) {
+ delete [] source;
clear();
return false;
}
+ delete [] source;
return true;
}
@@ -449,7 +461,7 @@
int main(int argc, const char* argv[])
{
- Vector<const char*> values;
+ std::vector<const char*> values;
bool pollStdin = false;
bool generateDiff = false;
bool shouldWritePercentages = false;
@@ -464,7 +476,7 @@
else if (!strcmp(argv[i], optionWeightedIntensity))
comparator = weightedPercentageDifferent;
else
- values.append(argv[i]);
+ values.push_back(argv[i]);
}
if (pollStdin) {