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

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

Issue 10704159: Start adding TLS (SSL) sockets to dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add proper event handling during handshake phase of connection. Created 8 years, 4 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 "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/globals.h" 10 #include "platform/globals.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 306
307 Dart_Handle DartUtils::NewDartOSError() { 307 Dart_Handle DartUtils::NewDartOSError() {
308 // Extract the current OS error. 308 // Extract the current OS error.
309 OSError os_error; 309 OSError os_error;
310 return NewDartOSError(&os_error); 310 return NewDartOSError(&os_error);
311 } 311 }
312 312
313 313
314 Dart_Handle DartUtils::NewDartOSError(OSError* os_error) { 314 Dart_Handle DartUtils::NewDartOSError(OSError* os_error) {
315 // Create a Dart OSError object with the information retrieved from the OS. 315 // Create a Dart OSError object with the information retrieved from the OS.
316 Dart_Handle url = Dart_NewString("dart:io"); 316 Dart_Handle url = Dart_NewString(kIOLibURL);
317 if (Dart_IsError(url)) return url; 317 if (Dart_IsError(url)) return url;
318 Dart_Handle lib = Dart_LookupLibrary(url); 318 Dart_Handle lib = Dart_LookupLibrary(url);
319 if (Dart_IsError(lib)) return lib; 319 if (Dart_IsError(lib)) return lib;
320 Dart_Handle class_name = Dart_NewString("OSError"); 320 Dart_Handle class_name = Dart_NewString("OSError");
321 if (Dart_IsError(class_name)) return class_name; 321 if (Dart_IsError(class_name)) return class_name;
322 Dart_Handle clazz = Dart_GetClass(lib, class_name); 322 Dart_Handle clazz = Dart_GetClass(lib, class_name);
323 if (Dart_IsError(clazz)) return clazz; 323 if (Dart_IsError(clazz)) return clazz;
324 Dart_Handle args[2]; 324 Dart_Handle args[2];
325 args[0] = Dart_NewString(os_error->message()); 325 args[0] = Dart_NewString(os_error->message());
326 if (Dart_IsError(args[0])) return args[0]; 326 if (Dart_IsError(args[0])) return args[0];
327 args[1] = Dart_NewInteger(os_error->code()); 327 args[1] = Dart_NewInteger(os_error->code());
328 if (Dart_IsError(args[1])) return args[1]; 328 if (Dart_IsError(args[1])) return args[1];
329 Dart_Handle err = Dart_New(clazz, Dart_Null(), 2, args); 329 Dart_Handle err = Dart_New(clazz, Dart_Null(), 2, args);
330 return err; 330 return err;
331 } 331 }
332 332
333 333
334 Dart_Handle DartUtils::NewDartIllegalArgumentError(const char* message) {
Anders Johnsen 2012/07/27 15:58:49 Since this is pretty much a copy of the other mess
Bill Hesse 2012/08/08 17:00:05 Done.
335 // Create a Dart OSError object with the information retrieved from the OS.
336 Dart_Handle url = Dart_NewString(kCoreLibURL);
337 if (Dart_IsError(url)) return url;
338 Dart_Handle lib = Dart_LookupLibrary(url);
339 if (Dart_IsError(lib)) return lib;
340 Dart_Handle class_name = Dart_NewString("IllegalArgumentException");
341 if (Dart_IsError(class_name)) return class_name;
342 Dart_Handle clazz = Dart_GetClass(lib, class_name);
343 if (Dart_IsError(clazz)) return clazz;
344 Dart_Handle args[1];
345 args[0] = Dart_NewString(message);
346 if (Dart_IsError(args[0])) return args[0];
347 Dart_Handle err = Dart_New(clazz, Dart_Null(), 1, args);
348 return err;
349 }
350
351
334 // Statically allocated Dart_CObject instances for immutable 352 // Statically allocated Dart_CObject instances for immutable
335 // objects. As these will be used by different threads the use of 353 // objects. As these will be used by different threads the use of
336 // these depends on the fact that the marking internally in the 354 // these depends on the fact that the marking internally in the
337 // Dart_CObject structure is not marking simple value objects. 355 // Dart_CObject structure is not marking simple value objects.
338 Dart_CObject CObject::api_null_ = { Dart_CObject::kNull , { 0 } }; 356 Dart_CObject CObject::api_null_ = { Dart_CObject::kNull , { 0 } };
339 Dart_CObject CObject::api_true_ = { Dart_CObject::kBool , { true } }; 357 Dart_CObject CObject::api_true_ = { Dart_CObject::kBool , { true } };
340 Dart_CObject CObject::api_false_ = { Dart_CObject::kBool, { false } }; 358 Dart_CObject CObject::api_false_ = { Dart_CObject::kBool, { false } };
341 CObject CObject::null_ = CObject(&api_null_); 359 CObject CObject::null_ = CObject(&api_null_);
342 CObject CObject::true_ = CObject(&api_true_); 360 CObject CObject::true_ = CObject(&api_true_);
343 CObject CObject::false_ = CObject(&api_false_); 361 CObject CObject::false_ = CObject(&api_false_);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 490
473 CObject* CObject::NewOSError(OSError* os_error) { 491 CObject* CObject::NewOSError(OSError* os_error) {
474 CObject* error_message = 492 CObject* error_message =
475 new CObjectString(CObject::NewString(os_error->message())); 493 new CObjectString(CObject::NewString(os_error->message()));
476 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); 494 CObjectArray* result = new CObjectArray(CObject::NewArray(3));
477 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); 495 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError)));
478 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); 496 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code())));
479 result->SetAt(2, error_message); 497 result->SetAt(2, error_message);
480 return result; 498 return result;
481 } 499 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698