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

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

Issue 2542663002: Adjust memory pressure from SSL (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | runtime/bin/secure_socket_boringssl.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 RUNTIME_BIN_SECURE_SOCKET_BORINGSSL_H_ 5 #ifndef RUNTIME_BIN_SECURE_SOCKET_BORINGSSL_H_
6 #define RUNTIME_BIN_SECURE_SOCKET_BORINGSSL_H_ 6 #define RUNTIME_BIN_SECURE_SOCKET_BORINGSSL_H_
7 7
8 #if !defined(RUNTIME_BIN_SECURE_SOCKET_H_) 8 #if !defined(RUNTIME_BIN_SECURE_SOCKET_H_)
9 #error Do not include secure_socket_boringssl.h directly. Use secure_socket.h. 9 #error Do not include secure_socket_boringssl.h directly. Use secure_socket.h.
10 #endif 10 #endif
(...skipping 17 matching lines...) Expand all
28 28
29 namespace dart { 29 namespace dart {
30 namespace bin { 30 namespace bin {
31 31
32 /* These are defined in root_certificates.cc. */ 32 /* These are defined in root_certificates.cc. */
33 extern const unsigned char* root_certificates_pem; 33 extern const unsigned char* root_certificates_pem;
34 extern unsigned int root_certificates_pem_length; 34 extern unsigned int root_certificates_pem_length;
35 35
36 class SSLContext { 36 class SSLContext {
37 public: 37 public:
38 static const intptr_t kApproximateSize;
39
38 explicit SSLContext(SSL_CTX* context) 40 explicit SSLContext(SSL_CTX* context)
39 : context_(context), alpn_protocol_string_(NULL) {} 41 : context_(context), alpn_protocol_string_(NULL) {}
40 42
41 ~SSLContext() { 43 ~SSLContext() {
42 SSL_CTX_free(context_); 44 SSL_CTX_free(context_);
43 if (alpn_protocol_string_ != NULL) { 45 if (alpn_protocol_string_ != NULL) {
44 free(alpn_protocol_string_); 46 free(alpn_protocol_string_);
45 } 47 }
46 } 48 }
47 49
(...skipping 26 matching lines...) Expand all
74 // These enums must agree with those in sdk/lib/io/secure_socket.dart. 76 // These enums must agree with those in sdk/lib/io/secure_socket.dart.
75 enum BufferIndex { 77 enum BufferIndex {
76 kReadPlaintext, 78 kReadPlaintext,
77 kWritePlaintext, 79 kWritePlaintext,
78 kReadEncrypted, 80 kReadEncrypted,
79 kWriteEncrypted, 81 kWriteEncrypted,
80 kNumBuffers, 82 kNumBuffers,
81 kFirstEncrypted = kReadEncrypted 83 kFirstEncrypted = kReadEncrypted
82 }; 84 };
83 85
86 static const intptr_t kApproximateSize;
87
84 SSLFilter() 88 SSLFilter()
85 : callback_error(NULL), 89 : callback_error(NULL),
86 ssl_(NULL), 90 ssl_(NULL),
87 socket_side_(NULL), 91 socket_side_(NULL),
88 string_start_(NULL), 92 string_start_(NULL),
89 string_length_(NULL), 93 string_length_(NULL),
90 handshake_complete_(NULL), 94 handshake_complete_(NULL),
91 bad_certificate_callback_(NULL), 95 bad_certificate_callback_(NULL),
92 in_handshake_(false), 96 in_handshake_(false),
93 hostname_(NULL) {} 97 hostname_(NULL) {}
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 static CObject* ProcessFilterRequest(const CObjectArray& request); 130 static CObject* ProcessFilterRequest(const CObjectArray& request);
127 131
128 // The index of the external data field in _ssl that points to the SSLFilter. 132 // The index of the external data field in _ssl that points to the SSLFilter.
129 static int filter_ssl_index; 133 static int filter_ssl_index;
130 134
131 // TODO(whesse): make private: 135 // TODO(whesse): make private:
132 SSL* ssl_; 136 SSL* ssl_;
133 BIO* socket_side_; 137 BIO* socket_side_;
134 138
135 private: 139 private:
140 static const intptr_t kInternalBIOSize;
136 static bool library_initialized_; 141 static bool library_initialized_;
137 static Mutex* mutex_; // To protect library initialization. 142 static Mutex* mutex_; // To protect library initialization.
138 143
139 uint8_t* buffers_[kNumBuffers]; 144 uint8_t* buffers_[kNumBuffers];
140 int buffer_size_; 145 int buffer_size_;
141 int encrypted_buffer_size_; 146 int encrypted_buffer_size_;
142 Dart_PersistentHandle string_start_; 147 Dart_PersistentHandle string_start_;
143 Dart_PersistentHandle string_length_; 148 Dart_PersistentHandle string_length_;
144 Dart_PersistentHandle dart_buffer_objects_[kNumBuffers]; 149 Dart_PersistentHandle dart_buffer_objects_[kNumBuffers];
145 Dart_PersistentHandle handshake_complete_; 150 Dart_PersistentHandle handshake_complete_;
146 Dart_PersistentHandle bad_certificate_callback_; 151 Dart_PersistentHandle bad_certificate_callback_;
147 bool in_handshake_; 152 bool in_handshake_;
148 bool is_server_; 153 bool is_server_;
149 char* hostname_; 154 char* hostname_;
150 155
151 static bool isBufferEncrypted(int i) { 156 static bool isBufferEncrypted(int i) {
152 return static_cast<BufferIndex>(i) >= kFirstEncrypted; 157 return static_cast<BufferIndex>(i) >= kFirstEncrypted;
153 } 158 }
154 Dart_Handle InitializeBuffers(Dart_Handle dart_this); 159 Dart_Handle InitializeBuffers(Dart_Handle dart_this);
155 void InitializePlatformData(); 160 void InitializePlatformData();
156 161
157 DISALLOW_COPY_AND_ASSIGN(SSLFilter); 162 DISALLOW_COPY_AND_ASSIGN(SSLFilter);
158 }; 163 };
159 164
160 } // namespace bin 165 } // namespace bin
161 } // namespace dart 166 } // namespace dart
162 167
163 #endif // RUNTIME_BIN_SECURE_SOCKET_BORINGSSL_H_ 168 #endif // RUNTIME_BIN_SECURE_SOCKET_BORINGSSL_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/secure_socket_boringssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698