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

Side by Side Diff: runtime/bin/secure_socket.h

Issue 16123036: Clean up dart:io exceptions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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
« no previous file with comments | « runtime/bin/directory.cc ('k') | runtime/bin/socket_patch.dart » ('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 #ifndef BIN_SECURE_SOCKET_H_ 5 #ifndef BIN_SECURE_SOCKET_H_
6 #define BIN_SECURE_SOCKET_H_ 6 #define BIN_SECURE_SOCKET_H_
7 7
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <string.h> 9 #include <string.h>
10 #include <stdio.h> 10 #include <stdio.h>
11 #include <sys/types.h> 11 #include <sys/types.h>
12 12
13 #include <prinit.h> 13 #include <prinit.h>
14 #include <prerror.h> 14 #include <prerror.h>
15 #include <prnetdb.h> 15 #include <prnetdb.h>
16 #include <ssl.h> 16 #include <ssl.h>
17 17
18 #include "platform/globals.h" 18 #include "platform/globals.h"
19 #include "platform/thread.h" 19 #include "platform/thread.h"
20 20
21 #include "bin/builtin.h" 21 #include "bin/builtin.h"
22 #include "bin/dartutils.h" 22 #include "bin/dartutils.h"
23 #include "bin/utils.h" 23 #include "bin/utils.h"
24 24
25 namespace dart { 25 namespace dart {
26 namespace bin { 26 namespace bin {
27 27
28 static void ThrowException(const char* message) { 28 static void ThrowException(const char* message) {
29 Dart_Handle socket_io_exception = 29 Dart_Handle socket_exception =
30 DartUtils::NewDartSocketIOException(message, Dart_Null()); 30 DartUtils::NewDartSocketException(message, Dart_Null());
31 Dart_ThrowException(socket_io_exception); 31 Dart_ThrowException(socket_exception);
32 } 32 }
33 33
34 34
35 /* Handle an error reported from the NSS library. */ 35 /* Handle an error reported from the NSS library. */
36 static void ThrowPRException(const char* message) { 36 static void ThrowPRException(const char* message) {
37 PRErrorCode error_code = PR_GetError(); 37 PRErrorCode error_code = PR_GetError();
38 const char* error_message = PR_ErrorToString(error_code, PR_LANGUAGE_EN); 38 const char* error_message = PR_ErrorToString(error_code, PR_LANGUAGE_EN);
39 OSError os_error_struct(error_code, error_message, OSError::kNSS); 39 OSError os_error_struct(error_code, error_message, OSError::kNSS);
40 Dart_Handle os_error = DartUtils::NewDartOSError(&os_error_struct); 40 Dart_Handle os_error = DartUtils::NewDartOSError(&os_error_struct);
41 Dart_Handle socket_io_exception = 41 Dart_Handle socket_exception =
42 DartUtils::NewDartSocketIOException(message, os_error); 42 DartUtils::NewDartSocketException(message, os_error);
43 Dart_ThrowException(socket_io_exception); 43 Dart_ThrowException(socket_exception);
44 } 44 }
45 45
46 /* 46 /*
47 * SSLFilter encapsulates the NSS SSL(TLS) code in a filter, that communicates 47 * SSLFilter encapsulates the NSS SSL(TLS) code in a filter, that communicates
48 * with the containing _SecureFilterImpl Dart object through four shared 48 * with the containing _SecureFilterImpl Dart object through four shared
49 * ExternalByteArray buffers, for reading and writing plaintext, and 49 * ExternalByteArray buffers, for reading and writing plaintext, and
50 * reading and writing encrypted text. The filter handles handshaking 50 * reading and writing encrypted text. The filter handles handshaking
51 * and certificate verification. 51 * and certificate verification.
52 */ 52 */
53 class SSLFilter { 53 class SSLFilter {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 void InitializeBuffers(Dart_Handle dart_this); 118 void InitializeBuffers(Dart_Handle dart_this);
119 void InitializePlatformData(); 119 void InitializePlatformData();
120 120
121 DISALLOW_COPY_AND_ASSIGN(SSLFilter); 121 DISALLOW_COPY_AND_ASSIGN(SSLFilter);
122 }; 122 };
123 123
124 } // namespace bin 124 } // namespace bin
125 } // namespace dart 125 } // namespace dart
126 126
127 #endif // BIN_SECURE_SOCKET_H_ 127 #endif // BIN_SECURE_SOCKET_H_
OLDNEW
« no previous file with comments | « runtime/bin/directory.cc ('k') | runtime/bin/socket_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698