| OLD | NEW |
| 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/secure_socket.h" | 5 #include "bin/secure_socket.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 encrypted_buffer_size_ = static_cast<int>(encrypted_buffer_size); | 305 encrypted_buffer_size_ = static_cast<int>(encrypted_buffer_size); |
| 306 | 306 |
| 307 | 307 |
| 308 Dart_Handle data_identifier = DartUtils::NewString("data"); | 308 Dart_Handle data_identifier = DartUtils::NewString("data"); |
| 309 for (int i = 0; i < kNumBuffers; ++i) { | 309 for (int i = 0; i < kNumBuffers; ++i) { |
| 310 int size = isEncrypted(i) ? encrypted_buffer_size_ : buffer_size_; | 310 int size = isEncrypted(i) ? encrypted_buffer_size_ : buffer_size_; |
| 311 dart_buffer_objects_[i] = ThrowIfError( | 311 dart_buffer_objects_[i] = ThrowIfError( |
| 312 Dart_NewPersistentHandle(Dart_ListGetAt(dart_buffers_object, i))); | 312 Dart_NewPersistentHandle(Dart_ListGetAt(dart_buffers_object, i))); |
| 313 buffers_[i] = new uint8_t[size]; | 313 buffers_[i] = new uint8_t[size]; |
| 314 Dart_Handle data = ThrowIfError( | 314 Dart_Handle data = ThrowIfError( |
| 315 Dart_NewExternalByteArray(buffers_[i], size, NULL, NULL)); | 315 Dart_NewExternalTypedData(buffers_[i], kUint8, size, NULL, NULL)); |
| 316 ThrowIfError(Dart_SetField(dart_buffer_objects_[i], | 316 ThrowIfError(Dart_SetField(dart_buffer_objects_[i], |
| 317 data_identifier, | 317 data_identifier, |
| 318 data)); | 318 data)); |
| 319 } | 319 } |
| 320 } | 320 } |
| 321 | 321 |
| 322 | 322 |
| 323 void SSLFilter::RegisterHandshakeCompleteCallback(Dart_Handle complete) { | 323 void SSLFilter::RegisterHandshakeCompleteCallback(Dart_Handle complete) { |
| 324 ASSERT(NULL == handshake_complete_); | 324 ASSERT(NULL == handshake_complete_); |
| 325 handshake_complete_ = ThrowIfError(Dart_NewPersistentHandle(complete)); | 325 handshake_complete_ = ThrowIfError(Dart_NewPersistentHandle(complete)); |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 if (PR_WOULD_BLOCK_ERROR != pr_error) { | 672 if (PR_WOULD_BLOCK_ERROR != pr_error) { |
| 673 ThrowPRException("Error reading plaintext from SSLFilter"); | 673 ThrowPRException("Error reading plaintext from SSLFilter"); |
| 674 } | 674 } |
| 675 bytes_processed = 0; | 675 bytes_processed = 0; |
| 676 } | 676 } |
| 677 break; | 677 break; |
| 678 } | 678 } |
| 679 } | 679 } |
| 680 return bytes_processed; | 680 return bytes_processed; |
| 681 } | 681 } |
| OLD | NEW |