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

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

Issue 2410303008: Revert "Use a single file for app snapshots." (Closed)
Patch Set: 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') | 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) 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
195 void* DartUtils::OpenFile(const char* name, bool write) { 206 void* DartUtils::OpenFile(const char* name, bool write) {
196 File* file = File::Open(name, write ? File::kWriteTruncate : File::kRead); 207 File* file = File::Open(name, write ? File::kWriteTruncate : File::kRead);
197 return reinterpret_cast<void*>(file); 208 return reinterpret_cast<void*>(file);
198 } 209 }
199 210
200 211
201 void DartUtils::ReadFile(const uint8_t** data, 212 void DartUtils::ReadFile(const uint8_t** data,
202 intptr_t* len, 213 intptr_t* len,
203 void* stream) { 214 void* stream) {
204 ASSERT(data != NULL); 215 ASSERT(data != NULL);
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 new CObjectString(CObject::NewString(os_error->message())); 1265 new CObjectString(CObject::NewString(os_error->message()));
1255 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); 1266 CObjectArray* result = new CObjectArray(CObject::NewArray(3));
1256 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); 1267 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError)));
1257 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); 1268 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code())));
1258 result->SetAt(2, error_message); 1269 result->SetAt(2, error_message);
1259 return result; 1270 return result;
1260 } 1271 }
1261 1272
1262 } // namespace bin 1273 } // namespace bin
1263 } // namespace dart 1274 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/extensions_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698