Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(783)

Unified Diff: samples/shell.cc

Issue 7066048: Compress sources of JS libraries in addition to the snapshot. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/SConscript » ('j') | src/SConscript » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/shell.cc
diff --git a/samples/shell.cc b/samples/shell.cc
index 0a9b8a0d4f899ba423af2eafd4135341dada952f..d6475034f97481805b0ba8535e5ee2330a0c1d04 100644
--- a/samples/shell.cc
+++ b/samples/shell.cc
@@ -309,17 +309,19 @@ int main(int argc, char* argv[]) {
v8::StartupData* compressed_data = new v8::StartupData[compressed_data_count];
v8::V8::GetCompressedStartupData(compressed_data);
for (int i = 0; i < compressed_data_count; ++i) {
- char* decompressed = new char[compressed_data[i].raw_size];
unsigned int decompressed_size = compressed_data[i].raw_size;
- int result =
- BZ2_bzBuffToBuffDecompress(decompressed,
- &decompressed_size,
- const_cast<char*>(compressed_data[i].data),
- compressed_data[i].compressed_size,
- 0, 1);
- if (result != BZ_OK) {
- fprintf(stderr, "bzip error code: %d\n", result);
- exit(1);
+ char* decompressed = new char[decompressed_size];
+ if (compressed_data[i].compressed_size != 0) {
Vitaly Repeshko 2011/06/06 10:08:23 When does this happen?
mnaganov (inactive) 2011/06/06 13:40:18 When there is no snapshot. See snapshot-empty.cc.
+ int result =
+ BZ2_bzBuffToBuffDecompress(decompressed,
+ &decompressed_size,
+ const_cast<char*>(compressed_data[i].data),
+ compressed_data[i].compressed_size,
+ 0, 1);
+ if (result != BZ_OK) {
+ fprintf(stderr, "bzip error code: %d\n", result);
+ exit(1);
+ }
}
compressed_data[i].data = decompressed;
Vitaly Repeshko 2011/06/06 10:08:23 It seems strange that we assign a block of fresh u
mnaganov (inactive) 2011/06/06 13:40:18 We should never read from it in this case. I've ad
compressed_data[i].raw_size = decompressed_size;
« no previous file with comments | « no previous file | src/SConscript » ('j') | src/SConscript » ('J')

Powered by Google App Engine
This is Rietveld 408576698