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

Unified Diff: third_party/grpc/src/csharp/Grpc.Core/Internal/ChannelArgsSafeHandle.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/ChannelArgsSafeHandle.cs
diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs b/third_party/grpc/src/csharp/Grpc.Core/Internal/ChannelArgsSafeHandle.cs
similarity index 59%
copy from third_party/protobuf/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs
copy to third_party/grpc/src/csharp/Grpc.Core/Internal/ChannelArgsSafeHandle.cs
index e547d834986de8d80703504469e9c39b3d8ae93d..f6aa710b21433dca77b619ecf838dd8bf60bc3d8 100644
--- a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs
+++ b/third_party/grpc/src/csharp/Grpc.Core/Internal/ChannelArgsSafeHandle.cs
@@ -1,7 +1,6 @@
#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
+// 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,40 +28,47 @@
// (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.Runtime.InteropServices;
+using System.Threading.Tasks;
-namespace Google.Protobuf.Reflection
+namespace Grpc.Core.Internal
{
/// <summary>
- /// Represents a package in the symbol table. We use PackageDescriptors
- /// just as placeholders so that someone cannot define, say, a message type
- /// that has the same name as an existing package.
+ /// grpc_channel_args from <c>grpc/grpc.h</c>
/// </summary>
- internal sealed class PackageDescriptor : IDescriptor
+ internal class ChannelArgsSafeHandle : SafeHandleZeroIsInvalid
{
- private readonly string name;
- private readonly string fullName;
- private readonly FileDescriptor file;
+ static readonly NativeMethods Native = NativeMethods.Get();
- internal PackageDescriptor(string name, string fullName, FileDescriptor file)
+ private ChannelArgsSafeHandle()
{
- this.file = file;
- this.fullName = fullName;
- this.name = name;
}
- public string Name
+ public static ChannelArgsSafeHandle CreateNull()
{
- get { return name; }
+ return new ChannelArgsSafeHandle();
}
- public string FullName
+ public static ChannelArgsSafeHandle Create(int size)
{
- get { return fullName; }
+ return Native.grpcsharp_channel_args_create(new UIntPtr((uint)size));
}
- public FileDescriptor File
+ public void SetString(int index, string key, string value)
{
- get { return file; }
+ Native.grpcsharp_channel_args_set_string(this, new UIntPtr((uint)index), key, value);
+ }
+
+ public void SetInteger(int index, string key, int value)
+ {
+ Native.grpcsharp_channel_args_set_integer(this, new UIntPtr((uint)index), key, value);
+ }
+
+ protected override bool ReleaseHandle()
+ {
+ Native.grpcsharp_channel_args_destroy(handle);
+ return true;
}
}
-}
+}

Powered by Google App Engine
This is Rietveld 408576698