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

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

Issue 2475523002: Reload native extensions when starting from a snapshot. (Closed)
Patch Set: comment Created 4 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
« no previous file with comments | « runtime/bin/dartutils.h ('k') | runtime/bin/loader.h » ('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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 const char* DartUtils::RemoveScheme(const char* url) { 226 const char* DartUtils::RemoveScheme(const char* url) {
227 const char* colon = strchr(url, ':'); 227 const char* colon = strchr(url, ':');
228 if (colon == NULL) { 228 if (colon == NULL) {
229 return url; 229 return url;
230 } else { 230 } else {
231 return colon + 1; 231 return colon + 1;
232 } 232 }
233 } 233 }
234 234
235 235
236 char* DartUtils::DirName(const char* url) {
237 const char* slash = strrchr(url, File::PathSeparator()[0]);
238 if (slash == NULL) {
239 return strdup(url);
240 } else {
241 return strndup(url, slash - url + 1);
242 }
243 }
244
245
236 void* DartUtils::OpenFile(const char* name, bool write) { 246 void* DartUtils::OpenFile(const char* name, bool write) {
237 File* file = File::Open(name, write ? File::kWriteTruncate : File::kRead); 247 File* file = File::Open(name, write ? File::kWriteTruncate : File::kRead);
238 return reinterpret_cast<void*>(file); 248 return reinterpret_cast<void*>(file);
239 } 249 }
240 250
241 251
242 void DartUtils::ReadFile(const uint8_t** data, intptr_t* len, void* stream) { 252 void DartUtils::ReadFile(const uint8_t** data, intptr_t* len, void* stream) {
243 ASSERT(data != NULL); 253 ASSERT(data != NULL);
244 ASSERT(len != NULL); 254 ASSERT(len != NULL);
245 ASSERT(stream != NULL); 255 ASSERT(stream != NULL);
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 new CObjectString(CObject::NewString(os_error->message())); 1177 new CObjectString(CObject::NewString(os_error->message()));
1168 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); 1178 CObjectArray* result = new CObjectArray(CObject::NewArray(3));
1169 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); 1179 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError)));
1170 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); 1180 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code())));
1171 result->SetAt(2, error_message); 1181 result->SetAt(2, error_message);
1172 return result; 1182 return result;
1173 } 1183 }
1174 1184
1175 } // namespace bin 1185 } // namespace bin
1176 } // namespace dart 1186 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/dartutils.h ('k') | runtime/bin/loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698