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

Unified Diff: runtime/bin/secure_socket_boringssl.cc

Issue 1852783003: Implements remaining SecurityContext calls for iOS (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add RefCntReleaseScope Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: runtime/bin/secure_socket_boringssl.cc
diff --git a/runtime/bin/secure_socket_boringssl.cc b/runtime/bin/secure_socket_boringssl.cc
index 530c21a787789977e32a36ec37d44209dbc965fe..452949457636cde526d43b0af9d1e5e8cf52f5b8 100644
--- a/runtime/bin/secure_socket_boringssl.cc
+++ b/runtime/bin/secure_socket_boringssl.cc
@@ -121,7 +121,7 @@ static void DeleteFilter(
Dart_WeakPersistentHandle handle,
void* context_pointer) {
SSLFilter* filter = reinterpret_cast<SSLFilter*>(context_pointer);
- delete filter;
+ filter->Release();
}
@@ -205,9 +205,10 @@ static void SetAlpnProtocolList(Dart_Handle protocols_handle,
void FUNCTION_NAME(SecureSocket_Init)(Dart_NativeArguments args) {
Dart_Handle dart_this = ThrowIfError(Dart_GetNativeArgument(args, 0));
SSLFilter* filter = new SSLFilter();
+ filter->Retain();
Dart_Handle err = SetFilter(args, filter);
if (Dart_IsError(err)) {
- delete filter;
+ filter->Release();
Dart_PropagateError(err);
}
err = filter->Init(dart_this);
@@ -324,7 +325,11 @@ void FUNCTION_NAME(SecureSocket_PeerCertificate)
void FUNCTION_NAME(SecureSocket_FilterPointer)(Dart_NativeArguments args) {
- intptr_t filter_pointer = reinterpret_cast<intptr_t>(GetFilter(args));
+ SSLFilter* filter = GetFilter(args);
+ // This filter pointer is passed to the IO Service thread. The IO Service
+ // thread must Release() the pointer when it is done with it.
+ filter->Retain();
+ intptr_t filter_pointer = reinterpret_cast<intptr_t>(filter);
Dart_SetReturnValue(args, Dart_NewInteger(filter_pointer));
}
@@ -1086,6 +1091,8 @@ void FUNCTION_NAME(X509_EndValidity)(
CObject* SSLFilter::ProcessFilterRequest(const CObjectArray& request) {
CObjectIntptr filter_object(request[0]);
SSLFilter* filter = reinterpret_cast<SSLFilter*>(filter_object.Value());
+ RefCntReleaseScope<SSLFilter> rs(filter);
+
bool in_handshake = CObjectBool(request[1]).Value();
int starts[SSLFilter::kNumBuffers];
int ends[SSLFilter::kNumBuffers];

Powered by Google App Engine
This is Rietveld 408576698