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

Unified Diff: third_party/grpc/src/csharp/Grpc.Core/Internal/CallCredentialsSafeHandle.cs

Issue 1932353002: Initial checkin of gRPC to third_party/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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: third_party/grpc/src/csharp/Grpc.Core/Internal/CallCredentialsSafeHandle.cs
diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/MapFieldAccessor.cs b/third_party/grpc/src/csharp/Grpc.Core/Internal/CallCredentialsSafeHandle.cs
similarity index 66%
copy from third_party/protobuf/csharp/src/Google.Protobuf/Reflection/MapFieldAccessor.cs
copy to third_party/grpc/src/csharp/Grpc.Core/Internal/CallCredentialsSafeHandle.cs
index 9ed7f8c4df4c1ca7b374378c0cf8040e95f22619..0f36337f1132992ae365615ca48799513da9e323 100644
--- a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/MapFieldAccessor.cs
+++ b/third_party/grpc/src/csharp/Grpc.Core/Internal/CallCredentialsSafeHandle.cs
@@ -1,7 +1,6 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
+#region Copyright notice and license
+// Copyright 2015-2016, Google Inc.
+// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -29,31 +28,33 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
-
using System;
-using System.Collections;
-using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Threading;
+using System.Threading.Tasks;
-namespace Google.Protobuf.Reflection
+namespace Grpc.Core.Internal
{
/// <summary>
- /// Accessor for map fields.
+ /// grpc_call_credentials from <c>grpc/grpc_security.h</c>
/// </summary>
- internal sealed class MapFieldAccessor : FieldAccessorBase
+ internal class CallCredentialsSafeHandle : SafeHandleZeroIsInvalid
{
- internal MapFieldAccessor(PropertyInfo property, FieldDescriptor descriptor) : base(property, descriptor)
+ static readonly NativeMethods Native = NativeMethods.Get();
+
+ private CallCredentialsSafeHandle()
{
}
- public override void Clear(IMessage message)
+ public static CallCredentialsSafeHandle CreateComposite(CallCredentialsSafeHandle creds1, CallCredentialsSafeHandle creds2)
{
- IDictionary list = (IDictionary) GetValue(message);
- list.Clear();
+ return Native.grpcsharp_composite_call_credentials_create(creds1, creds2);
}
- public override void SetValue(IMessage message, object value)
+ protected override bool ReleaseHandle()
{
- throw new InvalidOperationException("SetValue is not implemented for map fields");
+ Native.grpcsharp_call_credentials_release(handle);
+ return true;
}
}
}

Powered by Google App Engine
This is Rietveld 408576698