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

Side by Side Diff: src/snapshot-common.cc

Issue 548149: Another step on the way to context snapshots. We can now refer to... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 11 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 | « src/serialize.cc ('k') | src/v8.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 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 Deserialize(str, len); 52 Deserialize(str, len);
53 DeleteArray(str); 53 DeleteArray(str);
54 return true; 54 return true;
55 } else if (size_ > 0) { 55 } else if (size_ > 0) {
56 Deserialize(data_, size_); 56 Deserialize(data_, size_);
57 return true; 57 return true;
58 } 58 }
59 return false; 59 return false;
60 } 60 }
61 61
62
63 class FileByteSink : public SnapshotByteSink {
64 public:
65 explicit FileByteSink(const char* snapshot_file) {
66 fp_ = OS::FOpen(snapshot_file, "wb");
67 if (fp_ == NULL) {
68 PrintF("Unable to write to snapshot file \"%s\"\n", snapshot_file);
69 exit(1);
70 }
71 }
72 virtual ~FileByteSink() {
73 if (fp_ != NULL) {
74 fclose(fp_);
75 }
76 }
77 virtual void Put(int byte, const char* description) {
78 if (fp_ != NULL) {
79 fputc(byte, fp_);
80 }
81 }
82 virtual int Position() {
83 return ftell(fp_);
84 }
85
86 private:
87 FILE* fp_;
88 };
89
90
91 bool Snapshot::WriteToFile(const char* snapshot_file) {
92 FileByteSink file(snapshot_file);
93 Serializer ser(&file);
94 ser.Serialize();
95 return true;
96 }
97
98
99
100 } } // namespace v8::internal 62 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/serialize.cc ('k') | src/v8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698