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

Side by Side Diff: runtime/bin/gen_snapshot.cc

Issue 8437056: Implemented File create API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month 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 | « runtime/bin/file_win.cc ('k') | runtime/bin/main.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 (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Generate a snapshot file after loading all the scripts specified on the 5 // Generate a snapshot file after loading all the scripts specified on the
6 // command line. 6 // command line.
7 7
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <string.h> 9 #include <string.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } else { 74 } else {
75 *script_name = NULL; 75 *script_name = NULL;
76 } 76 }
77 77
78 return 0; 78 return 0;
79 } 79 }
80 80
81 81
82 static void WriteSnapshotFile(const uint8_t* buffer, const intptr_t size) { 82 static void WriteSnapshotFile(const uint8_t* buffer, const intptr_t size) {
83 const bool kWritable = true; 83 const bool kWritable = true;
84 File* file = File::OpenFile(snapshot_filename, kWritable); 84 File* file = File::Open(snapshot_filename, kWritable);
85 ASSERT(file != NULL); 85 ASSERT(file != NULL);
86 for (intptr_t i = 0; i < size; i++) { 86 for (intptr_t i = 0; i < size; i++) {
87 file->WriteByte(buffer[i]); 87 file->WriteByte(buffer[i]);
88 } 88 }
89 delete file; 89 delete file;
90 } 90 }
91 91
92 92
93 static void* SnapshotCreateCallback(void* data) { 93 static void* SnapshotCreateCallback(void* data) {
94 const char* script_name = reinterpret_cast<const char*>(data); 94 const char* script_name = reinterpret_cast<const char*>(data);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // and writes out a snapshot. 175 // and writes out a snapshot.
176 Dart_Isolate isolate = Dart_CreateIsolate(NULL, script_name); 176 Dart_Isolate isolate = Dart_CreateIsolate(NULL, script_name);
177 if (isolate == NULL) { 177 if (isolate == NULL) {
178 return 255; 178 return 255;
179 } 179 }
180 180
181 // Shutdown the isolate. 181 // Shutdown the isolate.
182 Dart_ShutdownIsolate(); 182 Dart_ShutdownIsolate();
183 return 0; 183 return 0;
184 } 184 }
OLDNEW
« no previous file with comments | « runtime/bin/file_win.cc ('k') | runtime/bin/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698