From 20afa3d7c933207c548ed11928c47b552b5b2f80 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 17 Oct 2016 14:52:14 -0700 Subject: BufferPool --> ResourceQuota --- src/cpp/common/buffer_pool_cc.cc | 51 ------------------------------------- src/cpp/common/channel_arguments.cc | 8 +++--- src/cpp/common/resource_quota_cc.cc | 51 +++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 55 deletions(-) delete mode 100644 src/cpp/common/buffer_pool_cc.cc create mode 100644 src/cpp/common/resource_quota_cc.cc (limited to 'src/cpp/common') diff --git a/src/cpp/common/buffer_pool_cc.cc b/src/cpp/common/buffer_pool_cc.cc deleted file mode 100644 index fe5704d661..0000000000 --- a/src/cpp/common/buffer_pool_cc.cc +++ /dev/null @@ -1,51 +0,0 @@ -/* - * - * Copyright 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 - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include -#include - -namespace grpc { - -BufferPool::BufferPool() : impl_(grpc_buffer_pool_create(nullptr)) {} - -BufferPool::BufferPool(const grpc::string& name) - : impl_(grpc_buffer_pool_create(name.c_str())) {} - -BufferPool::~BufferPool() { grpc_buffer_pool_unref(impl_); } - -BufferPool& BufferPool::Resize(size_t new_size) { - grpc_buffer_pool_resize(impl_, new_size); - return *this; -} - -} // namespace grpc diff --git a/src/cpp/common/channel_arguments.cc b/src/cpp/common/channel_arguments.cc index afde513e1e..6e84170d97 100644 --- a/src/cpp/common/channel_arguments.cc +++ b/src/cpp/common/channel_arguments.cc @@ -34,7 +34,7 @@ #include -#include +#include #include #include #include "src/core/lib/channel/channel_args.h" @@ -114,9 +114,9 @@ void ChannelArguments::SetUserAgentPrefix( } } -void ChannelArguments::SetBufferPool(const grpc::BufferPool& buffer_pool) { - SetPointerWithVtable(GRPC_ARG_BUFFER_POOL, buffer_pool.c_buffer_pool(), - grpc_buffer_pool_arg_vtable()); +void ChannelArguments::SetResourceQuota(const grpc::ResourceQuota& resource_quota) { + SetPointerWithVtable(GRPC_ARG_BUFFER_POOL, resource_quota.c_resource_quota(), + grpc_resource_quota_arg_vtable()); } void ChannelArguments::SetInt(const grpc::string& key, int value) { diff --git a/src/cpp/common/resource_quota_cc.cc b/src/cpp/common/resource_quota_cc.cc new file mode 100644 index 0000000000..335896ab91 --- /dev/null +++ b/src/cpp/common/resource_quota_cc.cc @@ -0,0 +1,51 @@ +/* + * + * Copyright 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 + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include + +namespace grpc { + +ResourceQuota::ResourceQuota() : impl_(grpc_resource_quota_create(nullptr)) {} + +ResourceQuota::ResourceQuota(const grpc::string& name) + : impl_(grpc_resource_quota_create(name.c_str())) {} + +ResourceQuota::~ResourceQuota() { grpc_resource_quota_unref(impl_); } + +ResourceQuota& ResourceQuota::Resize(size_t new_size) { + grpc_resource_quota_resize(impl_, new_size); + return *this; +} + +} // namespace grpc -- cgit v1.2.3