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

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

Issue 2416973003: Reapply "Use a single file for app snapshots." (Closed)
Patch Set: sync Created 4 years, 2 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
« no previous file with comments | « no previous file | runtime/bin/extensions_android.cc » ('j') | runtime/bin/main.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #include "bin/dartutils.h" 5 #include "bin/dartutils.h"
6 6
7 #include "bin/crypto.h" 7 #include "bin/crypto.h"
8 #include "bin/directory.h" 8 #include "bin/directory.h"
9 #include "bin/extensions.h" 9 #include "bin/extensions.h"
10 #include "bin/file.h" 10 #include "bin/file.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 const char* DartUtils::RemoveScheme(const char* url) { 185 const char* DartUtils::RemoveScheme(const char* url) {
186 const char* colon = strchr(url, ':'); 186 const char* colon = strchr(url, ':');
187 if (colon == NULL) { 187 if (colon == NULL) {
188 return url; 188 return url;
189 } else { 189 } else {
190 return colon + 1; 190 return colon + 1;
191 } 191 }
192 } 192 }
193 193
194 194
195 void* DartUtils::MapExecutable(const char* name, intptr_t* len) {
196 File* file = File::Open(name, File::kRead);
197 if (file == NULL) {
198 return NULL;
199 }
200 void* addr = file->MapExecutable(len);
201 file->Release();
202 return addr;
203 }
204
205
206 void* DartUtils::OpenFile(const char* name, bool write) { 195 void* DartUtils::OpenFile(const char* name, bool write) {
207 File* file = File::Open(name, write ? File::kWriteTruncate : File::kRead); 196 File* file = File::Open(name, write ? File::kWriteTruncate : File::kRead);
208 return reinterpret_cast<void*>(file); 197 return reinterpret_cast<void*>(file);
209 } 198 }
210 199
211 200
212 void DartUtils::ReadFile(const uint8_t** data, 201 void DartUtils::ReadFile(const uint8_t** data,
213 intptr_t* len, 202 intptr_t* len,
214 void* stream) { 203 void* stream) {
215 ASSERT(data != NULL); 204 ASSERT(data != NULL);
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 new CObjectString(CObject::NewString(os_error->message())); 1254 new CObjectString(CObject::NewString(os_error->message()));
1266 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); 1255 CObjectArray* result = new CObjectArray(CObject::NewArray(3));
1267 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); 1256 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError)));
1268 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); 1257 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code())));
1269 result->SetAt(2, error_message); 1258 result->SetAt(2, error_message);
1270 return result; 1259 return result;
1271 } 1260 }
1272 1261
1273 } // namespace bin 1262 } // namespace bin
1274 } // namespace dart 1263 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/extensions_android.cc » ('j') | runtime/bin/main.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698