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

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

Issue 9104041: Added API Dart_PostCMessage for posting a Dart_CMessage structure (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from asiva@ Created 8 years, 10 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 | 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/dartutils.h" 5 #include "bin/dartutils.h"
6 6
7 #include "bin/file.h" 7 #include "bin/file.h"
8 #include "include/dart_api.h"
8 #include "platform/assert.h" 9 #include "platform/assert.h"
9 #include "platform/globals.h" 10 #include "platform/globals.h"
10 11
11 const char* DartUtils::kDartScheme = "dart:"; 12 const char* DartUtils::kDartScheme = "dart:";
12 const char* DartUtils::kBuiltinLibURL = "dart:builtin"; 13 const char* DartUtils::kBuiltinLibURL = "dart:builtin";
13 const char* DartUtils::kCoreLibURL = "dart:core"; 14 const char* DartUtils::kCoreLibURL = "dart:core";
14 const char* DartUtils::kCoreImplLibURL = "dart:coreimpl"; 15 const char* DartUtils::kCoreImplLibURL = "dart:coreimpl";
15 const char* DartUtils::kIOLibURL = "dart:io"; 16 const char* DartUtils::kIOLibURL = "dart:io";
16 17
17 18
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 path, File::PathSeparator(), filename); 223 path, File::PathSeparator(), filename);
223 224
224 free(path); 225 free(path);
225 char* canonical_filename = File::GetCanonicalPath(absolute_filename); 226 char* canonical_filename = File::GetCanonicalPath(absolute_filename);
226 if (canonical_filename == NULL) { 227 if (canonical_filename == NULL) {
227 return absolute_filename; 228 return absolute_filename;
228 } 229 }
229 free(absolute_filename); 230 free(absolute_filename);
230 return canonical_filename; 231 return canonical_filename;
231 } 232 }
233
234
235 bool DartUtils::PostNull(Dart_Port port_id) {
236 // Post a message with just the null object.
237 Dart_CObject object;
238 object.type = Dart_CObject::kNull;
239 return Dart_PostCObject(port_id, &object);
240 }
241
242
243 bool DartUtils::PostInt32(Dart_Port port_id, int32_t value) {
244 // Post a message with the integer value.
245 int32_t min = 0xc0000000; // -1073741824
246 int32_t max = 0x3fffffff; // 1073741823
247 ASSERT(min <= value && value < max);
248 Dart_CObject object;
249 object.type = Dart_CObject::kInt32;
250 object.value.as_int32 = value;
251 return Dart_PostCObject(port_id, &object);
252 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698