|
Use SkSet to fix issue when pdf generates an exp number of resources.
The problem fixed - http://code.google.com/p/skia/issues/detail?id=940 - is that getResources will recursively obtain all child resource recursively without checking for duplicates.
If we have lots of duplicates, then we try to build a very large vector (exponential with the number of nodes usually) and sooner or later we end up using too much memory and crash.
A possible solution could have been to make sure resources do not have duplicates, but that requirement is impractical, and it this leaves the solution fragile, if there is any issue in the tree, we crash.
When we emit the pdf, the large number of duplicates is not an issue, because SkPDFCatalog::addObject will deal with duplicates.
I have run the gm with --config pdf, and the images are 100% same bits, while the pdfs have the same size but some very small changes, the order of some objects.
Committed: https://code.google.com/p/skia/source/detail?r=7883
Total comments: 8
Total comments: 8
Total comments: 22
Total comments: 9
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+193 lines, -124 lines) |
Patch |
|
M |
include/pdf/SkPDFDevice.h
|
View
|
1
2
3
4
5
6
7
8
9
10
|
2 chunks |
+10 lines, -2 lines |
2 comments
|
Download
|
|
M |
include/pdf/SkPDFDocument.h
|
View
|
1
2
3
4
5
6
7
8
9
10
|
2 chunks |
+3 lines, -1 line |
0 comments
|
Download
|
|
M |
src/pdf/SkPDFCatalog.h
|
View
|
1
2
3
4
5
6
7
8
9
10
|
2 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
src/pdf/SkPDFCatalog.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
|
2 chunks |
+15 lines, -12 lines |
0 comments
|
Download
|
|
M |
src/pdf/SkPDFDevice.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
|
2 chunks |
+41 lines, -22 lines |
0 comments
|
Download
|
|
M |
src/pdf/SkPDFDocument.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
|
8 chunks |
+41 lines, -35 lines |
6 comments
|
Download
|
|
M |
src/pdf/SkPDFFont.h
|
View
|
1
2
3
4
5
6
7
8
9
10
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
|
M |
src/pdf/SkPDFFont.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
|
1 chunk |
+3 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/pdf/SkPDFFormXObject.h
|
View
|
1
2
3
4
5
6
7
8
9
10
|
1 chunk |
+3 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/pdf/SkPDFFormXObject.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
|
2 chunks |
+8 lines, -12 lines |
0 comments
|
Download
|
|
M |
src/pdf/SkPDFGraphicState.h
|
View
|
1
2
3
4
5
6
7
8
9
10
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
|
M |
src/pdf/SkPDFGraphicState.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
|
1 chunk |
+4 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/pdf/SkPDFImage.h
|
View
|
1
2
3
4
5
6
7
8
9
10
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
|
M |
src/pdf/SkPDFImage.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
|
1 chunk |
+3 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/pdf/SkPDFPage.h
|
View
|
1
2
3
4
5
6
7
8
9
10
|
1 chunk |
+4 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/pdf/SkPDFPage.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
|
2 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/pdf/SkPDFShader.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
|
3 chunks |
+12 lines, -6 lines |
0 comments
|
Download
|
|
M |
src/pdf/SkPDFTypes.h
|
View
|
1
2
3
4
5
6
7
8
9
10
|
3 chunks |
+19 lines, -9 lines |
1 comment
|
Download
|
|
M |
src/pdf/SkPDFTypes.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
|
2 chunks |
+15 lines, -7 lines |
0 comments
|
Download
|
Total messages: 15
|