OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 virtual ~FileByteSink() { | 72 virtual ~FileByteSink() { |
73 if (fp_ != NULL) { | 73 if (fp_ != NULL) { |
74 fclose(fp_); | 74 fclose(fp_); |
75 } | 75 } |
76 } | 76 } |
77 virtual void Put(int byte, const char* description) { | 77 virtual void Put(int byte, const char* description) { |
78 if (fp_ != NULL) { | 78 if (fp_ != NULL) { |
79 fputc(byte, fp_); | 79 fputc(byte, fp_); |
80 } | 80 } |
81 } | 81 } |
| 82 virtual int Position() { |
| 83 return ftell(fp_); |
| 84 } |
82 | 85 |
83 private: | 86 private: |
84 FILE* fp_; | 87 FILE* fp_; |
85 }; | 88 }; |
86 | 89 |
87 | 90 |
88 bool Snapshot::WriteToFile(const char* snapshot_file) { | 91 bool Snapshot::WriteToFile(const char* snapshot_file) { |
89 FileByteSink file(snapshot_file); | 92 FileByteSink file(snapshot_file); |
90 Serializer ser(&file); | 93 Serializer ser(&file); |
91 ser.Serialize(); | 94 ser.Serialize(); |
92 return true; | 95 return true; |
93 } | 96 } |
94 | 97 |
95 | 98 |
96 | 99 |
97 } } // namespace v8::internal | 100 } } // namespace v8::internal |
OLD | NEW |