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

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

Issue 11819062: Speed up secure sockets by increasing encrypted buffer size. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | « no previous file | runtime/bin/secure_socket.cc » ('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>
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 * and certificate verification. 52 * and certificate verification.
53 */ 53 */
54 class SSLFilter { 54 class SSLFilter {
55 public: 55 public:
56 // These enums must agree with those in sdk/lib/io/secure_socket.dart. 56 // These enums must agree with those in sdk/lib/io/secure_socket.dart.
57 enum BufferIndex { 57 enum BufferIndex {
58 kReadPlaintext, 58 kReadPlaintext,
59 kWritePlaintext, 59 kWritePlaintext,
60 kReadEncrypted, 60 kReadEncrypted,
61 kWriteEncrypted, 61 kWriteEncrypted,
62 kNumBuffers 62 kNumBuffers,
63 kFirstEncrypted = kReadEncrypted
63 }; 64 };
64 65
65 SSLFilter() 66 SSLFilter()
66 : string_start_(NULL), 67 : string_start_(NULL),
67 string_length_(NULL), 68 string_length_(NULL),
68 handshake_complete_(NULL), 69 handshake_complete_(NULL),
69 bad_certificate_callback_(NULL), 70 bad_certificate_callback_(NULL),
70 in_handshake_(false), 71 in_handshake_(false),
71 client_certificate_name_(NULL), 72 client_certificate_name_(NULL),
72 filter_(NULL) { } 73 filter_(NULL) { }
(...skipping 18 matching lines...) Expand all
91 intptr_t ProcessBuffer(int bufferIndex); 92 intptr_t ProcessBuffer(int bufferIndex);
92 Dart_Handle PeerCertificate(); 93 Dart_Handle PeerCertificate();
93 94
94 private: 95 private:
95 static const int kMemioBufferSize = 20 * KB; 96 static const int kMemioBufferSize = 20 * KB;
96 static bool library_initialized_; 97 static bool library_initialized_;
97 static const char* password_; 98 static const char* password_;
98 static dart::Mutex mutex_; // To protect library initialization. 99 static dart::Mutex mutex_; // To protect library initialization.
99 100
100 uint8_t* buffers_[kNumBuffers]; 101 uint8_t* buffers_[kNumBuffers];
101 int64_t buffer_size_; 102 int buffer_size_;
103 int encrypted_buffer_size_;
102 Dart_Handle string_start_; 104 Dart_Handle string_start_;
103 Dart_Handle string_length_; 105 Dart_Handle string_length_;
104 Dart_Handle dart_buffer_objects_[kNumBuffers]; 106 Dart_Handle dart_buffer_objects_[kNumBuffers];
105 Dart_Handle handshake_complete_; 107 Dart_Handle handshake_complete_;
106 Dart_Handle bad_certificate_callback_; 108 Dart_Handle bad_certificate_callback_;
107 bool in_handshake_; 109 bool in_handshake_;
108 bool is_server_; 110 bool is_server_;
109 char* client_certificate_name_; 111 char* client_certificate_name_;
110 PRFileDesc* filter_; 112 PRFileDesc* filter_;
111 113
114 static bool isEncrypted(int i) {
115 return static_cast<BufferIndex>(i) >= kFirstEncrypted;
116 }
112 void InitializeBuffers(Dart_Handle dart_this); 117 void InitializeBuffers(Dart_Handle dart_this);
113 void InitializePlatformData(); 118 void InitializePlatformData();
114 119
115 DISALLOW_COPY_AND_ASSIGN(SSLFilter); 120 DISALLOW_COPY_AND_ASSIGN(SSLFilter);
116 }; 121 };
117 122
118 #endif // BIN_SECURE_SOCKET_H_ 123 #endif // BIN_SECURE_SOCKET_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/secure_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698