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

Side by Side Diff: include/v8.h

Issue 6901090: Add support for startup data (snapshot) compression. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: The version I'll commit 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « SConstruct ('k') | samples/process.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 2623 matching lines...) Expand 10 before | Expand all | Expand 10 after
2634 2634
2635 Isolate(); 2635 Isolate();
2636 Isolate(const Isolate&); 2636 Isolate(const Isolate&);
2637 ~Isolate(); 2637 ~Isolate();
2638 Isolate& operator=(const Isolate&); 2638 Isolate& operator=(const Isolate&);
2639 void* operator new(size_t size); 2639 void* operator new(size_t size);
2640 void operator delete(void*, size_t); 2640 void operator delete(void*, size_t);
2641 }; 2641 };
2642 2642
2643 2643
2644 class StartupData {
2645 public:
2646 enum CompressionAlgorithm {
2647 kUncompressed,
2648 kBZip2
2649 };
2650
2651 const char* data;
2652 int compressed_size;
2653 int raw_size;
2654 };
2655
2644 /** 2656 /**
2645 * Container class for static utility functions. 2657 * Container class for static utility functions.
2646 */ 2658 */
2647 class V8EXPORT V8 { 2659 class V8EXPORT V8 {
2648 public: 2660 public:
2649 /** Set the callback to invoke in case of fatal errors. */ 2661 /** Set the callback to invoke in case of fatal errors. */
2650 static void SetFatalErrorHandler(FatalErrorCallback that); 2662 static void SetFatalErrorHandler(FatalErrorCallback that);
2651 2663
2652 /** 2664 /**
2653 * Ignore out-of-memory exceptions. 2665 * Ignore out-of-memory exceptions.
2654 * 2666 *
2655 * V8 running out of memory is treated as a fatal error by default. 2667 * V8 running out of memory is treated as a fatal error by default.
2656 * This means that the fatal error handler is called and that V8 is 2668 * This means that the fatal error handler is called and that V8 is
2657 * terminated. 2669 * terminated.
2658 * 2670 *
2659 * IgnoreOutOfMemoryException can be used to not treat a 2671 * IgnoreOutOfMemoryException can be used to not treat a
2660 * out-of-memory situation as a fatal error. This way, the contexts 2672 * out-of-memory situation as a fatal error. This way, the contexts
2661 * that did not cause the out of memory problem might be able to 2673 * that did not cause the out of memory problem might be able to
2662 * continue execution. 2674 * continue execution.
2663 */ 2675 */
2664 static void IgnoreOutOfMemoryException(); 2676 static void IgnoreOutOfMemoryException();
2665 2677
2666 /** 2678 /**
2667 * Check if V8 is dead and therefore unusable. This is the case after 2679 * Check if V8 is dead and therefore unusable. This is the case after
2668 * fatal errors such as out-of-memory situations. 2680 * fatal errors such as out-of-memory situations.
2669 */ 2681 */
2670 static bool IsDead(); 2682 static bool IsDead();
2671 2683
2672 /** 2684 /**
2685 * The following 4 functions are to be used when V8 is built with
2686 * the 'compress_startup_data' flag enabled. In this case, the
2687 * embedder must decompress startup data prior to initializing V8.
2688 *
2689 * This is how interaction with V8 should look like:
2690 * int compressed_data_count = v8::V8::GetCompressedStartupDataCount();
2691 * v8::StartupData* compressed_data =
2692 * new v8::StartupData[compressed_data_count];
2693 * v8::V8::GetCompressedStartupData(compressed_data);
2694 * ... decompress data (compressed_data can be updated in-place) ...
2695 * v8::V8::SetDecompressedStartupData(compressed_data);
2696 * ... now V8 can be initialized
2697 * ... make sure the decompressed data stays valid until V8 shutdown
2698 */
2699 static StartupData::CompressionAlgorithm GetCompressedStartupDataAlgorithm();
2700 static int GetCompressedStartupDataCount();
2701 static void GetCompressedStartupData(StartupData* compressed_data);
2702 static void SetDecompressedStartupData(StartupData* decompressed_data);
2703
2704 /**
2673 * Adds a message listener. 2705 * Adds a message listener.
2674 * 2706 *
2675 * The same message listener can be added more than once and it that 2707 * The same message listener can be added more than once and it that
2676 * case it will be called more than once for each message. 2708 * case it will be called more than once for each message.
2677 */ 2709 */
2678 static bool AddMessageListener(MessageCallback that, 2710 static bool AddMessageListener(MessageCallback that,
2679 Handle<Value> data = Handle<Value>()); 2711 Handle<Value> data = Handle<Value>());
2680 2712
2681 /** 2713 /**
2682 * Remove all message listeners from the specified callback function. 2714 * Remove all message listeners from the specified callback function.
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after
3993 4025
3994 4026
3995 } // namespace v8 4027 } // namespace v8
3996 4028
3997 4029
3998 #undef V8EXPORT 4030 #undef V8EXPORT
3999 #undef TYPE_CHECK 4031 #undef TYPE_CHECK
4000 4032
4001 4033
4002 #endif // V8_H_ 4034 #endif // V8_H_
OLDNEW
« no previous file with comments | « SConstruct ('k') | samples/process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698