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

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: 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
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 int id;
Søren Thygesen Gjesse 2011/04/29 06:50:29 Is this id actually required?
mnaganov (inactive) 2011/04/29 12:07:58 I think, no. As we don't expose to embedder what t
2647 const char* data;
2648 int compressed_size;
2649 int decompressed_size;
Søren Thygesen Gjesse 2011/04/29 06:50:29 Should the compression algorithm be exposed here (
mnaganov (inactive) 2011/04/29 12:07:58 Makes sense. But not for every resource, as it is
2650 };
2651
2652
2644 /** 2653 /**
2645 * Container class for static utility functions. 2654 * Container class for static utility functions.
2646 */ 2655 */
2647 class V8EXPORT V8 { 2656 class V8EXPORT V8 {
2648 public: 2657 public:
2649 /** Set the callback to invoke in case of fatal errors. */ 2658 /** Set the callback to invoke in case of fatal errors. */
2650 static void SetFatalErrorHandler(FatalErrorCallback that); 2659 static void SetFatalErrorHandler(FatalErrorCallback that);
2651 2660
2652 /** 2661 /**
2653 * Ignore out-of-memory exceptions. 2662 * Ignore out-of-memory exceptions.
2654 * 2663 *
2655 * V8 running out of memory is treated as a fatal error by default. 2664 * 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 2665 * This means that the fatal error handler is called and that V8 is
2657 * terminated. 2666 * terminated.
2658 * 2667 *
2659 * IgnoreOutOfMemoryException can be used to not treat a 2668 * IgnoreOutOfMemoryException can be used to not treat a
2660 * out-of-memory situation as a fatal error. This way, the contexts 2669 * 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 2670 * that did not cause the out of memory problem might be able to
2662 * continue execution. 2671 * continue execution.
2663 */ 2672 */
2664 static void IgnoreOutOfMemoryException(); 2673 static void IgnoreOutOfMemoryException();
2665 2674
2666 /** 2675 /**
2667 * Check if V8 is dead and therefore unusable. This is the case after 2676 * Check if V8 is dead and therefore unusable. This is the case after
2668 * fatal errors such as out-of-memory situations. 2677 * fatal errors such as out-of-memory situations.
2669 */ 2678 */
2670 static bool IsDead(); 2679 static bool IsDead();
2671 2680
2672 /** 2681 /**
2682 * The following 3 functions are to be used when V8 is built with
Søren Thygesen Gjesse 2011/04/29 06:50:29 with -> with the
mnaganov (inactive) 2011/04/29 12:07:58 Done.
2683 * 'compress_startup_data' flag enabled. In this case, the embedder
2684 * must decompress startup data prior to initializing V8.
2685 *
2686 * This is how interaction with V8 should look like:
2687 * int compressed_data_count = v8::V8::GetCompressedStartupDataCount();
2688 * v8::StartupData* compressed_data =
2689 * new v8::StartupData[compressed_data_count];
2690 * v8::V8::GetCompressedStartupData(compressed_data);
2691 * ... decompress data (compressed_data can be updated in-place) ...
2692 * v8::V8::SetDecompressedStartupData(compressed_data);
2693 * ... now V8 can be initialized
2694 * ... make sure the decompressed data stays valid until V8 shutdown
2695 */
2696 static int GetCompressedStartupDataCount();
2697 static void GetCompressedStartupData(StartupData* compressed_data);
2698 static void SetDecompressedStartupData(StartupData* decompressed_data);
2699
2700 /**
2673 * Adds a message listener. 2701 * Adds a message listener.
2674 * 2702 *
2675 * The same message listener can be added more than once and it that 2703 * 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. 2704 * case it will be called more than once for each message.
2677 */ 2705 */
2678 static bool AddMessageListener(MessageCallback that, 2706 static bool AddMessageListener(MessageCallback that,
2679 Handle<Value> data = Handle<Value>()); 2707 Handle<Value> data = Handle<Value>());
2680 2708
2681 /** 2709 /**
2682 * Remove all message listeners from the specified callback function. 2710 * Remove all message listeners from the specified callback function.
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after
3993 4021
3994 4022
3995 } // namespace v8 4023 } // namespace v8
3996 4024
3997 4025
3998 #undef V8EXPORT 4026 #undef V8EXPORT
3999 #undef TYPE_CHECK 4027 #undef TYPE_CHECK
4000 4028
4001 4029
4002 #endif // V8_H_ 4030 #endif // V8_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698