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

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

Issue 11318018: - Represent strings internally in UTF-16 format, this makes it (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
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/directory.h" 5 #include "bin/directory.h"
6 6
7 #include "bin/dartutils.h" 7 #include "bin/dartutils.h"
8 #include "bin/thread.h" 8 #include "bin/thread.h"
9 #include "include/dart_api.h" 9 #include "include/dart_api.h"
10 #include "platform/assert.h" 10 #include "platform/assert.h"
11 11
12 dart::Mutex Directory::mutex_; 12 dart::Mutex Directory::mutex_;
13 int Directory::service_ports_size_ = 0; 13 int Directory::service_ports_size_ = 0;
14 Dart_Port* Directory::service_ports_ = NULL; 14 Dart_Port* Directory::service_ports_ = NULL;
15 int Directory::service_ports_index_ = 0; 15 int Directory::service_ports_index_ = 0;
16 16
17 void FUNCTION_NAME(Directory_Current)(Dart_NativeArguments args) { 17 void FUNCTION_NAME(Directory_Current)(Dart_NativeArguments args) {
18 Dart_EnterScope(); 18 Dart_EnterScope();
19 char* current = Directory::Current(); 19 char* current = Directory::Current();
20 if (current != NULL) { 20 if (current != NULL) {
21 Dart_SetReturnValue(args, Dart_NewString(current)); 21 Dart_SetReturnValue(args, DartUtils::NewString(current));
22 free(current); 22 free(current);
23 } 23 }
24 Dart_ExitScope(); 24 Dart_ExitScope();
25 } 25 }
26 26
27 27
28 void FUNCTION_NAME(Directory_Exists)(Dart_NativeArguments args) { 28 void FUNCTION_NAME(Directory_Exists)(Dart_NativeArguments args) {
29 static const int kExists = 1; 29 static const int kExists = 1;
30 static const int kDoesNotExist = 0; 30 static const int kDoesNotExist = 0;
31 Dart_EnterScope(); 31 Dart_EnterScope();
(...skipping 25 matching lines...) Expand all
57 } 57 }
58 Dart_ExitScope(); 58 Dart_ExitScope();
59 } 59 }
60 60
61 61
62 void FUNCTION_NAME(Directory_CreateTemp)(Dart_NativeArguments args) { 62 void FUNCTION_NAME(Directory_CreateTemp)(Dart_NativeArguments args) {
63 Dart_EnterScope(); 63 Dart_EnterScope();
64 Dart_Handle path = Dart_GetNativeArgument(args, 0); 64 Dart_Handle path = Dart_GetNativeArgument(args, 0);
65 char* result = Directory::CreateTemp(DartUtils::GetStringValue(path)); 65 char* result = Directory::CreateTemp(DartUtils::GetStringValue(path));
66 if (result != NULL) { 66 if (result != NULL) {
67 Dart_SetReturnValue(args, Dart_NewString(result)); 67 Dart_SetReturnValue(args, DartUtils::NewString(result));
68 free(result); 68 free(result);
69 } else { 69 } else {
70 Dart_Handle err = DartUtils::NewDartOSError(); 70 Dart_Handle err = DartUtils::NewDartOSError();
71 if (Dart_IsError(err)) Dart_PropagateError(err); 71 if (Dart_IsError(err)) Dart_PropagateError(err);
72 Dart_SetReturnValue(args, err); 72 Dart_SetReturnValue(args, err);
73 } 73 }
74 Dart_ExitScope(); 74 Dart_ExitScope();
75 } 75 }
76 76
77 77
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 310
311 311
312 bool DirectoryListing::HandleError(const char* dir_name) { 312 bool DirectoryListing::HandleError(const char* dir_name) {
313 CObject* err = CObject::NewOSError(); 313 CObject* err = CObject::NewOSError();
314 CObjectArray* response = new CObjectArray(CObject::NewArray(3)); 314 CObjectArray* response = new CObjectArray(CObject::NewArray(3));
315 response->SetAt(0, new CObjectInt32(CObject::NewInt32(kListError))); 315 response->SetAt(0, new CObjectInt32(CObject::NewInt32(kListError)));
316 response->SetAt(1, new CObjectString(CObject::NewString(dir_name))); 316 response->SetAt(1, new CObjectString(CObject::NewString(dir_name)));
317 response->SetAt(2, err); 317 response->SetAt(2, err);
318 return Dart_PostCObject(response_port_, response->AsApiCObject()); 318 return Dart_PostCObject(response_port_, response->AsApiCObject());
319 } 319 }
OLDNEW
« no previous file with comments | « runtime/bin/dbg_message.cc ('k') | runtime/bin/file.cc » ('j') | runtime/vm/dart_api_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698