OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 3186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3197 | 3197 |
3198 | 3198 |
3199 /** | 3199 /** |
3200 * An interface for exporting data from V8, using "push" model. | 3200 * An interface for exporting data from V8, using "push" model. |
3201 */ | 3201 */ |
3202 class V8EXPORT OutputStream { | 3202 class V8EXPORT OutputStream { |
3203 public: | 3203 public: |
3204 enum OutputEncoding { | 3204 enum OutputEncoding { |
3205 kAscii = 0 // 7-bit ASCII. | 3205 kAscii = 0 // 7-bit ASCII. |
3206 }; | 3206 }; |
| 3207 enum WriteResult { |
| 3208 kContinue = 0, |
| 3209 kAbort = 1 |
| 3210 }; |
3207 virtual ~OutputStream() {} | 3211 virtual ~OutputStream() {} |
3208 /** Notify about the end of stream. */ | 3212 /** Notify about the end of stream. */ |
3209 virtual void EndOfStream() = 0; | 3213 virtual void EndOfStream() = 0; |
3210 /** Get preferred output chunk size. Called only once. */ | 3214 /** Get preferred output chunk size. Called only once. */ |
3211 virtual int GetChunkSize() { return 1024; } | 3215 virtual int GetChunkSize() { return 1024; } |
3212 /** Get preferred output encoding. Called only once. */ | 3216 /** Get preferred output encoding. Called only once. */ |
3213 virtual OutputEncoding GetOutputEncoding() { return kAscii; } | 3217 virtual OutputEncoding GetOutputEncoding() { return kAscii; } |
3214 /** Writes the next chunk of snapshot data into the stream. */ | 3218 /** |
3215 virtual void WriteAsciiChunk(char* data, int size) = 0; | 3219 * Writes the next chunk of snapshot data into the stream. Writing |
| 3220 * can be stopped by returning kAbort as function result. EndOfStream |
| 3221 * will not be called in case writing was aborted. |
| 3222 */ |
| 3223 virtual WriteResult WriteAsciiChunk(char* data, int size) = 0; |
3216 }; | 3224 }; |
3217 | 3225 |
3218 | 3226 |
3219 | 3227 |
3220 // --- I m p l e m e n t a t i o n --- | 3228 // --- I m p l e m e n t a t i o n --- |
3221 | 3229 |
3222 | 3230 |
3223 namespace internal { | 3231 namespace internal { |
3224 | 3232 |
3225 | 3233 |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3669 | 3677 |
3670 | 3678 |
3671 } // namespace v8 | 3679 } // namespace v8 |
3672 | 3680 |
3673 | 3681 |
3674 #undef V8EXPORT | 3682 #undef V8EXPORT |
3675 #undef TYPE_CHECK | 3683 #undef TYPE_CHECK |
3676 | 3684 |
3677 | 3685 |
3678 #endif // V8_H_ | 3686 #endif // V8_H_ |
OLD | NEW |