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

Side by Side Diff: include/v8.h

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: Make decompressor class public Created 9 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | samples/shell.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2686 matching lines...) Expand 10 before | Expand all | Expand 10 after
2697 enum CompressionAlgorithm { 2697 enum CompressionAlgorithm {
2698 kUncompressed, 2698 kUncompressed,
2699 kBZip2 2699 kBZip2
2700 }; 2700 };
2701 2701
2702 const char* data; 2702 const char* data;
2703 int compressed_size; 2703 int compressed_size;
2704 int raw_size; 2704 int raw_size;
2705 }; 2705 };
2706 2706
2707
2708 /**
2709 * A helper class for driving V8 startup data decompression. It is based on
2710 * "CompressedStartupData" API functions from the V8 class. It isn't mandatory
2711 * for an embedder to use this class, instead, API functions can be used
2712 * directly.
2713 *
2714 * For an example of the class usage, see the "shell.cc" sample application.
2715 */
2716 class V8EXPORT StartupDataDecompressor {
2717 public:
2718 StartupDataDecompressor();
2719 virtual ~StartupDataDecompressor();
2720 int Decompress();
2721
2722 protected:
2723 virtual int DecompressData(char* raw_data,
2724 int* raw_data_size,
2725 const char* compressed_data,
2726 int compressed_data_size) = 0;
2727
2728 private:
2729 char** raw_data;
2730 };
2731
2707 /** 2732 /**
2708 * Container class for static utility functions. 2733 * Container class for static utility functions.
2709 */ 2734 */
2710 class V8EXPORT V8 { 2735 class V8EXPORT V8 {
2711 public: 2736 public:
2712 /** Set the callback to invoke in case of fatal errors. */ 2737 /** Set the callback to invoke in case of fatal errors. */
2713 static void SetFatalErrorHandler(FatalErrorCallback that); 2738 static void SetFatalErrorHandler(FatalErrorCallback that);
2714 2739
2715 /** 2740 /**
2716 * Set the callback to invoke to check if code generation from 2741 * Set the callback to invoke to check if code generation from
(...skipping 29 matching lines...) Expand all
2746 * 2771 *
2747 * This is how interaction with V8 should look like: 2772 * This is how interaction with V8 should look like:
2748 * int compressed_data_count = v8::V8::GetCompressedStartupDataCount(); 2773 * int compressed_data_count = v8::V8::GetCompressedStartupDataCount();
2749 * v8::StartupData* compressed_data = 2774 * v8::StartupData* compressed_data =
2750 * new v8::StartupData[compressed_data_count]; 2775 * new v8::StartupData[compressed_data_count];
2751 * v8::V8::GetCompressedStartupData(compressed_data); 2776 * v8::V8::GetCompressedStartupData(compressed_data);
2752 * ... decompress data (compressed_data can be updated in-place) ... 2777 * ... decompress data (compressed_data can be updated in-place) ...
2753 * v8::V8::SetDecompressedStartupData(compressed_data); 2778 * v8::V8::SetDecompressedStartupData(compressed_data);
2754 * ... now V8 can be initialized 2779 * ... now V8 can be initialized
2755 * ... make sure the decompressed data stays valid until V8 shutdown 2780 * ... make sure the decompressed data stays valid until V8 shutdown
2781 *
2782 * A helper class StartupDataDecompressor is provided. It implements
2783 * the protocol of the interaction described above, and can be used in
2784 * most cases instead of calling these API functions directly.
2756 */ 2785 */
2757 static StartupData::CompressionAlgorithm GetCompressedStartupDataAlgorithm(); 2786 static StartupData::CompressionAlgorithm GetCompressedStartupDataAlgorithm();
2758 static int GetCompressedStartupDataCount(); 2787 static int GetCompressedStartupDataCount();
2759 static void GetCompressedStartupData(StartupData* compressed_data); 2788 static void GetCompressedStartupData(StartupData* compressed_data);
2760 static void SetDecompressedStartupData(StartupData* decompressed_data); 2789 static void SetDecompressedStartupData(StartupData* decompressed_data);
2761 2790
2762 /** 2791 /**
2763 * Adds a message listener. 2792 * Adds a message listener.
2764 * 2793 *
2765 * The same message listener can be added more than once and in that 2794 * The same message listener can be added more than once and in that
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after
4115 4144
4116 4145
4117 } // namespace v8 4146 } // namespace v8
4118 4147
4119 4148
4120 #undef V8EXPORT 4149 #undef V8EXPORT
4121 #undef TYPE_CHECK 4150 #undef TYPE_CHECK
4122 4151
4123 4152
4124 #endif // V8_H_ 4153 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | samples/shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698