Merge branch 'master' into removrun

reviewable/pr20906/r2
Yash Tibrewal 5 years ago
commit fe88f14410
  1. 2
      .github/ISSUE_TEMPLATE/bug_report.md
  2. 2
      .github/ISSUE_TEMPLATE/cleanup_request.md
  3. 2
      .github/ISSUE_TEMPLATE/feature_request.md
  4. 2
      .github/pull_request_template.md
  5. 12
      BUILD
  6. 32
      BUILD.gn
  7. 15790
      CMakeLists.txt
  8. 2
      MAINTAINERS.md
  9. 610
      Makefile
  10. 23
      WORKSPACE
  11. 17
      bazel/custom_exec_properties.bzl
  12. 38
      bazel/cython_library.bzl
  13. 1
      bazel/generate_cc.bzl
  14. 30
      bazel/generate_objc.bzl
  15. 65
      bazel/grpc_build_system.bzl
  16. 14
      bazel/grpc_deps.bzl
  17. 1
      bazel/grpc_python_deps.bzl
  18. 3
      bazel/objc_grpc_library.bzl
  19. 2
      bazel/protobuf.bzl
  20. 35
      bazel/python_rules.bzl
  21. 18
      bazel/test/python_test_repo/BUILD
  22. 100
      build.yaml
  23. 2
      build_config.rb
  24. 17
      cmake/benchmark.cmake
  25. 6
      cmake/cares.cmake
  26. 16
      cmake/gRPCConfig.cmake.in
  27. 11
      cmake/gRPCConfigVersion.cmake.in
  28. 6
      cmake/gflags.cmake
  29. 8
      cmake/msvc_static_runtime.cmake
  30. 8
      cmake/protobuf.cmake
  31. 10
      cmake/ssl.cmake
  32. 2
      cmake/upb.cmake
  33. 10
      cmake/zlib.cmake
  34. 12
      config.m4
  35. 12
      config.w32
  36. 14
      doc/core/grpc-polling-engines.md
  37. 2
      examples/BUILD
  38. 28
      examples/objective-c/BUILD
  39. 11
      examples/objective-c/helloworld/main.m
  40. 3
      examples/objective-c/helloworld_macos/main.m
  41. 10
      examples/objective-c/route_guide/ViewControllers.m
  42. 18
      examples/python/auth/BUILD.bazel
  43. 18
      examples/python/cancellation/BUILD.bazel
  44. 20
      examples/python/compression/BUILD.bazel
  45. 22
      examples/python/debug/BUILD.bazel
  46. 18
      examples/python/errors/BUILD.bazel
  47. 18
      examples/python/multiprocessing/BUILD
  48. 6
      examples/python/wait_for_ready/BUILD.bazel
  49. 11
      gRPC-C++.podspec
  50. 2
      gRPC-Core.podspec
  51. 154
      grpc.bzl
  52. 2
      grpc.def
  53. 29
      grpc.gemspec
  54. 56
      grpc.gyp
  55. 7
      include/grpc/impl/codegen/port_platform.h
  56. 16
      include/grpc/support/alloc.h
  57. 12
      include/grpcpp/impl/codegen/rpc_service_method.h
  58. 29
      package.xml
  59. 2
      src/compiler/BUILD
  60. 4
      src/core/ext/filters/client_channel/backend_metric.cc
  61. 116
      src/core/ext/filters/client_channel/client_channel.cc
  62. 14
      src/core/ext/filters/client_channel/client_channel_channelz.cc
  63. 6
      src/core/ext/filters/client_channel/client_channel_channelz.h
  64. 10
      src/core/ext/filters/client_channel/global_subchannel_pool.cc
  65. 7
      src/core/ext/filters/client_channel/health/health_check_client.cc
  66. 46
      src/core/ext/filters/client_channel/http_connect_handshaker.cc
  67. 4
      src/core/ext/filters/client_channel/http_proxy.cc
  68. 11
      src/core/ext/filters/client_channel/lb_policy.h
  69. 27
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
  70. 4
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc
  71. 6
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc
  72. 8
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h
  73. 2
      src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc
  74. 2
      src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
  75. 2
      src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
  76. 8
      src/core/ext/filters/client_channel/lb_policy/subchannel_list.h
  77. 12
      src/core/ext/filters/client_channel/lb_policy/xds/cds.cc
  78. 47
      src/core/ext/filters/client_channel/lb_policy/xds/xds.cc
  79. 10
      src/core/ext/filters/client_channel/lb_policy_registry.cc
  80. 2
      src/core/ext/filters/client_channel/lb_policy_registry.h
  81. 6
      src/core/ext/filters/client_channel/local_subchannel_pool.cc
  82. 8
      src/core/ext/filters/client_channel/parse_address.cc
  83. 3
      src/core/ext/filters/client_channel/resolver.cc
  84. 4
      src/core/ext/filters/client_channel/resolver.h
  85. 5
      src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
  86. 8
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc
  87. 2
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h
  88. 23
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc
  89. 5
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc
  90. 17
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc
  91. 61
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
  92. 4
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h
  93. 8
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc
  94. 3
      src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
  95. 18
      src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc
  96. 7
      src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
  97. 2
      src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc
  98. 6
      src/core/ext/filters/client_channel/resolver_factory.h
  99. 26
      src/core/ext/filters/client_channel/resolver_registry.cc
  100. 9
      src/core/ext/filters/client_channel/resolver_registry.h
  101. Some files were not shown because too many files have changed in this diff Show More

@ -2,7 +2,7 @@
name: Report a bug
about: Create a report to help us improve
labels: kind/bug, priority/P2
assignees: sheenaqotj
assignees: hcaseyal
---

@ -2,7 +2,7 @@
name: Request a cleanup
about: Suggest a cleanup in our repository
labels: kind/internal cleanup, priority/P2
assignees: sheenaqotj
assignees: hcaseyal
---

@ -2,7 +2,7 @@
name: Request a feature
about: Suggest an idea for this project
labels: kind/enhancement, priority/P2
assignees: sheenaqotj
assignees: hcaseyal
---

@ -8,4 +8,4 @@ If you know who should review your pull request, please remove the mentioning be
-->
@sheenaqotj
@hcaseyal

12
BUILD

@ -69,12 +69,17 @@ config_setting(
values = {"cpu": "darwin"},
)
config_setting(
name = "grpc_use_absl",
values = {"define": "GRPC_USE_ABSL=1"},
)
python_config_settings()
# This should be updated along with build.yaml
g_stands_for = "gon"
core_version = "7.0.0"
core_version = "9.0.0"
version = "1.26.0-dev"
@ -318,9 +323,9 @@ grpc_cc_library(
standalone = True,
deps = [
"grpc_common",
"grpc_lb_policy_cds",
"grpc_lb_policy_grpclb",
"grpc_lb_policy_xds",
"grpc_lb_policy_cds",
"grpc_resolver_xds",
],
)
@ -336,9 +341,9 @@ grpc_cc_library(
standalone = True,
deps = [
"grpc_common",
"grpc_lb_policy_cds_secure",
"grpc_lb_policy_grpclb_secure",
"grpc_lb_policy_xds_secure",
"grpc_lb_policy_cds_secure",
"grpc_resolver_xds_secure",
"grpc_secure",
"grpc_transport_chttp2_client_secure",
@ -530,7 +535,6 @@ grpc_cc_library(
"src/core/lib/gprpp/map.h",
"src/core/lib/gprpp/memory.h",
"src/core/lib/gprpp/mpscq.h",
"src/core/lib/gprpp/set.h",
"src/core/lib/gprpp/string_view.h",
"src/core/lib/gprpp/sync.h",
"src/core/lib/gprpp/thd.h",

@ -149,7 +149,6 @@ config("grpc_config") {
"src/core/lib/gprpp/memory.h",
"src/core/lib/gprpp/mpscq.cc",
"src/core/lib/gprpp/mpscq.h",
"src/core/lib/gprpp/set.h",
"src/core/lib/gprpp/sync.h",
"src/core/lib/gprpp/thd.h",
"src/core/lib/gprpp/thd_posix.cc",
@ -904,25 +903,12 @@ config("grpc_config") {
"src/core/tsi/transport_security_grpc.cc",
"src/core/tsi/transport_security_grpc.h",
"src/core/tsi/transport_security_interface.h",
"third_party/upb/upb/decode.c",
"third_party/upb/upb/decode.h",
"third_party/upb/upb/encode.c",
"third_party/upb/upb/encode.h",
"third_party/upb/upb/generated_util.h",
"third_party/upb/upb/msg.c",
"third_party/upb/upb/msg.h",
"third_party/upb/upb/port.c",
"third_party/upb/upb/port_def.inc",
"third_party/upb/upb/port_undef.inc",
"third_party/upb/upb/table.c",
"third_party/upb/upb/table.int.h",
"third_party/upb/upb/upb.c",
"third_party/upb/upb/upb.h",
]
deps = [
"//third_party/boringssl",
"//third_party/zlib",
":gpr",
":upb",
"//third_party/cares",
":address_sorting",
]
@ -1263,7 +1249,6 @@ config("grpc_config") {
"src/core/lib/gprpp/orphanable.h",
"src/core/lib/gprpp/ref_counted.h",
"src/core/lib/gprpp/ref_counted_ptr.h",
"src/core/lib/gprpp/set.h",
"src/core/lib/gprpp/string_view.h",
"src/core/lib/gprpp/sync.h",
"src/core/lib/gprpp/thd.h",
@ -1438,26 +1423,13 @@ config("grpc_config") {
"src/cpp/util/status.cc",
"src/cpp/util/string_ref.cc",
"src/cpp/util/time_cc.cc",
"third_party/upb/upb/decode.c",
"third_party/upb/upb/decode.h",
"third_party/upb/upb/encode.c",
"third_party/upb/upb/encode.h",
"third_party/upb/upb/generated_util.h",
"third_party/upb/upb/msg.c",
"third_party/upb/upb/msg.h",
"third_party/upb/upb/port.c",
"third_party/upb/upb/port_def.inc",
"third_party/upb/upb/port_undef.inc",
"third_party/upb/upb/table.c",
"third_party/upb/upb/table.int.h",
"third_party/upb/upb/upb.c",
"third_party/upb/upb/upb.h",
]
deps = [
"//third_party/boringssl",
"//third_party/protobuf:protobuf_lite",
":grpc",
":gpr",
":upb",
]
public_configs = [

File diff suppressed because it is too large Load Diff

@ -18,6 +18,7 @@ for general contribution guidelines.
- [dfawley](https://github.com/dfawley), Google LLC
- [dklempner](https://github.com/dklempner), Google LLC
- [ejona86](https://github.com/ejona86), Google LLC
- [ericgribkoff](https://github.com/ericgribkoff), Google LLC
- [gnossen](https://github.com/gnossen), Google LLC
- [guantaol](https://github.com/guantaol), Google LLC
- [hcaseyal](https://github.com/hcaseyal), Google LLC
@ -64,7 +65,6 @@ for general contribution guidelines.
- [billfeng327](https://github.com/billfeng327), Google LLC
- [ctiller](https://github.com/ctiller), Google LLC
- [dgquintas](https://github.com/dgquintas), Google LLC
- [ericgribkoff](https://github.com/ericgribkoff), Google LLC
- [fengli79](https://github.com/fengli79), Google LLC
- [jcanizales](https://github.com/jcanizales), Google LLC
- [jpalmerLinuxFoundation](https://github.com/jpalmerLinuxFoundation), Linux Foundation

File diff suppressed because it is too large Load Diff

@ -11,8 +11,6 @@ load("//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")
grpc_extra_deps()
register_execution_platforms(
"//third_party/toolchains:local",
"//third_party/toolchains:local_large",
"//third_party/toolchains:rbe_windows",
)
@ -20,11 +18,28 @@ register_toolchains(
"//third_party/toolchains/bazel_0.26.0_rbe_windows:cc-toolchain-x64_windows",
)
load("@bazel_toolchains//rules/exec_properties:exec_properties.bzl", "create_exec_properties_dict", "custom_exec_properties")
custom_exec_properties(
name = "grpc_custom_exec_properties",
constants = {
"LARGE_MACHINE": create_exec_properties_dict(gce_machine_type = "n1-standard-8"),
},
)
load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig")
# Create toolchain configuration for remote execution.
rbe_autoconfig(
name = "rbe_default",
exec_properties = create_exec_properties_dict(
docker_add_capabilities = "SYS_PTRACE",
docker_privileged = True,
# n1-highmem-2 is the default (small machine) machine type. Targets
# that want to use other machines (such as LARGE_MACHINE) will override
# this value.
gce_machine_type = "n1-highmem-2",
),
# use exec_properties instead of deprecated remote_execution_properties
use_legacy_platform_definition = False,
)
@ -43,7 +58,7 @@ rbe_autoconfig(
),
)
load("@io_bazel_rules_python//python:pip.bzl", "pip_repositories", "pip_import")
load("@io_bazel_rules_python//python:pip.bzl", "pip_import", "pip_repositories")
pip_import(
name = "grpc_python_dependencies",
@ -51,5 +66,7 @@ pip_import(
)
load("@grpc_python_dependencies//:requirements.bzl", "pip_install")
pip_repositories()
pip_install()

@ -0,0 +1,17 @@
# Copyright 2019 The gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
load("@grpc_custom_exec_properties//:constants.bzl", _LARGE_MACHINE = "LARGE_MACHINE")
LARGE_MACHINE = _LARGE_MACHINE

@ -1,13 +1,12 @@
"""Custom rules for gRPC Python"""
# Adapted with modifications from
# tensorflow/tensorflow/core/platform/default/build_config.bzl
# Native Bazel rules don't exist yet to compile Cython code, but rules have
# been written at cython/cython and tensorflow/tensorflow. We branch from
# Tensorflow's version as it is more actively maintained and works for gRPC
# Python's needs.
def pyx_library(name, deps=[], py_deps=[], srcs=[], **kwargs):
def pyx_library(name, deps = [], py_deps = [], srcs = [], **kwargs):
"""Compiles a group of .pyx / .pxd / .py files.
First runs Cython to create .cpp files for each input .pyx or .py + .pxd
@ -23,6 +22,7 @@ def pyx_library(name, deps=[], py_deps=[], srcs=[], **kwargs):
srcs: .py, .pyx, or .pxd files to either compile or pass through.
**kwargs: Extra keyword arguments passed to the py_library.
"""
# First filter out files that should be run compiled vs. passed through.
py_srcs = []
pyx_srcs = []
@ -41,14 +41,14 @@ def pyx_library(name, deps=[], py_deps=[], srcs=[], **kwargs):
# Invoke cython to produce the shared object libraries.
for filename in pyx_srcs:
native.genrule(
name=filename + "_cython_translation",
srcs=[filename],
outs=[filename.split(".")[0] + ".cpp"],
name = filename + "_cython_translation",
srcs = [filename],
outs = [filename.split(".")[0] + ".cpp"],
# Optionally use PYTHON_BIN_PATH on Linux platforms so that python 3
# works. Windows has issues with cython_binary so skip PYTHON_BIN_PATH.
cmd=
"PYTHONHASHSEED=0 $(location @cython//:cython_binary) --cplus $(SRCS) --output-file $(OUTS)",
tools=["@cython//:cython_binary"] + pxd_srcs,
cmd =
"PYTHONHASHSEED=0 $(location @cython//:cython_binary) --cplus $(SRCS) --output-file $(OUTS)",
tools = ["@cython//:cython_binary"] + pxd_srcs,
)
shared_objects = []
@ -56,19 +56,19 @@ def pyx_library(name, deps=[], py_deps=[], srcs=[], **kwargs):
stem = src.split(".")[0]
shared_object_name = stem + ".so"
native.cc_binary(
name=shared_object_name,
srcs=[stem + ".cpp"],
deps=deps + ["@local_config_python//:python_headers"],
linkshared=1,
name = shared_object_name,
srcs = [stem + ".cpp"],
deps = deps + ["@local_config_python//:python_headers"],
linkshared = 1,
)
shared_objects.append(shared_object_name)
# Now create a py_library with these shared objects as data.
native.py_library(
name=name,
srcs=py_srcs,
deps=py_deps,
srcs_version="PY2AND3",
data=shared_objects,
**kwargs)
name = name,
srcs = py_srcs,
deps = py_deps,
srcs_version = "PY2AND3",
data = shared_objects,
**kwargs
)

@ -111,6 +111,7 @@ def generate_cc_impl(ctx):
"--proto_path={}".format(get_include_directory(i))
for i in includes
]
# Include the output directory so that protoc puts the generated code in the
# right directory.
arguments += ["--proto_path={0}{1}".format(dir_out, proto_root)]

@ -4,7 +4,7 @@ load(
"get_plugin_args",
"proto_path_to_generated_filename",
)
load(":grpc_util.bzl", "to_upper_camel_with_extension",)
load(":grpc_util.bzl", "to_upper_camel_with_extension")
_GRPC_PROTO_HEADER_FMT = "{}.pbrpc.h"
_GRPC_PROTO_SRC_FMT = "{}.pbrpc.m"
@ -40,7 +40,9 @@ def _generate_objc_impl(ctx):
out_files = [ctx.actions.declare_file(out) for out in outs]
dir_out = _join_directories([
str(ctx.genfiles_dir.path), target_package, _GENERATED_PROTOS_DIR
str(ctx.genfiles_dir.path),
target_package,
_GENERATED_PROTOS_DIR,
])
arguments = []
@ -70,6 +72,7 @@ def _generate_objc_impl(ctx):
well_known_proto_files = []
if ctx.attr.use_well_known_protos:
f = ctx.attr.well_known_protos.files.to_list()[0].dirname
# go two levels up so that #import "google/protobuf/..." is correct
arguments += ["-I{0}".format(f + "/../..")]
well_known_proto_files = ctx.attr.well_known_protos.files.to_list()
@ -90,6 +93,7 @@ def _label_to_full_file_path(src, package):
# "a.proto" -> ":a.proto"
src = ":" + src
src = "//" + package + src
# Converts //path/to/package:File.ext to path/to/package/File.ext.
src = src.replace("//", "")
src = src.replace(":", "/")
@ -119,6 +123,7 @@ def _get_directory_from_proto(proto):
def _get_full_path_from_file(file):
gen_dir_length = 0
# if file is generated, then prepare to remote its root
# (including CPU architecture...)
if not file.is_source:
@ -130,7 +135,6 @@ def _join_directories(directories):
massaged_directories = [directory for directory in directories if len(directory) != 0]
return "/".join(massaged_directories)
generate_objc = rule(
attrs = {
"deps": attr.label_list(
@ -146,14 +150,14 @@ generate_objc = rule(
),
"srcs": attr.string_list(
mandatory = False,
allow_empty = True
allow_empty = True,
),
"use_well_known_protos": attr.bool(
mandatory = False,
default = False
default = False,
),
"well_known_protos": attr.label(
default = "@com_google_protobuf//:well_known_protos"
default = "@com_google_protobuf//:well_known_protos",
),
"_protoc": attr.label(
default = Label("//external:protocol_compiler"),
@ -162,7 +166,7 @@ generate_objc = rule(
),
},
output_to_genfiles = True,
implementation = _generate_objc_impl
implementation = _generate_objc_impl,
)
def _group_objc_files_impl(ctx):
@ -189,9 +193,9 @@ generate_objc_hdrs = rule(
),
"gen_mode": attr.int(
default = _GENERATE_HDRS,
)
),
},
implementation = _group_objc_files_impl
implementation = _group_objc_files_impl,
)
generate_objc_srcs = rule(
@ -201,9 +205,9 @@ generate_objc_srcs = rule(
),
"gen_mode": attr.int(
default = _GENERATE_SRCS,
)
),
},
implementation = _group_objc_files_impl
implementation = _group_objc_files_impl,
)
generate_objc_non_arc_srcs = rule(
@ -213,7 +217,7 @@ generate_objc_non_arc_srcs = rule(
),
"gen_mode": attr.int(
default = _GENERATE_NON_ARC_SRCS,
)
),
},
implementation = _group_objc_files_impl
implementation = _group_objc_files_impl,
)

@ -27,14 +27,9 @@ load("//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("@upb//bazel:upb_proto_library.bzl", "upb_proto_library")
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test")
# The set of pollers to test against if a test exercises polling
POLLERS = ["epollex", "epoll1", "poll"]
# set exec_properties = LARGE_MACHINE, to run the test on a large machine
# see //third_party/toolchains/machine_size for details
LARGE_MACHINE = { "gceMachineType" : "n1-standard-8"}
def if_not_windows(a):
return select({
"//:windows": [],
@ -60,6 +55,8 @@ def _get_external_deps(external_deps):
})
elif dep == "cronet_c_for_grpc":
ret += ["//third_party/objective_c/Cronet:cronet_c_for_grpc"]
elif dep.startswith("absl/"):
ret += ["@com_google_absl//" + dep]
else:
ret += ["//external:" + dep]
return ret
@ -87,6 +84,24 @@ def grpc_cc_library(
linkopts = if_not_windows(["-pthread"])
if use_cfstream:
linkopts = linkopts + if_mac(["-framework CoreFoundation"])
# This is a temporary solution to enable absl dependency only for
# Bazel-build with grpc_use_absl enabled to abseilfy in-house classes
# such as inlined_vector before absl is fully supported.
# When https://github.com/grpc/grpc/pull/20184 is merged, it will
# be removed.
more_external_deps = []
if name == "inlined_vector":
more_external_deps += select({
"//:grpc_use_absl": ["@com_google_absl//absl/container:inlined_vector"],
"//conditions:default": [],
})
if name == "gpr_base":
more_external_deps += select({
"//:grpc_use_absl": ["@com_google_absl//absl/strings:strings"],
"//conditions:default": [],
})
native.cc_library(
name = name,
srcs = srcs,
@ -102,16 +117,20 @@ def grpc_cc_library(
"//:grpc_allow_exceptions": ["GRPC_ALLOW_EXCEPTIONS=1"],
"//:grpc_disallow_exceptions": ["GRPC_ALLOW_EXCEPTIONS=0"],
"//conditions:default": [],
}) +
select({
"//:grpc_use_absl": ["GRPC_USE_ABSL=1"],
"//conditions:default": [],
}),
hdrs = hdrs + public_hdrs,
deps = deps + _get_external_deps(external_deps),
deps = deps + _get_external_deps(external_deps) + more_external_deps,
copts = copts,
visibility = visibility,
testonly = testonly,
linkopts = linkopts,
includes = [
"include",
"src/core/ext/upb-generated", # Once upb code-gen issue is resolved, remove this.
"include",
"src/core/ext/upb-generated", # Once upb code-gen issue is resolved, remove this.
],
alwayslink = alwayslink,
data = data,
@ -142,11 +161,12 @@ def grpc_proto_library(
use_external = use_external,
generate_mocks = generate_mocks,
)
def ios_cc_test(
name,
tags = [],
**kwargs):
ios_test_adapter = "//third_party/objective_c/google_toolbox_for_mac:GTM_GoogleTestRunner_GTM_USING_XCTEST";
ios_test_adapter = "//third_party/objective_c/google_toolbox_for_mac:GTM_GoogleTestRunner_GTM_USING_XCTEST"
test_lib_ios = name + "_test_lib_ios"
ios_tags = tags + ["manual", "ios_cc_test"]
@ -186,7 +206,7 @@ def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data
"exec_properties": exec_properties,
}
if uses_polling:
# the vanilla version of the test should run on platforms that only
# the vanilla version of the test should run on platforms that only
# support a single poller
native.cc_test(
name = name,
@ -196,6 +216,7 @@ def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data
]),
**args
)
# on linux we run the same test multiple times, once for each poller
for poller in POLLERS:
native.sh_test(
@ -223,7 +244,6 @@ def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data
**args
)
def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], data = [], language = "C++", testonly = False, linkshared = False, linkopts = [], tags = []):
copts = []
if language.upper() == "C":
@ -266,14 +286,15 @@ def grpc_sh_binary(name, srcs, data = []):
data = data,
)
def grpc_py_binary(name,
srcs,
data = [],
deps = [],
external_deps = [],
testonly = False,
python_version = "PY2",
**kwargs):
def grpc_py_binary(
name,
srcs,
data = [],
deps = [],
external_deps = [],
testonly = False,
python_version = "PY2",
**kwargs):
native.py_binary(
name = name,
srcs = srcs,
@ -323,7 +344,7 @@ def grpc_objc_library(
deps: dependencies
visibility: visibility, default to public
"""
native.objc_library(
name = name,
hdrs = hdrs,
@ -335,14 +356,12 @@ def grpc_objc_library(
includes = includes,
visibility = visibility,
)
def grpc_upb_proto_library(name, deps):
upb_proto_library(name = name, deps = deps)
def python_config_settings():
native.config_setting(
name = "python3",
flag_values = {"@bazel_tools//tools/python:python_version": "PY3"},
)

@ -165,20 +165,20 @@ def grpc_deps():
if "com_google_absl" not in native.existing_rules():
http_archive(
name = "com_google_absl",
sha256 = "fd4edc10767c28b23bf9f41114c6bcd9625c165a31baa0e6939f01058029a912",
strip_prefix = "abseil-cpp-74d91756c11bc22f9b0108b94da9326f7f9e376f",
url = "https://github.com/abseil/abseil-cpp/archive/74d91756c11bc22f9b0108b94da9326f7f9e376f.tar.gz",
sha256 = "c5f6429c067e6b8f3c6d13d1ab2bdcd559c6f8b85317aa5b0dc8c364c37d1742",
strip_prefix = "abseil-cpp-846e5dbedac123d12455adcfe6f53c8b5dcbfeef",
url = "https://github.com/abseil/abseil-cpp/archive/846e5dbedac123d12455adcfe6f53c8b5dcbfeef.tar.gz",
)
if "bazel_toolchains" not in native.existing_rules():
# list of releases is at https://releases.bazel.build/bazel-toolchains.html
http_archive(
name = "bazel_toolchains",
sha256 = "e9bab54199722935f239cb1cd56a80be2ac3c3843e1a6d3492e2bc11f9c21daf",
strip_prefix = "bazel-toolchains-1.0.0",
sha256 = "0b36eef8a66f39c8dbae88e522d5bbbef49d5e66e834a982402c79962281be10",
strip_prefix = "bazel-toolchains-1.0.1",
urls = [
"https://github.com/bazelbuild/bazel-toolchains/releases/download/1.0.0/bazel-toolchains-1.0.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/1.0.0.tar.gz",
"https://github.com/bazelbuild/bazel-toolchains/releases/download/1.0.1/bazel-toolchains-1.0.1.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/1.0.1.tar.gz",
],
)

@ -71,4 +71,3 @@ def grpc_python_deps():
"https://github.com/cython/cython/archive/c2b80d87658a8525ce091cbe146cb7eaa29fed5c.tar.gz",
],
)

@ -2,8 +2,8 @@ load(
"//bazel:generate_objc.bzl",
"generate_objc",
"generate_objc_hdrs",
"generate_objc_non_arc_srcs",
"generate_objc_srcs",
"generate_objc_non_arc_srcs"
)
load("//bazel:protobuf.bzl", "well_known_proto_libs")
@ -66,4 +66,3 @@ def objc_grpc_library(name, deps, srcs = [], use_well_known_protos = False, **kw
],
**kwargs
)

@ -123,7 +123,7 @@ def get_plugin_args(
"--{plugin_name}_out={dir_out}".format(
plugin_name = plugin_name,
dir_out = augmented_dir_out,
)
),
]
def _get_staged_proto_file(context, source_file):

@ -2,13 +2,13 @@
load(
"//bazel:protobuf.bzl",
"declare_out_files",
"get_include_directory",
"get_out_dir",
"get_plugin_args",
"protos_from_context",
"includes_from_deps",
"get_proto_arguments",
"declare_out_files",
"get_out_dir",
"includes_from_deps",
"protos_from_context",
)
_GENERATED_PROTO_FORMAT = "{}_pb2.py"
@ -35,7 +35,7 @@ def _generate_py_impl(context):
[],
out_dir.path,
False,
context.attr.plugin.label.name
context.attr.plugin.label.name,
)
tools.append(context.executable.plugin)
@ -104,7 +104,6 @@ def py_proto_library(
if len(deps) != 1:
fail("Can only compile a single proto at a time.")
_generate_pb2_src(
name = codegen_target,
deps = deps,
@ -144,7 +143,7 @@ def _generate_pb2_grpc_src_impl(context):
[],
out_dir.path,
False,
context.attr.plugin.label.name
context.attr.plugin.label.name,
)
tools.append(context.executable.plugin)
@ -207,12 +206,12 @@ _generate_pb2_grpc_src = rule(
)
def py_grpc_library(
name,
srcs,
deps,
plugin = None,
strip_prefixes = [],
**kwargs):
name,
srcs,
deps,
plugin = None,
strip_prefixes = [],
**kwargs):
"""Generate python code for gRPC services defined in a protobuf.
Args:
@ -253,15 +252,15 @@ def py_grpc_library(
deps = [
Label("//src/python/grpcio/grpc:grpcio"),
] + deps + [
":{}".format(codegen_grpc_target)
":{}".format(codegen_grpc_target),
],
**kwargs
)
def py2and3_test(name,
py_test = native.py_test,
**kwargs):
def py2and3_test(
name,
py_test = native.py_test,
**kwargs):
"""Runs a Python test under both Python 2 and Python 3.
Args:

@ -16,9 +16,9 @@
load(
"@com_github_grpc_grpc//bazel:python_rules.bzl",
"py_proto_library",
"py_grpc_library",
"py2and3_test",
"py_grpc_library",
"py_proto_library",
)
package(default_testonly = 1)
@ -55,12 +55,12 @@ py_proto_library(
py2and3_test(
name = "import_test",
main = "helloworld.py",
srcs = ["helloworld.py"],
main = "helloworld.py",
deps = [
":duration_py_pb2",
":helloworld_py_pb2",
":helloworld_py_pb2_grpc",
":duration_py_pb2",
":timestamp_py_pb2",
],
)
@ -71,19 +71,19 @@ py2and3_test(
proto_library(
name = "helloworld_moved_proto",
srcs = ["helloworld.proto"],
import_prefix = "google/cloud",
strip_import_prefix = "",
deps = [
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:timestamp_proto",
],
import_prefix = "google/cloud",
strip_import_prefix = ""
)
# Also test the custom plugin execution parameter
py_proto_library(
name = "helloworld_moved_py_pb2",
plugin = ":dummy_plugin",
deps = [":helloworld_moved_proto"],
plugin = ":dummy_plugin"
)
py_grpc_library(
@ -94,12 +94,12 @@ py_grpc_library(
py2and3_test(
name = "import_moved_test",
main = "helloworld_moved.py",
srcs = ["helloworld_moved.py"],
main = "helloworld_moved.py",
deps = [
":duration_py_pb2",
":helloworld_moved_py_pb2",
":helloworld_moved_py_pb2_grpc",
":duration_py_pb2",
":timestamp_py_pb2",
],
)

@ -12,7 +12,7 @@ settings:
'#08': Use "-preN" suffixes to identify pre-release versions
'#09': Per-language overrides are possible with (eg) ruby_version tag here
'#10': See the expand_version.py for all the quirks here
core_version: 8.0.0
core_version: 9.0.0
csharp_major_version: 2
g_stands_for: gon
version: 1.26.0-dev
@ -69,7 +69,7 @@ filegroups:
- src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c
- src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c
- src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c
uses:
deps:
- upb
- name: alts_util
public_headers:
@ -89,11 +89,12 @@ filegroups:
- src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc
- src/core/tsi/alts/handshaker/alts_tsi_utils.cc
- src/core/tsi/alts/handshaker/transport_security_common_api.cc
deps:
- upb
uses:
- alts_upb
- grpc_base
- tsi_interface
- upb
- name: census
public_headers:
- include/grpc/census.h
@ -201,7 +202,7 @@ filegroups:
- src/core/ext/upb-generated/google/protobuf/timestamp.upb.c
- src/core/ext/upb-generated/google/protobuf/wrappers.upb.c
- src/core/ext/upb-generated/google/rpc/status.upb.c
uses:
deps:
- upb
- name: gpr_base
src:
@ -293,7 +294,6 @@ filegroups:
- src/core/lib/gprpp/map.h
- src/core/lib/gprpp/memory.h
- src/core/lib/gprpp/mpscq.h
- src/core/lib/gprpp/set.h
- src/core/lib/gprpp/sync.h
- src/core/lib/gprpp/thd.h
- src/core/lib/profiling/timers.h
@ -1052,7 +1052,7 @@ filegroups:
- src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h
src:
- src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c
uses:
deps:
- upb
- name: grpc_http_filters
headers:
@ -1096,13 +1096,14 @@ filegroups:
- src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc
- src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc
- src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc
deps:
- upb
plugin: grpc_lb_policy_grpclb
uses:
- grpc_base
- grpc_client_channel
- grpc_lb_upb
- grpc_resolver_fake
- upb
- name: grpc_lb_policy_grpclb_secure
headers:
- src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h
@ -1116,6 +1117,8 @@ filegroups:
- src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc
- src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc
- src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc
deps:
- upb
plugin: grpc_lb_policy_grpclb
uses:
- grpc_base
@ -1123,7 +1126,6 @@ filegroups:
- grpc_lb_upb
- grpc_resolver_fake
- grpc_secure
- upb
- name: grpc_lb_policy_pick_first
src:
- src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
@ -1171,9 +1173,10 @@ filegroups:
- src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h
src:
- src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c
deps:
- upb
uses:
- google_api_upb
- upb
- name: grpc_max_age_filter
headers:
- src/core/ext/filters/max_age/max_age_filter.h
@ -3317,41 +3320,6 @@ targets:
- mac
- linux
- posix
- name: memory_usage_client
build: test
run: false
language: c
src:
- test/core/memory_usage/client.cc
deps:
- grpc_test_util
- grpc
- gpr
uses_polling: false
- name: memory_usage_server
build: test
run: false
language: c
src:
- test/core/memory_usage/server.cc
deps:
- grpc_test_util
- grpc
- gpr
- name: memory_usage_test
cpu_cost: 1.5
build: test
language: c
src:
- test/core/memory_usage/memory_usage_test.cc
deps:
- grpc_test_util
- grpc
- gpr
platforms:
- mac
- linux
- posix
- name: message_compress_test
build: test
language: c
@ -3946,6 +3914,25 @@ targets:
- grpc++_unsecure
- grpc_unsecure
- gpr
- name: alts_concurrent_connectivity_test
build: test
language: c++
headers:
- test/core/tsi/alts/fake_handshaker/fake_handshaker_server.h
src:
- test/core/tsi/alts/fake_handshaker/handshaker.proto
- test/core/tsi/alts/fake_handshaker/transport_security_common.proto
- test/core/tsi/alts/fake_handshaker/fake_handshaker_server.cc
- test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc
deps:
- grpc++_test_util
- grpc_test_util
- grpc++
- grpc
- gpr
- grpc++_test_config
platforms:
- linux
- name: alts_counter_test
build: test
language: c++
@ -5360,18 +5347,6 @@ targets:
- mac
- linux
- posix
- name: memory_test
gtest: true
build: test
language: c++
src:
- test/core/gprpp/memory_test.cc
deps:
- grpc_test_util
- grpc++
- grpc
- gpr
uses_polling: false
- name: message_allocator_end2end_test
gtest: true
cpu_cost: 0.5
@ -6146,6 +6121,10 @@ configs:
counters:
CPPFLAGS: -O2 -DGPR_LOW_LEVEL_COUNTERS
DEFINES: NDEBUG
counters_with_memory_counter:
CPPFLAGS: -O2 -DGPR_LOW_LEVEL_COUNTERS -DGPR_WRAP_MEMORY_COUNTER
DEFINES: NDEBUG
LDFLAGS: -Wl,--wrap=malloc -Wl,--wrap=calloc -Wl,--wrap=realloc -Wl,--wrap=free
dbg:
CPPFLAGS: -O0
DEFINES: _DEBUG DEBUG
@ -6253,9 +6232,10 @@ php_config_m4:
deps:
- grpc
- gpr
- address_sorting
- boringssl
- upb
- z
- address_sorting
headers:
- src/php/ext/grpc/byte_buffer.h
- src/php/ext/grpc/call.h
@ -6284,15 +6264,17 @@ python_dependencies:
deps:
- grpc
- gpr
- address_sorting
- ares
- boringssl
- upb
- z
- address_sorting
ruby_gem:
deps:
- grpc
- gpr
- address_sorting
- ares
- boringssl
- upb
- z
- address_sorting

@ -13,5 +13,5 @@
# limitations under the License.
module GrpcBuildConfig
CORE_WINDOWS_DLL = '/tmp/libs/opt/grpc-8.dll'
CORE_WINDOWS_DLL = '/tmp/libs/opt/grpc-9.dll'
end

@ -12,27 +12,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if("${gRPC_BENCHMARK_PROVIDER}" STREQUAL "module")
if(gRPC_BENCHMARK_PROVIDER STREQUAL "module")
set(BENCHMARK_ENABLE_GTEST_TESTS OFF CACHE BOOL "Turn off gTest in gBenchmark")
if(NOT BENCHMARK_ROOT_DIR)
set(BENCHMARK_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/benchmark)
endif()
if(EXISTS "${BENCHMARK_ROOT_DIR}/CMakeLists.txt")
add_subdirectory(${BENCHMARK_ROOT_DIR} third_party/benchmark)
if(TARGET benchmark)
set(_gRPC_BENCHMARK_LIBRARIES benchmark)
set(_gRPC_BENCHMARK_INCLUDE_DIR "${BENCHMARK_ROOT_DIR}/include")
endif()
add_subdirectory(${BENCHMARK_ROOT_DIR} third_party/benchmark)
if(TARGET benchmark)
set(_gRPC_BENCHMARK_LIBRARIES benchmark)
endif()
else()
message(WARNING "gRPC_BENCHMARK_PROVIDER is \"module\" but BENCHMARK_ROOT_DIR is wrong")
message(WARNING "gRPC_BENCHMARK_PROVIDER is \"module\" but BENCHMARK_ROOT_DIR is wrong")
endif()
elseif("${gRPC_BENCHMARK_PROVIDER}" STREQUAL "package")
elseif(gRPC_BENCHMARK_PROVIDER STREQUAL "package")
# Use "CONFIG" as there is no built-in cmake module for benchmark.
find_package(benchmark REQUIRED CONFIG)
if(TARGET benchmark::benchmark)
set(_gRPC_BENCHMARK_LIBRARIES benchmark::benchmark)
# extract the include dir from target's properties
get_target_property(_gRPC_BENCHMARK_INCLUDE_DIR benchmark::benchmark INTERFACE_INCLUDE_DIRECTORIES)
endif()
set(_gRPC_FIND_BENCHMARK "if(NOT benchmark_FOUND)\n find_package(benchmark CONFIG)\nendif()")
endif()

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if("${gRPC_CARES_PROVIDER}" STREQUAL "module")
if(gRPC_CARES_PROVIDER STREQUAL "module")
if(NOT CARES_ROOT_DIR)
set(CARES_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/cares/cares)
endif()
@ -26,19 +26,17 @@ if("${gRPC_CARES_PROVIDER}" STREQUAL "module")
if(TARGET c-ares)
set(_gRPC_CARES_LIBRARIES c-ares)
set(_gRPC_CARES_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/cares/cares" "${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares")
endif()
if(gRPC_INSTALL)
message(WARNING "gRPC_INSTALL will be forced to FALSE because gRPC_CARES_PROVIDER is \"module\"")
set(gRPC_INSTALL FALSE)
endif()
elseif("${gRPC_CARES_PROVIDER}" STREQUAL "package")
elseif(gRPC_CARES_PROVIDER STREQUAL "package")
# Use "CONFIG" as there is no built-in cmake module for c-ares.
find_package(c-ares REQUIRED CONFIG)
if(TARGET c-ares::cares)
set(_gRPC_CARES_LIBRARIES c-ares::cares)
set(_gRPC_CARES_INCLUDE_DIR ${c-ares_INCLUDE_DIR})
endif()
set(_gRPC_FIND_CARES "if(NOT c-ares_FOUND)\n find_package(c-ares CONFIG)\nendif()")
endif()

@ -1,8 +1,8 @@
# Depend packages
@_gRPC_FIND_ZLIB@
@_gRPC_FIND_PROTOBUF@
@_gRPC_FIND_SSL@
@_gRPC_FIND_CARES@
# Targets
include(${CMAKE_CURRENT_LIST_DIR}/gRPCTargets.cmake)
# Depend packages
@_gRPC_FIND_ZLIB@
@_gRPC_FIND_PROTOBUF@
@_gRPC_FIND_SSL@
@_gRPC_FIND_CARES@
# Targets
include(${CMAKE_CURRENT_LIST_DIR}/gRPCTargets.cmake)

@ -1,11 +0,0 @@
set(PACKAGE_VERSION "@PACKAGE_VERSION@")
# Check whether the requested PACKAGE_FIND_VERSION is compatible
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()

@ -12,23 +12,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if("${gRPC_GFLAGS_PROVIDER}" STREQUAL "module")
if(gRPC_GFLAGS_PROVIDER STREQUAL "module")
if(NOT GFLAGS_ROOT_DIR)
set(GFLAGS_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gflags)
endif()
if(EXISTS "${GFLAGS_ROOT_DIR}/CMakeLists.txt")
add_subdirectory(${GFLAGS_ROOT_DIR} third_party/gflags)
set(_gRPC_GFLAGS_LIBRARIES gflags::gflags)
set(_gRPC_GFLAGS_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include")
else()
message(WARNING "gRPC_GFLAGS_PROVIDER is \"module\" but GFLAGS_ROOT_DIR is wrong")
endif()
elseif("${gRPC_GFLAGS_PROVIDER}" STREQUAL "package")
elseif(gRPC_GFLAGS_PROVIDER STREQUAL "package")
# Use "CONFIG" as there is no built-in cmake module for gflags.
find_package(gflags REQUIRED CONFIG)
if(TARGET gflags::gflags)
set(_gRPC_GFLAGS_LIBRARIES gflags::gflags)
set(_gRPC_GFLAGS_INCLUDE_DIR ${GFLAGS_INCLUDE_DIR})
endif()
set(_gRPC_FIND_GFLAGS "if(NOT gflags_FOUND)\n find_package(gflags CONFIG)\nendif()")
endif()

@ -22,9 +22,9 @@ if(gRPC_MSVC_STATIC_RUNTIME)
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif(${flag_var} MATCHES "/MD")
endforeach(flag_var)
if(flag_var MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif()
endforeach()
endif()

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "module")
if(gRPC_PROTOBUF_PROVIDER STREQUAL "module")
# Building the protobuf tests require gmock what is not part of a standard protobuf checkout.
# Disable them unless they are explicitly requested from the cmake command line (when we assume
# gmock is downloaded to the right location inside protobuf).
@ -41,17 +41,16 @@ if("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "module")
set(_gRPC_PROTOBUF_PROTOC protoc)
set(_gRPC_PROTOBUF_PROTOC_EXECUTABLE $<TARGET_FILE:protoc>)
endif()
set(_gRPC_PROTOBUF_INCLUDE_DIR "${PROTOBUF_ROOT_DIR}")
# For well-known .proto files distributed with protobuf
set(_gRPC_PROTOBUF_WELLKNOWN_INCLUDE_DIR "${PROTOBUF_ROOT_DIR}/src")
else()
message(WARNING "gRPC_PROTOBUF_PROVIDER is \"module\" but PROTOBUF_ROOT_DIR is wrong")
message(WARNING "gRPC_PROTOBUF_PROVIDER is \"module\" but PROTOBUF_ROOT_DIR is wrong")
endif()
if(gRPC_INSTALL)
message(WARNING "gRPC_INSTALL will be forced to FALSE because gRPC_PROTOBUF_PROVIDER is \"module\"")
set(gRPC_INSTALL FALSE)
endif()
elseif("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "package")
elseif(gRPC_PROTOBUF_PROVIDER STREQUAL "package")
find_package(Protobuf REQUIRED ${gRPC_PROTOBUF_PACKAGE_TYPE})
# {Protobuf,PROTOBUF}_FOUND is defined based on find_package type ("MODULE" vs "CONFIG").
@ -79,7 +78,6 @@ elseif("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "package")
set(_gRPC_PROTOBUF_PROTOC ${PROTOBUF_PROTOC_EXECUTABLE})
set(_gRPC_PROTOBUF_PROTOC_EXECUTABLE ${PROTOBUF_PROTOC_EXECUTABLE})
endif()
set(_gRPC_PROTOBUF_INCLUDE_DIR ${PROTOBUF_INCLUDE_DIRS})
set(_gRPC_FIND_PROTOBUF "if(NOT Protobuf_FOUND AND NOT PROTOBUF_FOUND)\n find_package(Protobuf ${gRPC_PROTOBUF_PACKAGE_TYPE})\nendif()")
endif()
endif()

@ -12,7 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if("${gRPC_SSL_PROVIDER}" STREQUAL "module")
# The CMakeLists.txt for BoringSSL doesn't propagate include directories
# transitively so `_gRPC_SSL_INCLUDE_DIR` should be set for gRPC
# to find header files.
if(gRPC_SSL_PROVIDER STREQUAL "module")
if(NOT BORINGSSL_ROOT_DIR)
set(BORINGSSL_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/boringssl)
endif()
@ -31,13 +35,13 @@ if("${gRPC_SSL_PROVIDER}" STREQUAL "module")
set(_gRPC_SSL_INCLUDE_DIR ${BORINGSSL_ROOT_DIR}/include)
endif()
else()
message(WARNING "gRPC_SSL_PROVIDER is \"module\" but BORINGSSL_ROOT_DIR is wrong")
message(WARNING "gRPC_SSL_PROVIDER is \"module\" but BORINGSSL_ROOT_DIR is wrong")
endif()
if(gRPC_INSTALL)
message(WARNING "gRPC_INSTALL will be forced to FALSE because gRPC_SSL_PROVIDER is \"module\"")
set(gRPC_INSTALL FALSE)
endif()
elseif("${gRPC_SSL_PROVIDER}" STREQUAL "package")
elseif(gRPC_SSL_PROVIDER STREQUAL "package")
# OpenSSL installation directory can be configured by setting OPENSSL_ROOT_DIR
# We expect to locate OpenSSL using the built-in cmake module as the openssl
# project itself does not provide installation support in its CMakeLists.txt

@ -16,3 +16,5 @@ set(UPB_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/upb)
set(_gRPC_UPB_INCLUDE_DIR "${UPB_ROOT_DIR}")
set(_gRPC_UPB_GRPC_GENERATED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upb-generated")
set(_gRPC_UPB_LIBRARIES upb)

@ -12,7 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if("${gRPC_ZLIB_PROVIDER}" STREQUAL "module")
# The CMakeLists.txt for zlib doesn't propagate include directories
# transitively so `_gRPC_ZLIB_INCLUDE_DIR` should be set for gRPC
# to find header files.
if(gRPC_ZLIB_PROVIDER STREQUAL "module")
if(NOT ZLIB_ROOT_DIR)
set(ZLIB_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/zlib)
endif()
@ -26,13 +30,13 @@ if("${gRPC_ZLIB_PROVIDER}" STREQUAL "module")
set(_gRPC_ZLIB_INCLUDE_DIR "${ZLIB_ROOT_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib")
endif()
else()
message(WARNING "gRPC_ZLIB_PROVIDER is \"module\" but ZLIB_ROOT_DIR is wrong")
message(WARNING "gRPC_ZLIB_PROVIDER is \"module\" but ZLIB_ROOT_DIR is wrong")
endif()
if(gRPC_INSTALL)
message(WARNING "gRPC_INSTALL will be forced to FALSE because gRPC_ZLIB_PROVIDER is \"module\"")
set(gRPC_INSTALL FALSE)
endif()
elseif("${gRPC_ZLIB_PROVIDER}" STREQUAL "package")
elseif(gRPC_ZLIB_PROVIDER STREQUAL "package")
# zlib installation directory can be configured by setting ZLIB_ROOT
# We allow locating zlib using both "CONFIG" and "MODULE" as the expectation
# is that many Linux systems will have zlib installed via a distribution

@ -343,12 +343,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c \
src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c \
src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c \
third_party/upb/upb/decode.c \
third_party/upb/upb/encode.c \
third_party/upb/upb/msg.c \
third_party/upb/upb/port.c \
third_party/upb/upb/table.c \
third_party/upb/upb/upb.c \
src/core/tsi/transport_security.cc \
src/core/ext/transport/chttp2/client/insecure/channel_create.cc \
src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \
@ -732,6 +726,12 @@ if test "$PHP_GRPC" != "no"; then
third_party/boringssl/ssl/tls_method.cc \
third_party/boringssl/ssl/tls_record.cc \
third_party/boringssl/third_party/fiat/curve25519.c \
third_party/upb/upb/decode.c \
third_party/upb/upb/encode.c \
third_party/upb/upb/msg.c \
third_party/upb/upb/port.c \
third_party/upb/upb/table.c \
third_party/upb/upb/upb.c \
, $ext_shared, , -fvisibility=hidden \
-DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN \
-D_HAS_EXCEPTIONS=0 -DNOMINMAX -DGRPC_ARES=0 \

@ -313,12 +313,6 @@ if (PHP_GRPC != "no") {
"src\\core\\ext\\upb-generated\\src\\proto\\grpc\\gcp\\altscontext.upb.c " +
"src\\core\\ext\\upb-generated\\src\\proto\\grpc\\gcp\\handshaker.upb.c " +
"src\\core\\ext\\upb-generated\\src\\proto\\grpc\\gcp\\transport_security_common.upb.c " +
"third_party\\upb\\upb\\decode.c " +
"third_party\\upb\\upb\\encode.c " +
"third_party\\upb\\upb\\msg.c " +
"third_party\\upb\\upb\\port.c " +
"third_party\\upb\\upb\\table.c " +
"third_party\\upb\\upb\\upb.c " +
"src\\core\\tsi\\transport_security.cc " +
"src\\core\\ext\\transport\\chttp2\\client\\insecure\\channel_create.cc " +
"src\\core\\ext\\transport\\chttp2\\client\\insecure\\channel_create_posix.cc " +
@ -702,6 +696,12 @@ if (PHP_GRPC != "no") {
"third_party\\boringssl\\ssl\\tls_method.cc " +
"third_party\\boringssl\\ssl\\tls_record.cc " +
"third_party\\boringssl\\third_party\\fiat\\curve25519.c " +
"third_party\\upb\\upb\\decode.c " +
"third_party\\upb\\upb\\encode.c " +
"third_party\\upb\\upb\\msg.c " +
"third_party\\upb\\upb\\port.c " +
"third_party\\upb\\upb\\table.c " +
"third_party\\upb\\upb\\upb.c " +
"third_party\\zlib\\adler32.c " +
"third_party\\zlib\\compress.c " +
"third_party\\zlib\\crc32.c " +

@ -36,7 +36,7 @@ The following are the **Opaque** structures exposed by Polling Engine interface
- **grpc_fd:** Structure representing a file descriptor
- **grpc_pollset:** A set of one or more grpc_fds that are ‘polled’ for readable/writable/error events. One grpc_fd can be in multiple `grpc_pollset`s
- **grpc_pollset_worker:** Structure representing a ‘polling thread’ - more specifically, the thread that calls `grpc_pollset_work()` API
- **grpc_pollset_set:** A group of `grpc_fds`, `grpc_pollsets` and `grpc_pollset_sets` (yes, a `grpc_pollset_set` can contain other `grpc_pollset_sets`)
- **grpc_pollset_set:** A group of `grpc_fd`s, `grpc_pollset`s and `grpc_pollset_set`s (yes, a `grpc_pollset_set` can contain other `grpc_pollset_set`s)
### Polling engine API
@ -58,12 +58,12 @@ The following are the **Opaque** structures exposed by Polling Engine interface
#### grpc_pollset
- **grpc_pollset_add_fd **
- **grpc_pollset_add_fd**
- Signature: `grpc_pollset_add_fd(grpc_pollset* ps, grpc_fd *fd)`
- Add fd to pollset
> **NOTE**: There is no `grpc_pollset_remove_fd`. This is because calling `grpc_fd_orphan()` will effectively remove the fd from all the pollsets it’s a part of
- ** grpc_pollset_work **
- **grpc_pollset_work**
- Signature: `grpc_pollset_work(grpc_pollset* ps, grpc_pollset_worker** worker, grpc_millis deadline)`
> **NOTE**: `grpc_pollset_work()` requires the pollset mutex to be locked before calling it. Shortly after calling `grpc_pollset_work()`, the function populates the `*worker` pointer (among other things) and releases the mutex. Once `grpc_pollset_work()` returns, the `*worker` pointer is **invalid** and should not be used anymore. See the code in `completion_queue.cc` to see how this is used.
- Poll the fds in the pollset for events AND return when ANY of the following is true:
@ -72,15 +72,15 @@ The following are the **Opaque** structures exposed by Polling Engine interface
- worker is “kicked” (see `grpc_pollset_kick` for more details)
- **grpc_pollset_kick**
- Signature: `grpc_pollset_kick(grpc_pollset* ps, grpc_pollset_worker* worker)`
- “Kick the worker” i.e Force the worker to return from grpc_pollset_work()
- If `worker == nullptr`, kick ANY worker active on that pollset
- Signature: `grpc_pollset_kick(grpc_pollset* ps, grpc_pollset_worker* worker)`
- “Kick the worker” i.e Force the worker to return from grpc_pollset_work()
- If `worker == nullptr`, kick ANY worker active on that pollset
#### grpc_pollset_set
- **grpc\_pollset\_set\_[add|del]\_fd**
- Signature: `grpc_pollset_set_[add|del]_fd(grpc_pollset_set* pss, grpc_fd *fd)`
Add/Remove fd to the `grpc_pollset_set`
- Add/Remove fd to the `grpc_pollset_set`
- **grpc\_pollset\_set_[add|del]\_pollset**
- Signature: `grpc_pollset_set_[add|del]_pollset(grpc_pollset_set* pss, grpc_pollset* ps)`

@ -18,7 +18,7 @@ package(default_visibility = ["//visibility:public"])
load("//bazel:grpc_build_system.bzl", "grpc_proto_library")
load("//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("//bazel:python_rules.bzl", "py_proto_library", "py_grpc_library")
load("//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
grpc_proto_library(

@ -23,29 +23,29 @@ load("@build_bazel_rules_apple//apple:macos.bzl", "macos_application")
objc_grpc_library(
name = "HelloWorld_grpc_proto",
srcs = ["//examples:protos/helloworld.proto"],
deps = ["//examples:helloworld_proto"],
tags = ["manual"],
deps = ["//examples:helloworld_proto"],
)
# This one works with import "external/com_github_grpc_grpc/examples/protos/Helloworld.pbrpc.h"
objc_grpc_library(
name = "HelloWorld_grpc_proto_external",
srcs = ["//external/com_github_grpc_grpc/examples:protos/helloworld.proto"],
deps = ["@com_github_grpc_grpc//examples:helloworld_proto"],
tags = ["manual"],
deps = ["@com_github_grpc_grpc//examples:helloworld_proto"],
)
objc_library(
name = "HelloWorld-lib",
srcs = glob(["helloworld/**/*.m",]),
srcs = glob(["helloworld/**/*.m"]),
hdrs = glob(["helloworld/**/*.h"]),
data = glob([
"helloworld/HelloWorld/Base.lproj/**",
"helloworld/HelloWorld/Images.xcassets/**",
]),
includes = ["helloworld/HelloWorld"],
deps = [":HelloWorld_grpc_proto"],
tags = ["manual"],
deps = [":HelloWorld_grpc_proto"],
)
ios_application(
@ -55,40 +55,40 @@ ios_application(
"iphone",
"ipad",
],
minimum_os_version = "8.0",
infoplists = ["helloworld/HelloWorld/Info.plist"],
deps = [":HelloWorld-lib"],
minimum_os_version = "8.0",
tags = ["manual"],
deps = [":HelloWorld-lib"],
)
objc_library(
name = "HelloWorldMacos-lib",
srcs = glob(["helloworld_macos/**/*.m",]),
srcs = glob(["helloworld_macos/**/*.m"]),
hdrs = glob(["helloworld_macos/**/*.h"]),
data = glob([
"helloworld_macos/HelloWorld/Base.lproj/**",
"helloworld_macos/HelloWorld/Images.xcassets/**",
]),
includes = ["helloworld_macos/HelloWorld"],
deps = [":HelloWorld_grpc_proto"],
tags = ["manual"],
deps = [":HelloWorld_grpc_proto"],
)
macos_application(
name = "HelloWorldMacos",
bundle_id = "io.grpc.HelloWorld",
minimum_os_version = "10.13",
entitlements = "helloworld_macos/HelloWorld/Helloworld.entitlements",
infoplists = ["helloworld_macos/HelloWorld/Info.plist"],
deps = [":HelloWorldMacos-lib"],
minimum_os_version = "10.13",
tags = ["manual"],
deps = [":HelloWorldMacos-lib"],
)
objc_grpc_library(
name = "RouteGuide",
srcs = ["//examples:protos/route_guide.proto"],
deps = ["//examples:route_guide_proto"],
tags = ["manual"],
deps = ["//examples:route_guide_proto"],
)
objc_library(
@ -101,8 +101,8 @@ objc_library(
"route_guide/route_guide_db.json",
]),
includes = ["route_guide/Misc"],
deps = [":RouteGuide"],
tags = ["manual"],
deps = [":RouteGuide"],
)
ios_application(
@ -112,8 +112,8 @@ ios_application(
"iphone",
"ipad",
],
minimum_os_version = "8.0",
infoplists = ["route_guide/Misc/Info.plist"],
deps = [":RouteGuideClient-lib"],
minimum_os_version = "8.0",
tags = ["manual"],
deps = [":RouteGuideClient-lib"],
)

@ -21,6 +21,7 @@
#import <GRPCClient/GRPCCall+ChannelArg.h>
#import <GRPCClient/GRPCCall+Tests.h>
#import <GRPCClient/GRPCTransport.h>
#if COCOAPODS
#import <HelloWorld/Helloworld.pbrpc.h>
#else
@ -55,14 +56,12 @@ int main(int argc, char * argv[]) {
GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init];
// this example does not use TLS (secure channel); use insecure channel instead
options.transportType = GRPCTransportTypeInsecure;
options.transport = GRPCDefaultTransportImplList.core_insecure;
options.userAgentPrefix = @"HelloWorld/1.0";
GRPCUnaryProtoCall *call = [client sayHelloWithMessage:request
responseHandler:[[HLWResponseHandler alloc] init]
callOptions:options];
[call start];
[[client sayHelloWithMessage:request
responseHandler:[[HLWResponseHandler alloc] init]
callOptions:options] start];
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}

@ -20,6 +20,7 @@
#import <GRPCClient/GRPCCall+ChannelArg.h>
#import <GRPCClient/GRPCCall+Tests.h>
#import <GRPCClient/GRPCTransport.h>
#if COCOAPODS
#import <HelloWorld/Helloworld.pbrpc.h>
#else
@ -54,7 +55,7 @@ int main(int argc, const char * argv[]) {
GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init];
// this example does not use TLS (secure channel); use insecure channel instead
options.transportType = GRPCTransportTypeInsecure;
options.transport = GRPCDefaultTransportImplList.core_insecure;
options.userAgentPrefix = @"HelloWorld/1.0";
GRPCUnaryProtoCall *call = [client sayHelloWithMessage:request

@ -23,6 +23,8 @@
#import "examples/protos/RouteGuide.pbrpc.h"
#endif
#import <GRPCClient/GRPCTransport.h>
static NSString * const kHostAddress = @"localhost:50051";
/** Category to override RTGPoint's description. */
@ -123,7 +125,7 @@ static NSString * const kHostAddress = @"localhost:50051";
[super viewDidLoad];
GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init];
options.transportType = GRPCTransportTypeInsecure;
options.transport = GRPCDefaultTransportImplList.core_insecure;
_service = [[RTGRouteGuide alloc] initWithHost:kHostAddress callOptions:options];
}
@ -193,7 +195,7 @@ static NSString * const kHostAddress = @"localhost:50051";
[super viewDidLoad];
GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init];
options.transportType = GRPCTransportTypeInsecure;
options.transport = GRPCDefaultTransportImplList.core_insecure;
_service = [[RTGRouteGuide alloc] initWithHost:kHostAddress callOptions:options];
}
@ -286,7 +288,7 @@ static NSString * const kHostAddress = @"localhost:50051";
[super viewDidLoad];
GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init];
options.transportType = GRPCTransportTypeInsecure;
options.transport = GRPCDefaultTransportImplList.core_insecure;
_service = [[RTGRouteGuide alloc] initWithHost:kHostAddress callOptions:options];
}
@ -360,7 +362,7 @@ static NSString * const kHostAddress = @"localhost:50051";
[super viewDidLoad];
GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init];
options.transportType = GRPCTransportTypeInsecure;
options.transport = GRPCDefaultTransportImplList.core_insecure;
_service = [[RTGRouteGuide alloc] initWithHost:kHostAddress callOptions:options];
}

@ -16,8 +16,8 @@ filegroup(
name = "_credentials_files",
testonly = 1,
srcs = [
"credentials/localhost.key",
"credentials/localhost.crt",
"credentials/localhost.key",
"credentials/root.crt",
],
)
@ -33,37 +33,37 @@ py_binary(
name = "customized_auth_client",
testonly = 1,
srcs = ["customized_auth_client.py"],
python_version = "PY3",
deps = [
":_credentials",
"//src/python/grpcio/grpc:grpcio",
"//examples:helloworld_py_pb2",
"//examples:helloworld_py_pb2_grpc",
"//src/python/grpcio/grpc:grpcio",
],
python_version = "PY3",
)
py_binary(
name = "customized_auth_server",
testonly = 1,
srcs = ["customized_auth_server.py"],
python_version = "PY3",
deps = [
":_credentials",
"//src/python/grpcio/grpc:grpcio",
"//examples:helloworld_py_pb2",
"//examples:helloworld_py_pb2_grpc",
"//src/python/grpcio/grpc:grpcio",
],
python_version = "PY3",
)
py_test(
name = "_auth_example_test",
srcs = ["test/_auth_example_test.py"],
python_version = "PY3",
deps = [
"//src/python/grpcio/grpc:grpcio",
"//examples:helloworld_py_pb2",
":_credentials",
":customized_auth_client",
":customized_auth_server",
":_credentials",
"//examples:helloworld_py_pb2",
"//src/python/grpcio/grpc:grpcio",
],
python_version = "PY3",
)

@ -15,7 +15,7 @@
# limitations under the License.
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
load("//bazel:python_rules.bzl", "py_proto_library", "py_grpc_library")
load("//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")
package(default_testonly = 1)
@ -38,14 +38,14 @@ py_grpc_library(
py_binary(
name = "client",
srcs = ["client.py"],
python_version = "PY3",
srcs_version = "PY2AND3",
deps = [
"//src/python/grpcio/grpc:grpcio",
":hash_name_py_pb2",
":hash_name_py_pb2_grpc",
"//external:six"
"//external:six",
"//src/python/grpcio/grpc:grpcio",
],
srcs_version = "PY2AND3",
python_version = "PY3",
)
py_library(
@ -60,6 +60,8 @@ py_library(
py_binary(
name = "server",
srcs = ["server.py"],
python_version = "PY3",
srcs_version = "PY2AND3",
deps = [
"//src/python/grpcio/grpc:grpcio",
":hash_name_py_pb2",
@ -68,17 +70,15 @@ py_binary(
"//conditions:default": ["@futures//:futures"],
"//:python3": [],
}),
srcs_version = "PY2AND3",
python_version = "PY3",
)
py_test(
name = "test/_cancellation_example_test",
size = "small",
srcs = ["test/_cancellation_example_test.py"],
data = [
":client",
":server"
":server",
],
size = "small",
python_version = "PY3",
)

@ -15,35 +15,35 @@
py_binary(
name = "server",
srcs = ["server.py"],
python_version = "PY3",
srcs_version = "PY2AND3",
deps = [
"//src/python/grpcio/grpc:grpcio",
"//examples:helloworld_py_pb2",
"//examples:helloworld_py_pb2_grpc",
"//src/python/grpcio/grpc:grpcio",
],
srcs_version = "PY2AND3",
python_version = "PY3",
)
py_binary(
name = "client",
srcs = ["client.py"],
python_version = "PY3",
srcs_version = "PY2AND3",
deps = [
"//src/python/grpcio/grpc:grpcio",
"//examples:helloworld_py_pb2",
"//examples:helloworld_py_pb2_grpc",
"//src/python/grpcio/grpc:grpcio",
],
srcs_version = "PY2AND3",
python_version = "PY3",
)
py_test(
name = "test/compression_example_test",
size = "small",
srcs = ["test/compression_example_test.py"],
srcs_version = "PY2AND3",
data = [
":client",
":server",
":client",
":server",
],
size = "small",
python_version = "PY3",
srcs_version = "PY2AND3",
)

@ -19,10 +19,10 @@ py_binary(
testonly = 1,
srcs = ["debug_server.py"],
deps = [
"//src/python/grpcio/grpc:grpcio",
"//src/python/grpcio_channelz/grpc_channelz/v1:grpc_channelz",
"//examples:helloworld_py_pb2",
"//examples:helloworld_py_pb2_grpc",
"//src/python/grpcio/grpc:grpcio",
"//src/python/grpcio_channelz/grpc_channelz/v1:grpc_channelz",
],
)
@ -30,36 +30,36 @@ py_binary(
name = "send_message",
testonly = 1,
srcs = ["send_message.py"],
python_version = "PY3",
deps = [
"//src/python/grpcio/grpc:grpcio",
"//examples:helloworld_py_pb2",
"//examples:helloworld_py_pb2_grpc",
"//src/python/grpcio/grpc:grpcio",
],
python_version = "PY3",
)
py_binary(
name = "get_stats",
testonly = 1,
srcs = ["get_stats.py"],
python_version = "PY3",
deps = [
"//src/python/grpcio/grpc:grpcio",
"//src/python/grpcio_channelz/grpc_channelz/v1:grpc_channelz",
],
python_version = "PY3",
)
py_test(
name = "_debug_example_test",
srcs = ["test/_debug_example_test.py"],
python_version = "PY3",
deps = [
"//src/python/grpcio/grpc:grpcio",
"//src/python/grpcio_channelz/grpc_channelz/v1:grpc_channelz",
"//examples:helloworld_py_pb2",
"//examples:helloworld_py_pb2_grpc",
":debug_server",
":send_message",
":get_stats",
":send_message",
"//examples:helloworld_py_pb2",
"//examples:helloworld_py_pb2_grpc",
"//src/python/grpcio/grpc:grpcio",
"//src/python/grpcio_channelz/grpc_channelz/v1:grpc_channelz",
],
python_version = "PY3",
)

@ -19,11 +19,11 @@ py_library(
testonly = 1,
srcs = ["client.py"],
deps = [
"//src/python/grpcio/grpc:grpcio",
"//src/python/grpcio_status/grpc_status:grpc_status",
"//examples:helloworld_py_pb2",
"//examples:helloworld_py_pb2_grpc",
requirement('googleapis-common-protos'),
"//src/python/grpcio/grpc:grpcio",
"//src/python/grpcio_status/grpc_status",
requirement("googleapis-common-protos"),
],
)
@ -44,16 +44,16 @@ py_library(
py_test(
name = "test/_error_handling_example_test",
srcs = ["test/_error_handling_example_test.py"],
deps = [
":client",
":server",
"//src/python/grpcio_tests/tests:bazel_namespace_package_hack",
],
size = "small",
srcs = ["test/_error_handling_example_test.py"],
imports = [
"../../../src/python/grpcio_status",
"../../../src/python/grpcio_tests",
],
python_version = "PY3",
deps = [
":client",
":server",
"//src/python/grpcio_tests/tests:bazel_namespace_package_hack",
],
)

@ -14,11 +14,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:python_rules.bzl", "py_proto_library", "py_grpc_library")
load("//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")
proto_library(
name = "prime_proto",
srcs = ["prime.proto"]
srcs = ["prime.proto"],
)
py_proto_library(
@ -36,19 +36,21 @@ py_binary(
name = "client",
testonly = 1,
srcs = ["client.py"],
python_version = "PY3",
srcs_version = "PY3",
deps = [
"//src/python/grpcio/grpc:grpcio",
":prime_proto_pb2",
":prime_proto_pb2_grpc",
"//src/python/grpcio/grpc:grpcio",
],
srcs_version = "PY3",
python_version = "PY3",
)
py_binary(
name = "server",
testonly = 1,
srcs = ["server.py"],
python_version = "PY3",
srcs_version = "PY3",
deps = [
"//src/python/grpcio/grpc:grpcio",
":prime_proto_pb2",
@ -57,17 +59,15 @@ py_binary(
"//conditions:default": ["@futures//:futures"],
"//:python3": [],
}),
srcs_version = "PY3",
python_version = "PY3",
)
py_test(
name = "test/_multiprocessing_example_test",
size = "small",
srcs = ["test/_multiprocessing_example_test.py"],
data = [
":client",
":server"
":server",
],
size = "small",
python_version = "PY3",
)

@ -19,16 +19,16 @@ py_library(
testonly = 1,
srcs = ["wait_for_ready_example.py"],
deps = [
"//src/python/grpcio/grpc:grpcio",
"//examples:helloworld_py_pb2",
"//examples:helloworld_py_pb2_grpc",
"//src/python/grpcio/grpc:grpcio",
],
)
py_test(
name = "test/_wait_for_ready_example_test",
srcs = ["test/_wait_for_ready_example_test.py"],
deps = [":wait_for_ready_example",],
size = "small",
srcs = ["test/_wait_for_ready_example_test.py"],
python_version = "PY3",
deps = [":wait_for_ready_example"],
)

@ -337,7 +337,6 @@ Pod::Spec.new do |s|
'src/core/lib/gprpp/orphanable.h',
'src/core/lib/gprpp/ref_counted.h',
'src/core/lib/gprpp/ref_counted_ptr.h',
'src/core/lib/gprpp/set.h',
'src/core/lib/gprpp/string_view.h',
'src/core/lib/gprpp/sync.h',
'src/core/lib/gprpp/thd.h',
@ -465,15 +464,7 @@ Pod::Spec.new do |s|
'src/cpp/server/health/default_health_check_service.h',
'src/cpp/server/secure_server_credentials.h',
'src/cpp/server/thread_pool_interface.h',
'src/cpp/thread_manager/thread_manager.h',
'third_party/upb/upb/decode.h',
'third_party/upb/upb/encode.h',
'third_party/upb/upb/generated_util.h',
'third_party/upb/upb/msg.h',
'third_party/upb/upb/port_def.inc',
'third_party/upb/upb/port_undef.inc',
'third_party/upb/upb/table.int.h',
'third_party/upb/upb/upb.h'
'src/cpp/thread_manager/thread_manager.h'
end
s.subspec 'Protobuf' do |ss|

@ -563,7 +563,6 @@ Pod::Spec.new do |s|
'src/core/lib/gprpp/orphanable.h',
'src/core/lib/gprpp/ref_counted.h',
'src/core/lib/gprpp/ref_counted_ptr.h',
'src/core/lib/gprpp/set.h',
'src/core/lib/gprpp/string_view.h',
'src/core/lib/gprpp/sync.h',
'src/core/lib/gprpp/thd.h',
@ -1146,7 +1145,6 @@ Pod::Spec.new do |s|
'src/core/lib/gprpp/orphanable.h',
'src/core/lib/gprpp/ref_counted.h',
'src/core/lib/gprpp/ref_counted_ptr.h',
'src/core/lib/gprpp/set.h',
'src/core/lib/gprpp/string_view.h',
'src/core/lib/gprpp/sync.h',
'src/core/lib/gprpp/thd.h',

@ -21,93 +21,93 @@ This file declares two macros:
"""
def _lower_underscore_to_upper_camel(str):
humps = []
for hump in str.split('_'):
humps += [hump[0].upper() + hump[1:]]
return "".join(humps)
humps = []
for hump in str.split("_"):
humps += [hump[0].upper() + hump[1:]]
return "".join(humps)
def _file_to_upper_camel(src):
elements = src.rpartition('/')
upper_camel = _lower_underscore_to_upper_camel(elements[-1])
return "".join(elements[:-1] + [upper_camel])
elements = src.rpartition("/")
upper_camel = _lower_underscore_to_upper_camel(elements[-1])
return "".join(elements[:-1] + [upper_camel])
def _file_with_extension(src, ext):
elements = src.rpartition('/')
basename = elements[-1].partition('.')[0]
return "".join(elements[:-1] + [basename, ext])
elements = src.rpartition("/")
basename = elements[-1].partition(".")[0]
return "".join(elements[:-1] + [basename, ext])
def _protoc_invocation(srcs, flags):
"""Returns a command line to invoke protoc from a genrule, on the given
sources, using the given flags.
"""
protoc_command = "$(location //external:protoc) -I . "
srcs_params = ""
for src in srcs:
srcs_params += " $(location %s)" % (src)
return protoc_command + flags + srcs_params
"""Returns a command line to invoke protoc from a genrule, on the given
sources, using the given flags.
"""
protoc_command = "$(location //external:protoc) -I . "
srcs_params = ""
for src in srcs:
srcs_params += " $(location %s)" % (src)
return protoc_command + flags + srcs_params
def objc_proto_library(name, srcs, visibility=None):
"""Declares an objc_library for the code generated by protoc from the given
proto sources. This generated code doesn't include proto services.
"""
h_files = []
m_files = []
for src in srcs:
src = _file_to_upper_camel(src)
h_files += [_file_with_extension(src, ".pbobjc.h")]
m_files += [_file_with_extension(src, ".pbobjc.m")]
def objc_proto_library(name, srcs, visibility = None):
"""Declares an objc_library for the code generated by protoc from the given
proto sources. This generated code doesn't include proto services.
"""
h_files = []
m_files = []
for src in srcs:
src = _file_to_upper_camel(src)
h_files += [_file_with_extension(src, ".pbobjc.h")]
m_files += [_file_with_extension(src, ".pbobjc.m")]
protoc_flags = "--objc_out=$(GENDIR)"
protoc_flags = "--objc_out=$(GENDIR)"
native.genrule(
name = name + "_codegen",
srcs = srcs + ["//external:protoc"],
outs = h_files + m_files,
cmd = _protoc_invocation(srcs, protoc_flags),
)
native.objc_library(
name = name,
hdrs = h_files,
includes = ["."],
non_arc_srcs = m_files,
deps = ["//external:protobuf_objc"],
visibility = visibility,
)
native.genrule(
name = name + "_codegen",
srcs = srcs + ["//external:protoc"],
outs = h_files + m_files,
cmd = _protoc_invocation(srcs, protoc_flags),
)
native.objc_library(
name = name,
hdrs = h_files,
includes = ["."],
non_arc_srcs = m_files,
deps = ["//external:protobuf_objc"],
visibility = visibility,
)
def objc_grpc_library(name, services, other_messages, visibility=None):
"""Declares an objc_library for the code generated by gRPC and protoc from the
given proto sources (services and other_messages). The generated code doesn't
include proto services of the files passed as other_messages.
"""
objc_proto_library(name + "_messages", services + other_messages)
def objc_grpc_library(name, services, other_messages, visibility = None):
"""Declares an objc_library for the code generated by gRPC and protoc from the
given proto sources (services and other_messages). The generated code doesn't
include proto services of the files passed as other_messages.
"""
objc_proto_library(name + "_messages", services + other_messages)
h_files = []
m_files = []
for src in services:
src = _file_to_upper_camel(src)
h_files += [_file_with_extension(src, ".pbrpc.h")]
m_files += [_file_with_extension(src, ".pbrpc.m")]
h_files = []
m_files = []
for src in services:
src = _file_to_upper_camel(src)
h_files += [_file_with_extension(src, ".pbrpc.h")]
m_files += [_file_with_extension(src, ".pbrpc.m")]
protoc_flags = ("--grpc_out=$(GENDIR) --plugin=" +
"protoc-gen-grpc=$(location //external:grpc_protoc_plugin_objc)")
protoc_flags = ("--grpc_out=$(GENDIR) --plugin=" +
"protoc-gen-grpc=$(location //external:grpc_protoc_plugin_objc)")
native.genrule(
name = name + "_codegen",
srcs = services + [
"//external:grpc_protoc_plugin_objc",
"//external:protoc",
],
outs = h_files + m_files,
cmd = _protoc_invocation(services, protoc_flags),
)
native.objc_library(
name = name,
hdrs = h_files,
includes = ["."],
srcs = m_files,
deps = [
":" + name + "_messages",
"//external:proto_objc_rpc",
],
visibility = visibility,
)
native.genrule(
name = name + "_codegen",
srcs = services + [
"//external:grpc_protoc_plugin_objc",
"//external:protoc",
],
outs = h_files + m_files,
cmd = _protoc_invocation(services, protoc_flags),
)
native.objc_library(
name = name,
hdrs = h_files,
includes = ["."],
srcs = m_files,
deps = [
":" + name + "_messages",
"//external:proto_objc_rpc",
],
visibility = visibility,
)

@ -217,8 +217,6 @@ EXPORTS
gpr_realloc
gpr_malloc_aligned
gpr_free_aligned
gpr_set_allocation_functions
gpr_get_allocation_functions
gpr_cpu_num_cores
gpr_cpu_current_cpu
gpr_format_message

@ -108,7 +108,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/gprpp/map.h )
s.files += %w( src/core/lib/gprpp/memory.h )
s.files += %w( src/core/lib/gprpp/mpscq.h )
s.files += %w( src/core/lib/gprpp/set.h )
s.files += %w( src/core/lib/gprpp/sync.h )
s.files += %w( src/core/lib/gprpp/thd.h )
s.files += %w( src/core/lib/profiling/timers.h )
@ -270,14 +269,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h )
s.files += %w( src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h )
s.files += %w( src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h )
s.files += %w( third_party/upb/upb/decode.h )
s.files += %w( third_party/upb/upb/encode.h )
s.files += %w( third_party/upb/upb/generated_util.h )
s.files += %w( third_party/upb/upb/msg.h )
s.files += %w( third_party/upb/upb/port_def.inc )
s.files += %w( third_party/upb/upb/port_undef.inc )
s.files += %w( third_party/upb/upb/table.int.h )
s.files += %w( third_party/upb/upb/upb.h )
s.files += %w( src/core/tsi/transport_security.h )
s.files += %w( src/core/tsi/transport_security_interface.h )
s.files += %w( src/core/ext/transport/chttp2/client/authority.h )
@ -775,12 +766,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c )
s.files += %w( src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c )
s.files += %w( src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c )
s.files += %w( third_party/upb/upb/decode.c )
s.files += %w( third_party/upb/upb/encode.c )
s.files += %w( third_party/upb/upb/msg.c )
s.files += %w( third_party/upb/upb/port.c )
s.files += %w( third_party/upb/upb/table.c )
s.files += %w( third_party/upb/upb/upb.c )
s.files += %w( src/core/tsi/transport_security.cc )
s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create.cc )
s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc )
@ -1354,6 +1339,20 @@ Gem::Specification.new do |s|
s.files += %w( third_party/boringssl/ssl/tls_method.cc )
s.files += %w( third_party/boringssl/ssl/tls_record.cc )
s.files += %w( third_party/boringssl/third_party/fiat/curve25519.c )
s.files += %w( third_party/upb/upb/decode.h )
s.files += %w( third_party/upb/upb/encode.h )
s.files += %w( third_party/upb/upb/generated_util.h )
s.files += %w( third_party/upb/upb/msg.h )
s.files += %w( third_party/upb/upb/port_def.inc )
s.files += %w( third_party/upb/upb/port_undef.inc )
s.files += %w( third_party/upb/upb/table.int.h )
s.files += %w( third_party/upb/upb/upb.h )
s.files += %w( third_party/upb/upb/decode.c )
s.files += %w( third_party/upb/upb/encode.c )
s.files += %w( third_party/upb/upb/msg.c )
s.files += %w( third_party/upb/upb/port.c )
s.files += %w( third_party/upb/upb/table.c )
s.files += %w( third_party/upb/upb/upb.c )
s.files += %w( third_party/zlib/crc32.h )
s.files += %w( third_party/zlib/deflate.h )
s.files += %w( third_party/zlib/gzguts.h )

@ -225,6 +225,7 @@
'type': 'static_library',
'dependencies': [
'gpr',
'upb',
],
'sources': [
'src/core/lib/surface/init.cc',
@ -481,12 +482,6 @@
'src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c',
'src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c',
'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c',
'third_party/upb/upb/decode.c',
'third_party/upb/upb/encode.c',
'third_party/upb/upb/msg.c',
'third_party/upb/upb/port.c',
'third_party/upb/upb/table.c',
'third_party/upb/upb/upb.c',
'src/core/tsi/transport_security.cc',
'src/core/ext/transport/chttp2/client/insecure/channel_create.cc',
'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc',
@ -614,6 +609,7 @@
'dependencies': [
'gpr',
'grpc',
'upb',
],
'sources': [
'test/core/end2end/data/client_certs.cc',
@ -833,12 +829,6 @@
'src/core/ext/filters/client_channel/subchannel_pool_interface.cc',
'src/core/ext/filters/deadline/deadline_filter.cc',
'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c',
'third_party/upb/upb/decode.c',
'third_party/upb/upb/encode.c',
'third_party/upb/upb/msg.c',
'third_party/upb/upb/port.c',
'third_party/upb/upb/table.c',
'third_party/upb/upb/upb.c',
'src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c',
'src/core/ext/upb-generated/gogoproto/gogo.upb.c',
'src/core/ext/upb-generated/validate/validate.upb.c',
@ -888,6 +878,7 @@
'dependencies': [
'gpr',
'grpc_unsecure',
'upb',
],
'sources': [
'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc',
@ -1102,12 +1093,6 @@
'src/core/ext/filters/client_channel/subchannel_pool_interface.cc',
'src/core/ext/filters/deadline/deadline_filter.cc',
'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c',
'third_party/upb/upb/decode.c',
'third_party/upb/upb/encode.c',
'third_party/upb/upb/msg.c',
'third_party/upb/upb/port.c',
'third_party/upb/upb/table.c',
'third_party/upb/upb/upb.c',
'src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c',
'src/core/ext/upb-generated/gogoproto/gogo.upb.c',
'src/core/ext/upb-generated/validate/validate.upb.c',
@ -1156,6 +1141,7 @@
'type': 'static_library',
'dependencies': [
'gpr',
'upb',
],
'sources': [
'src/core/lib/surface/init.cc',
@ -1382,12 +1368,6 @@
'src/core/ext/filters/client_channel/subchannel_pool_interface.cc',
'src/core/ext/filters/deadline/deadline_filter.cc',
'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c',
'third_party/upb/upb/decode.c',
'third_party/upb/upb/encode.c',
'third_party/upb/upb/msg.c',
'third_party/upb/upb/port.c',
'third_party/upb/upb/table.c',
'third_party/upb/upb/upb.c',
'src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c',
'src/core/ext/upb-generated/gogoproto/gogo.upb.c',
'src/core/ext/upb-generated/validate/validate.upb.c',
@ -1522,6 +1502,7 @@
'dependencies': [
'grpc',
'gpr',
'upb',
],
'sources': [
'src/cpp/client/insecure_credentials.cc',
@ -1570,12 +1551,6 @@
'src/cpp/util/string_ref.cc',
'src/cpp/util/time_cc.cc',
'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c',
'third_party/upb/upb/decode.c',
'third_party/upb/upb/encode.c',
'third_party/upb/upb/msg.c',
'third_party/upb/upb/port.c',
'third_party/upb/upb/table.c',
'third_party/upb/upb/upb.c',
'src/cpp/codegen/codegen_init.cc',
],
},
@ -1689,6 +1664,7 @@
'dependencies': [
'gpr',
'grpc_unsecure',
'upb',
],
'sources': [
'src/cpp/client/insecure_credentials.cc',
@ -1730,12 +1706,6 @@
'src/cpp/util/string_ref.cc',
'src/cpp/util/time_cc.cc',
'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c',
'third_party/upb/upb/decode.c',
'third_party/upb/upb/encode.c',
'third_party/upb/upb/msg.c',
'third_party/upb/upb/port.c',
'third_party/upb/upb/table.c',
'third_party/upb/upb/upb.c',
'src/cpp/codegen/codegen_init.cc',
],
},
@ -2247,6 +2217,20 @@
'third_party/benchmark/src/timers.cc',
],
},
{
'target_name': 'upb',
'type': 'static_library',
'dependencies': [
],
'sources': [
'third_party/upb/upb/decode.c',
'third_party/upb/upb/encode.c',
'third_party/upb/upb/msg.c',
'third_party/upb/upb/port.c',
'third_party/upb/upb/table.c',
'third_party/upb/upb/upb.c',
],
},
{
'target_name': 'z',
'type': 'static_library',

@ -27,6 +27,13 @@
* - some syscalls to be made directly
*/
/*
* Defines GRPC_USE_ABSL to use Abseil Common Libraries (C++)
*/
#ifndef GRPC_USE_ABSL
#define GRPC_USE_ABSL 0
#endif
/* Get windows.h included everywhere (we need it) */
#if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32)
#ifndef WIN32_LEAN_AND_MEAN

@ -27,13 +27,6 @@
extern "C" {
#endif
typedef struct gpr_allocation_functions {
void* (*malloc_fn)(size_t size);
void* (*zalloc_fn)(size_t size); /** if NULL, uses malloc_fn then memset */
void* (*realloc_fn)(void* ptr, size_t size);
void (*free_fn)(void* ptr);
} gpr_allocation_functions;
/** malloc.
* If size==0, always returns NULL. Otherwise this function never returns NULL.
* The pointer returned is suitably aligned for any kind of variable it could
@ -52,15 +45,6 @@ GPRAPI void* gpr_malloc_aligned(size_t size, size_t alignment);
/** free memory allocated by gpr_malloc_aligned */
GPRAPI void gpr_free_aligned(void* ptr);
/** Request the family of allocation functions in \a functions be used. NOTE
* that this request will be honored in a *best effort* basis and that no
* guarantees are made about the default functions (eg, malloc) being called.
* The functions.free_fn implementation must be a no-op for NULL input. */
GPRAPI void gpr_set_allocation_functions(gpr_allocation_functions functions);
/** Return the family of allocation functions currently in effect. */
GPRAPI gpr_allocation_functions gpr_get_allocation_functions(void);
#ifdef __cplusplus
}
#endif

@ -62,12 +62,12 @@ class MethodHandler {
internal_data(handler_data),
call_requester(std::move(requester)) {}
~HandlerParameter() {}
Call* call;
::grpc_impl::ServerContext* server_context;
void* request;
Status status;
void* internal_data;
std::function<void()> call_requester;
Call* const call;
::grpc_impl::ServerContext* const server_context;
void* const request;
const Status status;
void* const internal_data;
const std::function<void()> call_requester;
};
virtual void RunHandler(const HandlerParameter& param) = 0;

@ -113,7 +113,6 @@
<file baseinstalldir="/" name="src/core/lib/gprpp/map.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/memory.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/mpscq.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/set.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/sync.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/thd.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/profiling/timers.h" role="src" />
@ -275,14 +274,6 @@
<file baseinstalldir="/" name="src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/decode.h" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/encode.h" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/generated_util.h" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/msg.h" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/port_def.inc" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/port_undef.inc" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/table.int.h" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/upb.h" role="src" />
<file baseinstalldir="/" name="src/core/tsi/transport_security.h" role="src" />
<file baseinstalldir="/" name="src/core/tsi/transport_security_interface.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/client/authority.h" role="src" />
@ -780,12 +771,6 @@
<file baseinstalldir="/" name="src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/decode.c" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/encode.c" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/msg.c" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/port.c" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/table.c" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/upb.c" role="src" />
<file baseinstalldir="/" name="src/core/tsi/transport_security.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/client/insecure/channel_create.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc" role="src" />
@ -1359,6 +1344,20 @@
<file baseinstalldir="/" name="third_party/boringssl/ssl/tls_method.cc" role="src" />
<file baseinstalldir="/" name="third_party/boringssl/ssl/tls_record.cc" role="src" />
<file baseinstalldir="/" name="third_party/boringssl/third_party/fiat/curve25519.c" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/decode.h" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/encode.h" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/generated_util.h" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/msg.h" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/port_def.inc" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/port_undef.inc" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/table.int.h" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/upb.h" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/decode.c" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/encode.c" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/msg.c" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/port.c" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/table.c" role="src" />
<file baseinstalldir="/" name="third_party/upb/upb/upb.c" role="src" />
<file baseinstalldir="/" name="third_party/zlib/crc32.h" role="src" />
<file baseinstalldir="/" name="third_party/zlib/deflate.h" role="src" />
<file baseinstalldir="/" name="third_party/zlib/gzguts.h" role="src" />

@ -44,8 +44,8 @@ grpc_cc_library(
"ruby_generator.cc",
],
hdrs = [
"config_protobuf.h",
"config.h",
"config_protobuf.h",
"cpp_generator.h",
"cpp_generator_helpers.h",
"cpp_plugin.h",

@ -26,12 +26,12 @@ namespace grpc_core {
namespace {
template <typename EntryType>
Map<StringView, double, StringLess> ParseMap(
std::map<StringView, double, StringLess> ParseMap(
udpa_data_orca_v1_OrcaLoadReport* msg,
EntryType** (*entry_func)(udpa_data_orca_v1_OrcaLoadReport*, size_t*),
upb_strview (*key_func)(const EntryType*),
double (*value_func)(const EntryType*), Arena* arena) {
Map<StringView, double, StringLess> result;
std::map<StringView, double, StringLess> result;
size_t size;
const auto* const* entries = entry_func(msg, &size);
for (size_t i = 0; i < size; ++i) {

@ -26,6 +26,8 @@
#include <stdio.h>
#include <string.h>
#include <set>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
@ -53,7 +55,6 @@
#include "src/core/lib/gprpp/inlined_vector.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/gprpp/map.h"
#include "src/core/lib/gprpp/set.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/iomgr/combiner.h"
#include "src/core/lib/iomgr/iomgr.h"
@ -161,7 +162,7 @@ class ChannelData {
MutexLock lock(&external_watchers_mu_);
// Will be deleted when the watch is complete.
GPR_ASSERT(external_watchers_[on_complete] == nullptr);
external_watchers_[on_complete] = New<ExternalConnectivityWatcher>(
external_watchers_[on_complete] = new ExternalConnectivityWatcher(
this, pollent, state, on_complete, watcher_timer_init);
}
@ -227,7 +228,7 @@ class ChannelData {
void UpdateStateAndPickerLocked(
grpc_connectivity_state state, const char* reason,
UniquePtr<LoadBalancingPolicy::SubchannelPicker> picker);
std::unique_ptr<LoadBalancingPolicy::SubchannelPicker> picker);
void UpdateServiceConfigLocked(
RefCountedPtr<ServerRetryThrottleData> retry_throttle_data,
@ -251,7 +252,7 @@ class ChannelData {
void ProcessLbPolicy(
const Resolver::Result& resolver_result,
const internal::ClientChannelGlobalParsedConfig* parsed_service_config,
UniquePtr<char>* lb_policy_name,
std::unique_ptr<char>* lb_policy_name,
RefCountedPtr<LoadBalancingPolicy::Config>* lb_policy_config);
//
@ -264,15 +265,15 @@ class ChannelData {
ClientChannelFactory* client_channel_factory_;
const grpc_channel_args* channel_args_;
RefCountedPtr<ServiceConfig> default_service_config_;
UniquePtr<char> server_name_;
UniquePtr<char> target_uri_;
std::unique_ptr<char> server_name_;
std::unique_ptr<char> target_uri_;
channelz::ChannelNode* channelz_node_;
//
// Fields used in the data plane. Guarded by data_plane_mu.
//
mutable Mutex data_plane_mu_;
UniquePtr<LoadBalancingPolicy::SubchannelPicker> picker_;
std::unique_ptr<LoadBalancingPolicy::SubchannelPicker> picker_;
QueuedPick* queued_picks_ = nullptr; // Linked list of queued picks.
// Data from service config.
bool received_service_config_data_ = false;
@ -287,20 +288,20 @@ class ChannelData {
RefCountedPtr<SubchannelPoolInterface> subchannel_pool_;
OrphanablePtr<ResolvingLoadBalancingPolicy> resolving_lb_policy_;
ConnectivityStateTracker state_tracker_;
UniquePtr<char> health_check_service_name_;
std::unique_ptr<char> health_check_service_name_;
RefCountedPtr<ServiceConfig> saved_service_config_;
bool received_first_resolver_result_ = false;
// The number of SubchannelWrapper instances referencing a given Subchannel.
Map<Subchannel*, int> subchannel_refcount_map_;
std::map<Subchannel*, int> subchannel_refcount_map_;
// The set of SubchannelWrappers that currently exist.
// No need to hold a ref, since the map is updated in the control-plane
// combiner when the SubchannelWrappers are created and destroyed.
Set<SubchannelWrapper*> subchannel_wrappers_;
std::set<SubchannelWrapper*> subchannel_wrappers_;
// Pending ConnectedSubchannel updates for each SubchannelWrapper.
// Updates are queued here in the control plane combiner and then applied
// in the data plane mutex when the picker is updated.
Map<RefCountedPtr<SubchannelWrapper>, RefCountedPtr<ConnectedSubchannel>,
RefCountedPtrLess<SubchannelWrapper>>
std::map<RefCountedPtr<SubchannelWrapper>, RefCountedPtr<ConnectedSubchannel>,
RefCountedPtrLess<SubchannelWrapper>>
pending_subchannel_updates_;
//
@ -313,15 +314,15 @@ class ChannelData {
// synchronously via get_channel_info().
//
gpr_mu info_mu_;
UniquePtr<char> info_lb_policy_name_;
UniquePtr<char> info_service_config_json_;
std::unique_ptr<char> info_lb_policy_name_;
std::unique_ptr<char> info_service_config_json_;
//
// Fields guarded by a mutex, since they need to be accessed
// synchronously via grpc_channel_num_external_connectivity_watchers().
//
mutable Mutex external_watchers_mu_;
Map<grpc_closure*, ExternalConnectivityWatcher*> external_watchers_;
std::map<grpc_closure*, ExternalConnectivityWatcher*> external_watchers_;
};
//
@ -403,8 +404,9 @@ class CallData {
intptr_t handle) const override {
grpc_linked_mdelem* linked_mdelem =
reinterpret_cast<grpc_linked_mdelem*>(handle);
return std::make_pair(StringView(GRPC_MDKEY(linked_mdelem->md)),
StringView(GRPC_MDVALUE(linked_mdelem->md)));
return std::make_pair(
StringViewFromSlice(GRPC_MDKEY(linked_mdelem->md)),
StringViewFromSlice(GRPC_MDVALUE(linked_mdelem->md)));
}
CallData* calld_;
@ -841,7 +843,7 @@ class CallData {
class ChannelData::SubchannelWrapper : public SubchannelInterface {
public:
SubchannelWrapper(ChannelData* chand, Subchannel* subchannel,
UniquePtr<char> health_check_service_name)
std::unique_ptr<char> health_check_service_name)
: SubchannelInterface(&grpc_client_channel_routing_trace),
chand_(chand),
subchannel_(subchannel),
@ -896,15 +898,15 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
void WatchConnectivityState(
grpc_connectivity_state initial_state,
UniquePtr<ConnectivityStateWatcherInterface> watcher) override {
std::unique_ptr<ConnectivityStateWatcherInterface> watcher) override {
auto& watcher_wrapper = watcher_map_[watcher.get()];
GPR_ASSERT(watcher_wrapper == nullptr);
watcher_wrapper = New<WatcherWrapper>(std::move(watcher),
Ref(DEBUG_LOCATION, "WatcherWrapper"),
initial_state);
watcher_wrapper = new WatcherWrapper(std::move(watcher),
Ref(DEBUG_LOCATION, "WatcherWrapper"),
initial_state);
subchannel_->WatchConnectivityState(
initial_state,
UniquePtr<char>(gpr_strdup(health_check_service_name_.get())),
std::unique_ptr<char>(gpr_strdup(health_check_service_name_.get())),
OrphanablePtr<Subchannel::ConnectivityStateWatcherInterface>(
watcher_wrapper));
}
@ -926,7 +928,8 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
return subchannel_->channel_args();
}
void UpdateHealthCheckServiceName(UniquePtr<char> health_check_service_name) {
void UpdateHealthCheckServiceName(
std::unique_ptr<char> health_check_service_name) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
gpr_log(GPR_INFO,
"chand=%p: subchannel wrapper %p: updating health check service "
@ -952,7 +955,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
watcher_wrapper = replacement;
subchannel_->WatchConnectivityState(
replacement->last_seen_state(),
UniquePtr<char>(gpr_strdup(health_check_service_name.get())),
std::unique_ptr<char>(gpr_strdup(health_check_service_name.get())),
OrphanablePtr<Subchannel::ConnectivityStateWatcherInterface>(
replacement));
}
@ -992,7 +995,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
class WatcherWrapper : public Subchannel::ConnectivityStateWatcherInterface {
public:
WatcherWrapper(
UniquePtr<SubchannelInterface::ConnectivityStateWatcherInterface>
std::unique_ptr<SubchannelInterface::ConnectivityStateWatcherInterface>
watcher,
RefCountedPtr<SubchannelWrapper> parent,
grpc_connectivity_state initial_state)
@ -1016,7 +1019,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
connected_subchannel.get(), ConnectivityStateName(new_state));
}
// Will delete itself.
New<Updater>(Ref(), new_state, std::move(connected_subchannel));
new Updater(Ref(), new_state, std::move(connected_subchannel));
}
grpc_pollset_set* interested_parties() override {
@ -1028,7 +1031,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
WatcherWrapper* MakeReplacement() {
auto* replacement =
New<WatcherWrapper>(std::move(watcher_), parent_, last_seen_state_);
new WatcherWrapper(std::move(watcher_), parent_, last_seen_state_);
replacement_ = replacement;
return replacement;
}
@ -1072,7 +1075,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
self->parent_->parent_->MaybeUpdateConnectedSubchannel(
std::move(self->connected_subchannel_));
self->parent_->watcher_->OnConnectivityStateChange(self->state_);
Delete(self);
delete self;
}
RefCountedPtr<WatcherWrapper> parent_;
@ -1081,7 +1084,8 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
grpc_closure closure_;
};
UniquePtr<SubchannelInterface::ConnectivityStateWatcherInterface> watcher_;
std::unique_ptr<SubchannelInterface::ConnectivityStateWatcherInterface>
watcher_;
RefCountedPtr<SubchannelWrapper> parent_;
grpc_connectivity_state last_seen_state_;
WatcherWrapper* replacement_ = nullptr;
@ -1110,13 +1114,13 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
ChannelData* chand_;
Subchannel* subchannel_;
UniquePtr<char> health_check_service_name_;
std::unique_ptr<char> health_check_service_name_;
// Maps from the address of the watcher passed to us by the LB policy
// to the address of the WrapperWatcher that we passed to the underlying
// subchannel. This is needed so that when the LB policy calls
// CancelConnectivityStateWatch() with its watcher, we know the
// corresponding WrapperWatcher to cancel on the underlying subchannel.
Map<ConnectivityStateWatcherInterface*, WatcherWrapper*> watcher_map_;
std::map<ConnectivityStateWatcherInterface*, WatcherWrapper*> watcher_map_;
// To be accessed only in the control plane combiner.
RefCountedPtr<ConnectedSubchannel> connected_subchannel_;
// To be accessed only in the data plane mutex.
@ -1163,7 +1167,7 @@ void ChannelData::ExternalConnectivityWatcher::Notify(
chand_->RemoveExternalConnectivityWatcher(on_complete_, /*cancel=*/false);
// Report new state to the user.
*state_ = state;
GRPC_CLOSURE_SCHED(on_complete_, GRPC_ERROR_NONE);
ExecCtx::Run(DEBUG_LOCATION, on_complete_, GRPC_ERROR_NONE);
// Hop back into the combiner to clean up.
// Not needed in state SHUTDOWN, because the tracker will
// automatically remove all watchers in that case.
@ -1180,7 +1184,7 @@ void ChannelData::ExternalConnectivityWatcher::Cancel() {
MemoryOrder::RELAXED)) {
return; // Already done.
}
GRPC_CLOSURE_SCHED(on_complete_, GRPC_ERROR_CANCELLED);
ExecCtx::Run(DEBUG_LOCATION, on_complete_, GRPC_ERROR_CANCELLED);
// Hop back into the combiner to clean up.
chand_->combiner_->Run(
GRPC_CLOSURE_INIT(&remove_closure_, RemoveWatcherLocked, this, nullptr),
@ -1234,7 +1238,7 @@ class ChannelData::ConnectivityWatcherAdder {
std::move(self->watcher_));
GRPC_CHANNEL_STACK_UNREF(self->chand_->owning_stack_,
"ConnectivityWatcherAdder");
Delete(self);
delete self;
}
ChannelData* chand_;
@ -1267,7 +1271,7 @@ class ChannelData::ConnectivityWatcherRemover {
self->chand_->state_tracker_.RemoveWatcher(self->watcher_);
GRPC_CHANNEL_STACK_UNREF(self->chand_->owning_stack_,
"ConnectivityWatcherRemover");
Delete(self);
delete self;
}
ChannelData* chand_;
@ -1295,7 +1299,7 @@ class ChannelData::ClientChannelControlHelper
const grpc_channel_args& args) override {
bool inhibit_health_checking = grpc_channel_arg_get_bool(
grpc_channel_args_find(&args, GRPC_ARG_INHIBIT_HEALTH_CHECKING), false);
UniquePtr<char> health_check_service_name;
std::unique_ptr<char> health_check_service_name;
if (!inhibit_health_checking) {
health_check_service_name.reset(
gpr_strdup(chand_->health_check_service_name_.get()));
@ -1318,7 +1322,7 @@ class ChannelData::ClientChannelControlHelper
void UpdateState(
grpc_connectivity_state state,
UniquePtr<LoadBalancingPolicy::SubchannelPicker> picker) override {
std::unique_ptr<LoadBalancingPolicy::SubchannelPicker> picker) override {
grpc_error* disconnect_error = chand_->disconnect_error();
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
const char* extra = disconnect_error == GRPC_ERROR_NONE
@ -1491,7 +1495,7 @@ ChannelData::~ChannelData() {
void ChannelData::UpdateStateAndPickerLocked(
grpc_connectivity_state state, const char* reason,
UniquePtr<LoadBalancingPolicy::SubchannelPicker> picker) {
std::unique_ptr<LoadBalancingPolicy::SubchannelPicker> picker) {
// Clean the control plane when entering IDLE.
if (picker_ == nullptr) {
health_check_service_name_.reset();
@ -1591,8 +1595,8 @@ void ChannelData::CreateResolvingLoadBalancingPolicyLocked() {
lb_args.combiner = combiner_;
lb_args.channel_control_helper = MakeUnique<ClientChannelControlHelper>(this);
lb_args.args = channel_args_;
UniquePtr<char> target_uri(gpr_strdup(target_uri_.get()));
resolving_lb_policy_.reset(New<ResolvingLoadBalancingPolicy>(
std::unique_ptr<char> target_uri(gpr_strdup(target_uri_.get()));
resolving_lb_policy_.reset(new ResolvingLoadBalancingPolicy(
std::move(lb_args), &grpc_client_channel_routing_trace,
std::move(target_uri), ProcessResolverResultLocked, this));
grpc_pollset_set_add_pollset_set(resolving_lb_policy_->interested_parties(),
@ -1614,7 +1618,7 @@ void ChannelData::DestroyResolvingLoadBalancingPolicyLocked() {
void ChannelData::ProcessLbPolicy(
const Resolver::Result& resolver_result,
const internal::ClientChannelGlobalParsedConfig* parsed_service_config,
UniquePtr<char>* lb_policy_name,
std::unique_ptr<char>* lb_policy_name,
RefCountedPtr<LoadBalancingPolicy::Config>* lb_policy_config) {
// Prefer the LB policy name found in the service config.
if (parsed_service_config != nullptr &&
@ -1709,7 +1713,7 @@ bool ChannelData::ProcessResolverResultLocked(
return false;
}
// Process service config.
UniquePtr<char> service_config_json;
std::unique_ptr<char> service_config_json;
const internal::ClientChannelGlobalParsedConfig* parsed_service_config =
nullptr;
if (service_config != nullptr) {
@ -1743,8 +1747,8 @@ bool ChannelData::ProcessResolverResultLocked(
}
// Update health check service name used by existing subchannel wrappers.
for (auto* subchannel_wrapper : chand->subchannel_wrappers_) {
subchannel_wrapper->UpdateHealthCheckServiceName(
UniquePtr<char>(gpr_strdup(chand->health_check_service_name_.get())));
subchannel_wrapper->UpdateHealthCheckServiceName(std::unique_ptr<char>(
gpr_strdup(chand->health_check_service_name_.get())));
}
// Save service config.
chand->saved_service_config_ = std::move(service_config);
@ -1769,7 +1773,7 @@ bool ChannelData::ProcessResolverResultLocked(
chand->UpdateServiceConfigLocked(std::move(retry_throttle_data),
chand->saved_service_config_);
}
UniquePtr<char> processed_lb_policy_name;
std::unique_ptr<char> processed_lb_policy_name;
chand->ProcessLbPolicy(result, parsed_service_config,
&processed_lb_policy_name, lb_policy_config);
// Swap out the data used by GetChannelInfo().
@ -1825,8 +1829,9 @@ void ChannelData::StartTransportOpLocked(void* arg, grpc_error* /*ignored*/) {
if (op->send_ping.on_initiate != nullptr || op->send_ping.on_ack != nullptr) {
grpc_error* error = chand->DoPingLocked(op);
if (error != GRPC_ERROR_NONE) {
GRPC_CLOSURE_SCHED(op->send_ping.on_initiate, GRPC_ERROR_REF(error));
GRPC_CLOSURE_SCHED(op->send_ping.on_ack, error);
ExecCtx::Run(DEBUG_LOCATION, op->send_ping.on_initiate,
GRPC_ERROR_REF(error));
ExecCtx::Run(DEBUG_LOCATION, op->send_ping.on_ack, error);
}
op->bind_pollset = nullptr;
op->send_ping.on_initiate = nullptr;
@ -1868,7 +1873,7 @@ void ChannelData::StartTransportOpLocked(void* arg, grpc_error* /*ignored*/) {
}
}
GRPC_CHANNEL_STACK_UNREF(chand->owning_stack_, "start_transport_op");
GRPC_CLOSURE_SCHED(op->on_consumed, GRPC_ERROR_NONE);
ExecCtx::Run(DEBUG_LOCATION, op->on_consumed, GRPC_ERROR_NONE);
}
void ChannelData::StartTransportOp(grpc_channel_element* elem,
@ -1960,12 +1965,12 @@ grpc_connectivity_state ChannelData::CheckConnectivityState(
void ChannelData::AddConnectivityWatcher(
grpc_connectivity_state initial_state,
OrphanablePtr<AsyncConnectivityStateWatcherInterface> watcher) {
New<ConnectivityWatcherAdder>(this, initial_state, std::move(watcher));
new ConnectivityWatcherAdder(this, initial_state, std::move(watcher));
}
void ChannelData::RemoveConnectivityWatcher(
AsyncConnectivityStateWatcherInterface* watcher) {
New<ConnectivityWatcherRemover>(this, watcher);
new ConnectivityWatcherRemover(this, watcher);
}
//
@ -2057,7 +2062,8 @@ void CallData::Destroy(grpc_call_element* elem,
then_schedule_closure = nullptr;
}
calld->~CallData();
GRPC_CLOSURE_SCHED(then_schedule_closure, GRPC_ERROR_NONE);
// TODO(yashkt) : This can potentially be a Closure::Run
ExecCtx::Run(DEBUG_LOCATION, then_schedule_closure, GRPC_ERROR_NONE);
}
void CallData::StartTransportStreamOpBatch(
@ -3681,7 +3687,7 @@ void CallData::CreateSubchannelCall(grpc_call_element* elem) {
void CallData::AsyncPickDone(grpc_call_element* elem, grpc_error* error) {
GRPC_CLOSURE_INIT(&pick_closure_, PickDone, elem, grpc_schedule_on_exec_ctx);
GRPC_CLOSURE_SCHED(&pick_closure_, error);
ExecCtx::Run(DEBUG_LOCATION, &pick_closure_, error);
}
void CallData::PickDone(void* arg, grpc_error* error) {
@ -3733,7 +3739,7 @@ class CallData::QueuedPickCanceller {
YieldCallCombinerIfPendingBatchesFound);
}
GRPC_CALL_STACK_UNREF(calld->owning_call_, "QueuedPickCanceller");
Delete(self);
delete self;
}
grpc_call_element* elem_;
@ -3762,7 +3768,7 @@ void CallData::AddCallToQueuedPicksLocked(grpc_call_element* elem) {
pick_.elem = elem;
chand->AddQueuedPick(&pick_, pollent_);
// Register call combiner cancellation callback.
pick_canceller_ = New<QueuedPickCanceller>(elem);
pick_canceller_ = new QueuedPickCanceller(elem);
}
void CallData::ApplyServiceConfigToCallLocked(grpc_call_element* elem) {

@ -30,11 +30,10 @@
namespace grpc_core {
namespace channelz {
SubchannelNode::SubchannelNode(const char* target_address,
SubchannelNode::SubchannelNode(std::string target_address,
size_t channel_tracer_max_nodes)
: BaseNode(EntityType::kSubchannel,
UniquePtr<char>(gpr_strdup(target_address))),
target_(UniquePtr<char>(gpr_strdup(target_address))),
: BaseNode(EntityType::kSubchannel, target_address),
target_(std::move(target_address)),
trace_(channel_tracer_max_nodes) {}
SubchannelNode::~SubchannelNode() {}
@ -76,8 +75,8 @@ grpc_json* SubchannelNode::RenderJson() {
json = data;
json_iterator = nullptr;
PopulateConnectivityState(json);
GPR_ASSERT(target_.get() != nullptr);
grpc_json_create_child(nullptr, json, "target", target_.get(),
GPR_ASSERT(!target_.empty());
grpc_json_create_child(nullptr, json, "target", target_.c_str(),
GRPC_JSON_STRING, false);
// fill in the channel trace if applicable
grpc_json* trace_json = trace_.RenderJson();
@ -102,7 +101,8 @@ grpc_json* SubchannelNode::RenderJson() {
grpc_json* sibling_iterator = grpc_json_add_number_string_child(
json_iterator, nullptr, "socketId", child_socket->uuid());
grpc_json_create_child(sibling_iterator, json_iterator, "name",
child_socket->name(), GRPC_JSON_STRING, false);
child_socket->name().c_str(), GRPC_JSON_STRING,
false);
}
return top_level_json;
}

@ -21,6 +21,8 @@
#include <grpc/support/port_platform.h>
#include <string>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/channel/channel_trace.h"
@ -34,7 +36,7 @@ namespace channelz {
class SubchannelNode : public BaseNode {
public:
SubchannelNode(const char* target_address, size_t channel_tracer_max_nodes);
SubchannelNode(std::string target_address, size_t channel_tracer_max_nodes);
~SubchannelNode() override;
// Sets the subchannel's connectivity state without health checking.
@ -67,7 +69,7 @@ class SubchannelNode : public BaseNode {
Atomic<grpc_connectivity_state> connectivity_state_{GRPC_CHANNEL_IDLE};
Mutex socket_mu_;
RefCountedPtr<SocketNode> child_socket_;
UniquePtr<char> target_;
std::string target_;
CallCountingHelper call_counter_;
ChannelTrace trace_;
};

@ -35,7 +35,7 @@ GlobalSubchannelPool::~GlobalSubchannelPool() {
}
void GlobalSubchannelPool::Init() {
instance_ = New<RefCountedPtr<GlobalSubchannelPool>>(
instance_ = new RefCountedPtr<GlobalSubchannelPool>(
MakeRefCounted<GlobalSubchannelPool>());
}
@ -45,7 +45,7 @@ void GlobalSubchannelPool::Shutdown() {
// To ensure Shutdown() was not called before.
GPR_ASSERT(*instance_ != nullptr);
instance_->reset();
Delete(instance_);
delete instance_;
}
RefCountedPtr<GlobalSubchannelPool> GlobalSubchannelPool::instance() {
@ -78,7 +78,7 @@ Subchannel* GlobalSubchannelPool::RegisterSubchannel(SubchannelKey* key,
// Note that we should ref the old map first because grpc_avl_add() will
// unref it while we still need to access it later.
grpc_avl new_map = grpc_avl_add(
grpc_avl_ref(old_map, nullptr), New<SubchannelKey>(*key),
grpc_avl_ref(old_map, nullptr), new SubchannelKey(*key),
GRPC_SUBCHANNEL_WEAK_REF(constructed, "subchannel_register+new"),
nullptr);
// Try to publish the change to the shared map. It may happen (but
@ -142,12 +142,12 @@ namespace {
void sck_avl_destroy(void* p, void* /*user_data*/) {
SubchannelKey* key = static_cast<SubchannelKey*>(p);
Delete(key);
delete key;
}
void* sck_avl_copy(void* p, void* /*unused*/) {
const SubchannelKey* key = static_cast<const SubchannelKey*>(p);
auto* new_key = New<SubchannelKey>(*key);
auto* new_key = new SubchannelKey(*key);
return static_cast<void*>(new_key);
}

@ -200,7 +200,7 @@ bool DecodeResponse(grpc_slice_buffer* slice_buffer, grpc_error** error) {
return false;
}
// Concatenate the slices to form a single string.
UniquePtr<uint8_t> recv_message_deleter;
std::unique_ptr<uint8_t> recv_message_deleter;
uint8_t* recv_message;
if (slice_buffer->count == 1) {
recv_message = GRPC_SLICE_START_PTR(slice_buffer->slices[0]);
@ -300,7 +300,8 @@ void HealthCheckClient::CallState::StartCall() {
// Schedule instead of running directly, since we must not be
// holding health_check_client_->mu_ when CallEnded() is called.
call_->Ref(DEBUG_LOCATION, "call_end_closure").release();
GRPC_CLOSURE_SCHED(
ExecCtx::Run(
DEBUG_LOCATION,
GRPC_CLOSURE_INIT(&batch_.handler_private.closure, CallEndedRetry, this,
grpc_schedule_on_exec_ctx),
GRPC_ERROR_NONE);
@ -399,7 +400,7 @@ void HealthCheckClient::CallState::AfterCallStackDestruction(
void* arg, grpc_error* /*error*/) {
HealthCheckClient::CallState* self =
static_cast<HealthCheckClient::CallState*>(arg);
Delete(self);
delete self;
}
void HealthCheckClient::CallState::OnCancelComplete(void* arg,

@ -58,7 +58,7 @@ class HttpConnectHandshaker : public Handshaker {
static void OnWriteDone(void* arg, grpc_error* error);
static void OnReadDone(void* arg, grpc_error* error);
gpr_mu mu_;
Mutex mu_;
bool is_shutdown_ = false;
// Endpoint and read buffer to destroy after a shutdown.
@ -78,7 +78,6 @@ class HttpConnectHandshaker : public Handshaker {
};
HttpConnectHandshaker::~HttpConnectHandshaker() {
gpr_mu_destroy(&mu_);
if (endpoint_to_destroy_ != nullptr) {
grpc_endpoint_destroy(endpoint_to_destroy_);
}
@ -125,34 +124,33 @@ void HttpConnectHandshaker::HandshakeFailedLocked(grpc_error* error) {
is_shutdown_ = true;
}
// Invoke callback.
GRPC_CLOSURE_SCHED(on_handshake_done_, error);
ExecCtx::Run(DEBUG_LOCATION, on_handshake_done_, error);
}
// Callback invoked when finished writing HTTP CONNECT request.
void HttpConnectHandshaker::OnWriteDone(void* arg, grpc_error* error) {
auto* handshaker = static_cast<HttpConnectHandshaker*>(arg);
gpr_mu_lock(&handshaker->mu_);
ReleasableMutexLock lock(&handshaker->mu_);
if (error != GRPC_ERROR_NONE || handshaker->is_shutdown_) {
// If the write failed or we're shutting down, clean up and invoke the
// callback with the error.
handshaker->HandshakeFailedLocked(GRPC_ERROR_REF(error));
gpr_mu_unlock(&handshaker->mu_);
lock.Unlock();
handshaker->Unref();
} else {
// Otherwise, read the response.
// The read callback inherits our ref to the handshaker.
lock.Unlock();
grpc_endpoint_read(handshaker->args_->endpoint,
handshaker->args_->read_buffer,
&handshaker->response_read_closure_, /*urgent=*/true);
gpr_mu_unlock(&handshaker->mu_);
}
}
// Callback invoked for reading HTTP CONNECT response.
void HttpConnectHandshaker::OnReadDone(void* arg, grpc_error* error) {
auto* handshaker = static_cast<HttpConnectHandshaker*>(arg);
gpr_mu_lock(&handshaker->mu_);
ReleasableMutexLock lock(&handshaker->mu_);
if (error != GRPC_ERROR_NONE || handshaker->is_shutdown_) {
// If the read failed or we're shutting down, clean up and invoke the
// callback with the error.
@ -204,10 +202,10 @@ void HttpConnectHandshaker::OnReadDone(void* arg, grpc_error* error) {
// at the Content-Length: header).
if (handshaker->http_parser_.state != GRPC_HTTP_BODY) {
grpc_slice_buffer_reset_and_unref_internal(handshaker->args_->read_buffer);
lock.Unlock();
grpc_endpoint_read(handshaker->args_->endpoint,
handshaker->args_->read_buffer,
&handshaker->response_read_closure_, /*urgent=*/true);
gpr_mu_unlock(&handshaker->mu_);
return;
}
// Make sure we got a 2xx response.
@ -222,12 +220,12 @@ void HttpConnectHandshaker::OnReadDone(void* arg, grpc_error* error) {
goto done;
}
// Success. Invoke handshake-done callback.
GRPC_CLOSURE_SCHED(handshaker->on_handshake_done_, error);
ExecCtx::Run(DEBUG_LOCATION, handshaker->on_handshake_done_, error);
done:
// Set shutdown to true so that subsequent calls to
// http_connect_handshaker_shutdown() do nothing.
handshaker->is_shutdown_ = true;
gpr_mu_unlock(&handshaker->mu_);
lock.Unlock();
handshaker->Unref();
}
@ -236,13 +234,14 @@ done:
//
void HttpConnectHandshaker::Shutdown(grpc_error* why) {
gpr_mu_lock(&mu_);
if (!is_shutdown_) {
is_shutdown_ = true;
grpc_endpoint_shutdown(args_->endpoint, GRPC_ERROR_REF(why));
CleanupArgsForFailureLocked();
{
MutexLock lock(&mu_);
if (!is_shutdown_) {
is_shutdown_ = true;
grpc_endpoint_shutdown(args_->endpoint, GRPC_ERROR_REF(why));
CleanupArgsForFailureLocked();
}
}
gpr_mu_unlock(&mu_);
GRPC_ERROR_UNREF(why);
}
@ -257,10 +256,11 @@ void HttpConnectHandshaker::DoHandshake(grpc_tcp_server_acceptor* /*acceptor*/,
if (server_name == nullptr) {
// Set shutdown to true so that subsequent calls to
// http_connect_handshaker_shutdown() do nothing.
gpr_mu_lock(&mu_);
is_shutdown_ = true;
gpr_mu_unlock(&mu_);
GRPC_CLOSURE_SCHED(on_handshake_done, GRPC_ERROR_NONE);
{
MutexLock lock(&mu_);
is_shutdown_ = true;
}
ExecCtx::Run(DEBUG_LOCATION, on_handshake_done, GRPC_ERROR_NONE);
return;
}
// Get headers from channel args.
@ -290,7 +290,7 @@ void HttpConnectHandshaker::DoHandshake(grpc_tcp_server_acceptor* /*acceptor*/,
}
}
// Save state in the handshaker object.
MutexLock lock(&mu_);
ReleasableMutexLock lock(&mu_);
args_ = args;
on_handshake_done_ = on_handshake_done;
// Log connection via proxy.
@ -320,12 +320,12 @@ void HttpConnectHandshaker::DoHandshake(grpc_tcp_server_acceptor* /*acceptor*/,
gpr_free(header_strings);
// Take a new ref to be held by the write callback.
Ref().release();
lock.Unlock();
grpc_endpoint_write(args->endpoint, &write_buffer_, &request_done_closure_,
nullptr);
}
HttpConnectHandshaker::HttpConnectHandshaker() {
gpr_mu_init(&mu_);
grpc_slice_buffer_init(&write_buffer_);
GRPC_CLOSURE_INIT(&request_done_closure_, &HttpConnectHandshaker::OnWriteDone,
this, grpc_schedule_on_exec_ctx);

@ -130,8 +130,8 @@ static bool proxy_mapper_map_name(grpc_proxy_mapper* /*mapper*/,
if (no_proxy_str != nullptr) {
static const char* NO_PROXY_SEPARATOR = ",";
bool use_proxy = true;
grpc_core::UniquePtr<char> server_host;
grpc_core::UniquePtr<char> server_port;
std::unique_ptr<char> server_host;
std::unique_ptr<char> server_port;
if (!grpc_core::SplitHostPort(
uri->path[0] == '/' ? uri->path + 1 : uri->path, &server_host,
&server_port)) {

@ -21,6 +21,7 @@
#include <grpc/support/port_platform.h>
#include <functional>
#include <iterator>
#include "src/core/ext/filters/client_channel/server_address.h"
@ -92,11 +93,11 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
/// Application-specific requests cost metrics. Metric names are
/// determined by the application. Each value is an absolute cost
/// (e.g. 3487 bytes of storage) associated with the request.
Map<StringView, double, StringLess> request_cost;
std::map<StringView, double, StringLess> request_cost;
/// Application-specific resource utilization metrics. Metric names
/// are determined by the application. Each value is expressed as a
/// fraction of total resources available.
Map<StringView, double, StringLess> utilization;
std::map<StringView, double, StringLess> utilization;
};
/// Interface for accessing per-call state.
@ -268,7 +269,7 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
/// Sets the connectivity state and returns a new picker to be used
/// by the client channel.
virtual void UpdateState(grpc_connectivity_state state,
UniquePtr<SubchannelPicker>) = 0;
std::unique_ptr<SubchannelPicker>) = 0;
/// Requests that the resolver re-resolve.
virtual void RequestReresolution() = 0;
@ -317,7 +318,7 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
/// Channel control helper.
/// Note: LB policies MUST NOT call any method on the helper from
/// their constructor.
UniquePtr<ChannelControlHelper> channel_control_helper;
std::unique_ptr<ChannelControlHelper> channel_control_helper;
/// Channel args.
// TODO(roth): Find a better channel args representation for this API.
// TODO(roth): Clarify ownership semantics here -- currently, this
@ -403,7 +404,7 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
/// Owned pointer to interested parties in load balancing decisions.
grpc_pollset_set* interested_parties_;
/// Channel control helper.
UniquePtr<ChannelControlHelper> channel_control_helper_;
std::unique_ptr<ChannelControlHelper> channel_control_helper_;
};
} // namespace grpc_core

@ -237,7 +237,7 @@ class GrpcLb : public LoadBalancingPolicy {
const grpc_grpclb_serverlist* serverlist() const { return serverlist_; }
// Returns a text representation suitable for logging.
UniquePtr<char> AsText() const;
std::unique_ptr<char> AsText() const;
// Extracts all non-drop entries into a ServerAddressList.
ServerAddressList GetServerAddressList(
@ -268,7 +268,7 @@ class GrpcLb : public LoadBalancingPolicy {
class Picker : public SubchannelPicker {
public:
Picker(GrpcLb* parent, RefCountedPtr<Serverlist> serverlist,
UniquePtr<SubchannelPicker> child_picker,
std::unique_ptr<SubchannelPicker> child_picker,
RefCountedPtr<GrpcLbClientStats> client_stats)
: parent_(parent),
serverlist_(std::move(serverlist)),
@ -285,7 +285,7 @@ class GrpcLb : public LoadBalancingPolicy {
// Serverlist to be used for determining drops.
RefCountedPtr<Serverlist> serverlist_;
UniquePtr<SubchannelPicker> child_picker_;
std::unique_ptr<SubchannelPicker> child_picker_;
RefCountedPtr<GrpcLbClientStats> client_stats_;
};
@ -297,7 +297,7 @@ class GrpcLb : public LoadBalancingPolicy {
RefCountedPtr<SubchannelInterface> CreateSubchannel(
const grpc_channel_args& args) override;
void UpdateState(grpc_connectivity_state state,
UniquePtr<SubchannelPicker> picker) override;
std::unique_ptr<SubchannelPicker> picker) override;
void RequestReresolution() override;
void AddTraceEvent(TraceSeverity severity, StringView message) override;
@ -430,7 +430,7 @@ void ParseServer(const grpc_grpclb_server* server,
}
}
UniquePtr<char> GrpcLb::Serverlist::AsText() const {
std::unique_ptr<char> GrpcLb::Serverlist::AsText() const {
gpr_strvec entries;
gpr_strvec_init(&entries);
for (size_t i = 0; i < serverlist_->num_servers; ++i) {
@ -449,7 +449,7 @@ UniquePtr<char> GrpcLb::Serverlist::AsText() const {
gpr_free(ipport);
gpr_strvec_add(&entries, entry);
}
UniquePtr<char> result(gpr_strvec_flatten(&entries, nullptr));
std::unique_ptr<char> result(gpr_strvec_flatten(&entries, nullptr));
gpr_strvec_destroy(&entries);
return result;
}
@ -479,8 +479,7 @@ int equal_cmp(void* /*p1*/, void* /*p2*/) {
// token or client stats. A better approach might be to find somewhere
// other than the subchannel args to store the LB token and client
// stats. They could be stored in a map and then looked up for each
// call (although we'd need to make sure our Map<> implementation is
// performant enough). Or we could do something more complicated whereby
// call. Or we could do something more complicated whereby
// we create our own subchannel wrapper to store them, although that would
// involve a lot of refcounting overhead.
// Given that we're trying to move from grpclb to xds at this point,
@ -658,7 +657,7 @@ RefCountedPtr<SubchannelInterface> GrpcLb::Helper::CreateSubchannel(
}
void GrpcLb::Helper::UpdateState(grpc_connectivity_state state,
UniquePtr<SubchannelPicker> picker) {
std::unique_ptr<SubchannelPicker> picker) {
if (parent_->shutting_down_) return;
// If this request is from the pending child policy, ignore it until
// it reports READY, at which point we swap it into place.
@ -1100,7 +1099,7 @@ void GrpcLb::BalancerCallState::OnBalancerMessageReceivedLocked(
GPR_ASSERT(lb_calld->lb_call_ != nullptr);
auto serverlist_wrapper = MakeRefCounted<Serverlist>(serverlist);
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_glb_trace)) {
UniquePtr<char> serverlist_text = serverlist_wrapper->AsText();
std::unique_ptr<char> serverlist_text = serverlist_wrapper->AsText();
gpr_log(GPR_INFO,
"[grpclb %p] lb_calld=%p: Serverlist with %" PRIuPTR
" servers received:\n%s",
@ -1725,12 +1724,12 @@ grpc_channel_args* GrpcLb::CreateChildPolicyArgsLocked(
OrphanablePtr<LoadBalancingPolicy> GrpcLb::CreateChildPolicyLocked(
const char* name, const grpc_channel_args* args) {
Helper* helper = New<Helper>(Ref());
Helper* helper = new Helper(Ref());
LoadBalancingPolicy::Args lb_policy_args;
lb_policy_args.combiner = combiner();
lb_policy_args.args = args;
lb_policy_args.channel_control_helper =
UniquePtr<ChannelControlHelper>(helper);
std::unique_ptr<ChannelControlHelper>(helper);
OrphanablePtr<LoadBalancingPolicy> lb_policy =
LoadBalancingPolicyRegistry::CreateLoadBalancingPolicy(
name, std::move(lb_policy_args));
@ -1884,7 +1883,7 @@ class GrpcLbFactory : public LoadBalancingPolicyFactory {
GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE);
if (json == nullptr) {
return RefCountedPtr<LoadBalancingPolicy::Config>(
New<ParsedGrpcLbConfig>(nullptr));
new ParsedGrpcLbConfig(nullptr));
}
InlinedVector<grpc_error*, 2> error_list;
RefCountedPtr<LoadBalancingPolicy::Config> child_policy;
@ -1906,7 +1905,7 @@ class GrpcLbFactory : public LoadBalancingPolicyFactory {
}
if (error_list.empty()) {
return RefCountedPtr<LoadBalancingPolicy::Config>(
New<ParsedGrpcLbConfig>(std::move(child_policy)));
new ParsedGrpcLbConfig(std::move(child_policy)));
} else {
*error = GRPC_ERROR_CREATE_FROM_VECTOR("GrpcLb Parser", &error_list);
return nullptr;

@ -39,8 +39,8 @@ namespace grpc_core {
namespace {
int BalancerNameCmp(const grpc_core::UniquePtr<char>& a,
const grpc_core::UniquePtr<char>& b) {
int BalancerNameCmp(const std::unique_ptr<char>& a,
const std::unique_ptr<char>& b) {
return strcmp(a.get(), b.get());
}

@ -52,7 +52,7 @@ void GrpcLbClientStats::AddCallDropped(const char* token) {
// Record the drop.
MutexLock lock(&drop_count_mu_);
if (drop_token_counts_ == nullptr) {
drop_token_counts_.reset(New<DroppedCallCounts>());
drop_token_counts_.reset(new DroppedCallCounts());
}
for (size_t i = 0; i < drop_token_counts_->size(); ++i) {
if (strcmp((*drop_token_counts_)[i].token.get(), token) == 0) {
@ -61,7 +61,7 @@ void GrpcLbClientStats::AddCallDropped(const char* token) {
}
}
// Not found, so add a new entry.
drop_token_counts_->emplace_back(UniquePtr<char>(gpr_strdup(token)), 1);
drop_token_counts_->emplace_back(std::unique_ptr<char>(gpr_strdup(token)), 1);
}
namespace {
@ -76,7 +76,7 @@ void GrpcLbClientStats::Get(
int64_t* num_calls_started, int64_t* num_calls_finished,
int64_t* num_calls_finished_with_client_failed_to_send,
int64_t* num_calls_finished_known_received,
UniquePtr<DroppedCallCounts>* drop_token_counts) {
std::unique_ptr<DroppedCallCounts>* drop_token_counts) {
AtomicGetAndResetCounter(num_calls_started, &num_calls_started_);
AtomicGetAndResetCounter(num_calls_finished, &num_calls_finished_);
AtomicGetAndResetCounter(num_calls_finished_with_client_failed_to_send,

@ -33,10 +33,10 @@ namespace grpc_core {
class GrpcLbClientStats : public RefCounted<GrpcLbClientStats> {
public:
struct DropTokenCount {
UniquePtr<char> token;
std::unique_ptr<char> token;
int64_t count;
DropTokenCount(UniquePtr<char> token, int64_t count)
DropTokenCount(std::unique_ptr<char> token, int64_t count)
: token(std::move(token)), count(count) {}
};
@ -51,7 +51,7 @@ class GrpcLbClientStats : public RefCounted<GrpcLbClientStats> {
void Get(int64_t* num_calls_started, int64_t* num_calls_finished,
int64_t* num_calls_finished_with_client_failed_to_send,
int64_t* num_calls_finished_known_received,
UniquePtr<DroppedCallCounts>* drop_token_counts);
std::unique_ptr<DroppedCallCounts>* drop_token_counts);
// A destruction function to use as the user_data key when attaching
// client stats to a grpc_mdelem.
@ -65,7 +65,7 @@ class GrpcLbClientStats : public RefCounted<GrpcLbClientStats> {
gpr_atm num_calls_finished_with_client_failed_to_send_ = 0;
gpr_atm num_calls_finished_known_received_ = 0;
Mutex drop_count_mu_; // Guards drop_token_counts_.
UniquePtr<DroppedCallCounts> drop_token_counts_;
std::unique_ptr<DroppedCallCounts> drop_token_counts_;
};
} // namespace grpc_core

@ -63,7 +63,7 @@ grpc_grpclb_request* grpc_grpclb_load_report_request_create(
int64_t num_calls_finished;
int64_t num_calls_finished_with_client_failed_to_send;
int64_t num_calls_finished_known_received;
UniquePtr<GrpcLbClientStats::DroppedCallCounts> drop_token_counts;
std::unique_ptr<GrpcLbClientStats::DroppedCallCounts> drop_token_counts;
client_stats->Get(&num_calls_started, &num_calls_finished,
&num_calls_finished_with_client_failed_to_send,
&num_calls_finished_known_received, &drop_token_counts);

@ -495,7 +495,7 @@ class PickFirstFactory : public LoadBalancingPolicyFactory {
GPR_DEBUG_ASSERT(strcmp(json->key, name()) == 0);
}
return RefCountedPtr<LoadBalancingPolicy::Config>(
New<ParsedPickFirstConfig>());
new ParsedPickFirstConfig());
}
};

@ -491,7 +491,7 @@ class RoundRobinFactory : public LoadBalancingPolicyFactory {
GPR_DEBUG_ASSERT(strcmp(json->key, name()) == 0);
}
return RefCountedPtr<LoadBalancingPolicy::Config>(
New<ParsedRoundRobinConfig>());
new ParsedRoundRobinConfig());
}
};

@ -206,10 +206,6 @@ class SubchannelList : public InternallyRefCounted<SubchannelListType> {
virtual ~SubchannelList();
private:
// So New() can call our private ctor.
template <typename T, typename... Args>
friend T* New(Args&&... args);
// For accessing Ref() and Unref().
friend class SubchannelData<SubchannelListType, SubchannelDataType>;
@ -317,10 +313,10 @@ void SubchannelData<SubchannelListType,
}
GPR_ASSERT(pending_watcher_ == nullptr);
pending_watcher_ =
New<Watcher>(this, subchannel_list()->Ref(DEBUG_LOCATION, "Watcher"));
new Watcher(this, subchannel_list()->Ref(DEBUG_LOCATION, "Watcher"));
subchannel_->WatchConnectivityState(
connectivity_state_,
UniquePtr<SubchannelInterface::ConnectivityStateWatcherInterface>(
std::unique_ptr<SubchannelInterface::ConnectivityStateWatcherInterface>(
pending_watcher_));
}

@ -39,13 +39,13 @@ constexpr char kCds[] = "cds_experimental";
// Parsed config for this LB policy.
class ParsedCdsConfig : public LoadBalancingPolicy::Config {
public:
explicit ParsedCdsConfig(UniquePtr<char> cluster)
explicit ParsedCdsConfig(std::unique_ptr<char> cluster)
: cluster_(std::move(cluster)) {}
const char* cluster() const { return cluster_.get(); }
const char* name() const override { return kCds; }
private:
UniquePtr<char> cluster_;
std::unique_ptr<char> cluster_;
};
// CDS LB policy.
@ -78,7 +78,7 @@ class CdsLb : public LoadBalancingPolicy {
RefCountedPtr<SubchannelInterface> CreateSubchannel(
const grpc_channel_args& args) override;
void UpdateState(grpc_connectivity_state state,
UniquePtr<SubchannelPicker> picker) override;
std::unique_ptr<SubchannelPicker> picker) override;
void RequestReresolution() override;
void AddTraceEvent(TraceSeverity severity, StringView message) override;
@ -136,7 +136,7 @@ void CdsLb::ClusterWatcher::OnClusterChanged(CdsUpdate cluster_data) {
? parent_->config_->cluster()
: cluster_data.eds_service_name.get()));
gpr_free(lrs_str);
UniquePtr<char> json_str_deleter(json_str);
std::unique_ptr<char> json_str_deleter(json_str);
if (GRPC_TRACE_FLAG_ENABLED(grpc_cds_lb_trace)) {
gpr_log(GPR_INFO, "[cdslb %p] generated config for child policy: %s",
parent_.get(), json_str);
@ -203,7 +203,7 @@ RefCountedPtr<SubchannelInterface> CdsLb::Helper::CreateSubchannel(
}
void CdsLb::Helper::UpdateState(grpc_connectivity_state state,
UniquePtr<SubchannelPicker> picker) {
std::unique_ptr<SubchannelPicker> picker) {
if (parent_->shutting_down_) return;
if (GRPC_TRACE_FLAG_ENABLED(grpc_cds_lb_trace)) {
gpr_log(GPR_INFO, "[cdslb %p] state updated by child: %s", this,
@ -343,7 +343,7 @@ class CdsFactory : public LoadBalancingPolicyFactory {
}
if (error_list.empty()) {
return MakeRefCounted<ParsedCdsConfig>(
UniquePtr<char>(gpr_strdup(cluster)));
std::unique_ptr<char>(gpr_strdup(cluster)));
} else {
*error = GRPC_ERROR_CREATE_FROM_VECTOR("Cds Parser", &error_list);
return nullptr;

@ -78,8 +78,8 @@ class ParsedXdsConfig : public LoadBalancingPolicy::Config {
public:
ParsedXdsConfig(RefCountedPtr<LoadBalancingPolicy::Config> child_policy,
RefCountedPtr<LoadBalancingPolicy::Config> fallback_policy,
UniquePtr<char> eds_service_name,
UniquePtr<char> lrs_load_reporting_server_name)
std::unique_ptr<char> eds_service_name,
std::unique_ptr<char> lrs_load_reporting_server_name)
: child_policy_(std::move(child_policy)),
fallback_policy_(std::move(fallback_policy)),
eds_service_name_(std::move(eds_service_name)),
@ -105,8 +105,8 @@ class ParsedXdsConfig : public LoadBalancingPolicy::Config {
private:
RefCountedPtr<LoadBalancingPolicy::Config> child_policy_;
RefCountedPtr<LoadBalancingPolicy::Config> fallback_policy_;
UniquePtr<char> eds_service_name_;
UniquePtr<char> lrs_load_reporting_server_name_;
std::unique_ptr<char> eds_service_name_;
std::unique_ptr<char> lrs_load_reporting_server_name_;
};
class XdsLb : public LoadBalancingPolicy {
@ -123,12 +123,13 @@ class XdsLb : public LoadBalancingPolicy {
// We need this wrapper for the following reasons:
// 1. To process per-locality load reporting.
// 2. Since pickers are UniquePtrs we use this RefCounted wrapper to control
// 2. Since pickers are std::unique_ptrs we use this RefCounted wrapper to
// control
// references to it by the xds picker and the locality.
class EndpointPickerWrapper : public RefCounted<EndpointPickerWrapper> {
public:
EndpointPickerWrapper(
UniquePtr<SubchannelPicker> picker,
std::unique_ptr<SubchannelPicker> picker,
RefCountedPtr<XdsClientStats::LocalityStats> locality_stats)
: picker_(std::move(picker)),
locality_stats_(std::move(locality_stats)) {
@ -139,7 +140,7 @@ class XdsLb : public LoadBalancingPolicy {
PickResult Pick(PickArgs args);
private:
UniquePtr<SubchannelPicker> picker_;
std::unique_ptr<SubchannelPicker> picker_;
RefCountedPtr<XdsClientStats::LocalityStats> locality_stats_;
};
@ -180,7 +181,7 @@ class XdsLb : public LoadBalancingPolicy {
RefCountedPtr<SubchannelInterface> CreateSubchannel(
const grpc_channel_args& args) override;
void UpdateState(grpc_connectivity_state state,
UniquePtr<SubchannelPicker> picker) override;
std::unique_ptr<SubchannelPicker> picker) override;
void RequestReresolution() override;
void AddTraceEvent(TraceSeverity severity, StringView message) override;
@ -238,7 +239,7 @@ class XdsLb : public LoadBalancingPolicy {
RefCountedPtr<SubchannelInterface> CreateSubchannel(
const grpc_channel_args& args) override;
void UpdateState(grpc_connectivity_state state,
UniquePtr<SubchannelPicker> picker) override;
std::unique_ptr<SubchannelPicker> picker) override;
// This is a no-op, because we get the addresses from the xds
// client, which is a watch-based API.
void RequestReresolution() override {}
@ -327,8 +328,8 @@ class XdsLb : public LoadBalancingPolicy {
RefCountedPtr<XdsLb> xds_policy_;
Map<RefCountedPtr<XdsLocalityName>, OrphanablePtr<Locality>,
XdsLocalityName::Less>
std::map<RefCountedPtr<XdsLocalityName>, OrphanablePtr<Locality>,
XdsLocalityName::Less>
localities_;
const uint32_t priority_;
grpc_connectivity_state connectivity_state_ = GRPC_CHANNEL_IDLE;
@ -405,7 +406,7 @@ class XdsLb : public LoadBalancingPolicy {
}
// Server name from target URI.
UniquePtr<char> server_name_;
std::unique_ptr<char> server_name_;
// Current channel args and config from the resolver.
const grpc_channel_args* args_ = nullptr;
@ -494,7 +495,7 @@ LoadBalancingPolicy::PickResult XdsLb::EndpointPickerWrapper::Pick(
XdsLb::PickResult XdsLb::LocalityPicker::Pick(PickArgs args) {
// Handle drop.
const UniquePtr<char>* drop_category;
const std::unique_ptr<char>* drop_category;
if (drop_config_->ShouldDrop(&drop_category)) {
xds_policy_->client_stats_.AddCallDropped(*drop_category);
PickResult result;
@ -553,8 +554,8 @@ RefCountedPtr<SubchannelInterface> XdsLb::FallbackHelper::CreateSubchannel(
return parent_->channel_control_helper()->CreateSubchannel(args);
}
void XdsLb::FallbackHelper::UpdateState(grpc_connectivity_state state,
UniquePtr<SubchannelPicker> picker) {
void XdsLb::FallbackHelper::UpdateState(
grpc_connectivity_state state, std::unique_ptr<SubchannelPicker> picker) {
if (parent_->shutting_down_) return;
// If this request is from the pending fallback policy, ignore it until
// it reports READY, at which point we swap it into place.
@ -992,12 +993,12 @@ void XdsLb::UpdateFallbackPolicyLocked() {
OrphanablePtr<LoadBalancingPolicy> XdsLb::CreateFallbackPolicyLocked(
const char* name, const grpc_channel_args* args) {
FallbackHelper* helper =
New<FallbackHelper>(Ref(DEBUG_LOCATION, "FallbackHelper"));
new FallbackHelper(Ref(DEBUG_LOCATION, "FallbackHelper"));
LoadBalancingPolicy::Args lb_policy_args;
lb_policy_args.combiner = combiner();
lb_policy_args.args = args;
lb_policy_args.channel_control_helper =
UniquePtr<ChannelControlHelper>(helper);
std::unique_ptr<ChannelControlHelper>(helper);
OrphanablePtr<LoadBalancingPolicy> lb_policy =
LoadBalancingPolicyRegistry::CreateLoadBalancingPolicy(
name, std::move(lb_policy_args));
@ -1081,7 +1082,7 @@ void XdsLb::PriorityList::UpdateXdsPickerLocked() {
void XdsLb::PriorityList::MaybeCreateLocalityMapLocked(uint32_t priority) {
// Exhausted priorities in the update.
if (!priority_list_update().Contains(priority)) return;
auto new_locality_map = New<LocalityMap>(
auto new_locality_map = new LocalityMap(
xds_policy_->Ref(DEBUG_LOCATION, "XdsLb+LocalityMap"), priority);
priorities_.emplace_back(OrphanablePtr<LocalityMap>(new_locality_map));
new_locality_map->UpdateLocked(*priority_list_update().Find(priority));
@ -1500,12 +1501,12 @@ XdsLb::PriorityList::LocalityMap::Locality::CreateChildPolicyArgsLocked(
OrphanablePtr<LoadBalancingPolicy>
XdsLb::PriorityList::LocalityMap::Locality::CreateChildPolicyLocked(
const char* name, const grpc_channel_args* args) {
Helper* helper = New<Helper>(this->Ref(DEBUG_LOCATION, "Helper"));
Helper* helper = new Helper(this->Ref(DEBUG_LOCATION, "Helper"));
LoadBalancingPolicy::Args lb_policy_args;
lb_policy_args.combiner = xds_policy()->combiner();
lb_policy_args.args = args;
lb_policy_args.channel_control_helper =
UniquePtr<ChannelControlHelper>(helper);
std::unique_ptr<ChannelControlHelper>(helper);
OrphanablePtr<LoadBalancingPolicy> lb_policy =
LoadBalancingPolicyRegistry::CreateLoadBalancingPolicy(
name, std::move(lb_policy_args));
@ -1741,7 +1742,7 @@ XdsLb::PriorityList::LocalityMap::Locality::Helper::CreateSubchannel(
}
void XdsLb::PriorityList::LocalityMap::Locality::Helper::UpdateState(
grpc_connectivity_state state, UniquePtr<SubchannelPicker> picker) {
grpc_connectivity_state state, std::unique_ptr<SubchannelPicker> picker) {
if (locality_->xds_policy()->shutting_down_) return;
// If this request is from the pending child policy, ignore it until
// it reports READY, at which point we swap it into place.
@ -1870,8 +1871,8 @@ class XdsFactory : public LoadBalancingPolicyFactory {
if (error_list.empty()) {
return MakeRefCounted<ParsedXdsConfig>(
std::move(child_policy), std::move(fallback_policy),
UniquePtr<char>(gpr_strdup(eds_service_name)),
UniquePtr<char>(gpr_strdup(lrs_load_reporting_server_name)));
std::unique_ptr<char>(gpr_strdup(eds_service_name)),
std::unique_ptr<char>(gpr_strdup(lrs_load_reporting_server_name)));
} else {
*error = GRPC_ERROR_CREATE_FROM_VECTOR("Xds Parser", &error_list);
return nullptr;

@ -34,7 +34,7 @@ class RegistryState {
RegistryState() {}
void RegisterLoadBalancingPolicyFactory(
UniquePtr<LoadBalancingPolicyFactory> factory) {
std::unique_ptr<LoadBalancingPolicyFactory> factory) {
for (size_t i = 0; i < factories_.size(); ++i) {
GPR_ASSERT(strcmp(factories_[i]->name(), factory->name()) != 0);
}
@ -52,7 +52,7 @@ class RegistryState {
}
private:
InlinedVector<UniquePtr<LoadBalancingPolicyFactory>, 10> factories_;
InlinedVector<std::unique_ptr<LoadBalancingPolicyFactory>, 10> factories_;
};
RegistryState* g_state = nullptr;
@ -64,16 +64,16 @@ RegistryState* g_state = nullptr;
//
void LoadBalancingPolicyRegistry::Builder::InitRegistry() {
if (g_state == nullptr) g_state = New<RegistryState>();
if (g_state == nullptr) g_state = new RegistryState();
}
void LoadBalancingPolicyRegistry::Builder::ShutdownRegistry() {
Delete(g_state);
delete g_state;
g_state = nullptr;
}
void LoadBalancingPolicyRegistry::Builder::RegisterLoadBalancingPolicyFactory(
UniquePtr<LoadBalancingPolicyFactory> factory) {
std::unique_ptr<LoadBalancingPolicyFactory> factory) {
InitRegistry();
g_state->RegisterLoadBalancingPolicyFactory(std::move(factory));
}

@ -41,7 +41,7 @@ class LoadBalancingPolicyRegistry {
/// Registers an LB policy factory. The factory will be used to create an
/// LB policy whose name matches that of the factory.
static void RegisterLoadBalancingPolicyFactory(
UniquePtr<LoadBalancingPolicyFactory> factory);
std::unique_ptr<LoadBalancingPolicyFactory> factory);
};
/// Creates an LB policy of the type specified by \a name.

@ -43,7 +43,7 @@ Subchannel* LocalSubchannelPool::RegisterSubchannel(SubchannelKey* key,
GRPC_SUBCHANNEL_UNREF(constructed, "subchannel_register+found_existing");
} else {
// There hasn't been such subchannel. Add one.
subchannel_map_ = grpc_avl_add(subchannel_map_, New<SubchannelKey>(*key),
subchannel_map_ = grpc_avl_add(subchannel_map_, new SubchannelKey(*key),
constructed, nullptr);
c = constructed;
}
@ -64,12 +64,12 @@ namespace {
void sck_avl_destroy(void* p, void* /*user_data*/) {
SubchannelKey* key = static_cast<SubchannelKey*>(p);
Delete(key);
delete key;
}
void* sck_avl_copy(void* p, void* /*unused*/) {
const SubchannelKey* key = static_cast<const SubchannelKey*>(p);
auto new_key = New<SubchannelKey>(*key);
auto new_key = new SubchannelKey(*key);
return static_cast<void*>(new_key);
}

@ -73,8 +73,8 @@ bool grpc_parse_ipv4_hostport(const char* hostport, grpc_resolved_address* addr,
bool log_errors) {
bool success = false;
// Split host and port.
grpc_core::UniquePtr<char> host;
grpc_core::UniquePtr<char> port;
std::unique_ptr<char> host;
std::unique_ptr<char> port;
if (!grpc_core::SplitHostPort(hostport, &host, &port)) {
if (log_errors) {
gpr_log(GPR_ERROR, "Failed gpr_split_host_port(%s, ...)", hostport);
@ -125,8 +125,8 @@ bool grpc_parse_ipv6_hostport(const char* hostport, grpc_resolved_address* addr,
bool log_errors) {
bool success = false;
// Split host and port.
grpc_core::UniquePtr<char> host;
grpc_core::UniquePtr<char> port;
std::unique_ptr<char> host;
std::unique_ptr<char> port;
if (!grpc_core::SplitHostPort(hostport, &host, &port)) {
if (log_errors) {
gpr_log(GPR_ERROR, "Failed gpr_split_host_port(%s, ...)", hostport);

@ -30,7 +30,8 @@ namespace grpc_core {
// Resolver
//
Resolver::Resolver(Combiner* combiner, UniquePtr<ResultHandler> result_handler)
Resolver::Resolver(Combiner* combiner,
std::unique_ptr<ResultHandler> result_handler)
: InternallyRefCounted(&grpc_trace_resolver_refcount),
result_handler_(std::move(result_handler)),
combiner_(GRPC_COMBINER_REF(combiner, "resolver")) {}

@ -127,7 +127,7 @@ class Resolver : public InternallyRefCounted<Resolver> {
// API should change to take a RefCountedPtr<>, so that we always take
// ownership of a new ref.
explicit Resolver(Combiner* combiner,
UniquePtr<ResultHandler> result_handler);
std::unique_ptr<ResultHandler> result_handler);
/// Shuts down the resolver.
virtual void ShutdownLocked() = 0;
@ -137,7 +137,7 @@ class Resolver : public InternallyRefCounted<Resolver> {
ResultHandler* result_handler() const { return result_handler_.get(); }
private:
UniquePtr<ResultHandler> result_handler_;
std::unique_ptr<ResultHandler> result_handler_;
Combiner* combiner_;
};

@ -108,7 +108,7 @@ class AresDnsResolver : public Resolver {
/// retry backoff state
BackOff backoff_;
/// currently resolving addresses
UniquePtr<ServerAddressList> addresses_;
std::unique_ptr<ServerAddressList> addresses_;
/// currently resolving service config
char* service_config_json_ = nullptr;
// has shutdown been initiated
@ -496,8 +496,7 @@ static bool should_use_ares(const char* resolver_env) {
static bool g_use_ares_dns_resolver;
void grpc_resolver_dns_ares_init() {
grpc_core::UniquePtr<char> resolver =
GPR_GLOBAL_CONFIG_GET(grpc_dns_resolver);
std::unique_ptr<char> resolver = GPR_GLOBAL_CONFIG_GET(grpc_dns_resolver);
if (should_use_ares(resolver.get())) {
g_use_ares_dns_resolver = true;
gpr_log(GPR_DEBUG, "Using ares dns resolver");

@ -77,7 +77,7 @@ struct grpc_ares_ev_driver {
/** request object that's using this ev driver */
grpc_ares_request* request;
/** Owned by the ev_driver. Creates new GrpcPolledFd's */
grpc_core::UniquePtr<grpc_core::GrpcPolledFdFactory> polled_fd_factory;
std::unique_ptr<grpc_core::GrpcPolledFdFactory> polled_fd_factory;
/** query timeout in milliseconds */
int query_timeout_ms;
/** alarm to cancel active queries */
@ -110,7 +110,7 @@ static void grpc_ares_ev_driver_unref(grpc_ares_ev_driver* ev_driver) {
GRPC_COMBINER_UNREF(ev_driver->combiner, "free ares event driver");
ares_destroy(ev_driver->channel);
grpc_ares_complete_request_locked(ev_driver->request);
grpc_core::Delete(ev_driver);
delete ev_driver;
}
}
@ -120,7 +120,7 @@ static void fd_node_destroy_locked(fd_node* fdn) {
GPR_ASSERT(!fdn->readable_registered);
GPR_ASSERT(!fdn->writable_registered);
GPR_ASSERT(fdn->already_shutdown);
grpc_core::Delete(fdn->grpc_polled_fd);
delete fdn->grpc_polled_fd;
gpr_free(fdn);
}
@ -148,7 +148,7 @@ grpc_error* grpc_ares_ev_driver_create_locked(grpc_ares_ev_driver** ev_driver,
int query_timeout_ms,
grpc_core::Combiner* combiner,
grpc_ares_request* request) {
*ev_driver = grpc_core::New<grpc_ares_ev_driver>();
*ev_driver = new grpc_ares_ev_driver();
ares_options opts;
memset(&opts, 0, sizeof(opts));
opts.flags |= ARES_FLAG_STAYOPEN;

@ -95,7 +95,7 @@ class GrpcPolledFdFactory {
virtual void ConfigureAresChannelLocked(ares_channel channel) = 0;
};
UniquePtr<GrpcPolledFdFactory> NewGrpcPolledFdFactory(Combiner* combiner);
std::unique_ptr<GrpcPolledFdFactory> NewGrpcPolledFdFactory(Combiner* combiner);
} // namespace grpc_core

@ -37,14 +37,14 @@ namespace grpc_core {
void ares_uv_poll_cb(uv_poll_t* handle, int status, int events);
void ares_uv_poll_close_cb(uv_handle_t* handle) { Delete(handle); }
void ares_uv_poll_close_cb(uv_handle_t* handle) { delete handle; }
class GrpcPolledFdLibuv : public GrpcPolledFd {
public:
GrpcPolledFdLibuv(ares_socket_t as, Combiner* combiner)
: as_(as), combiner_(combiner) {
gpr_asprintf(&name_, "c-ares socket: %" PRIdPTR, (intptr_t)as);
handle_ = New<uv_poll_t>();
handle_ = new uv_poll_t();
uv_poll_init_socket(uv_default_loop(), handle_, as);
handle_->data = this;
GRPC_COMBINER_REF(combiner_, "libuv ares event driver");
@ -81,10 +81,12 @@ class GrpcPolledFdLibuv : public GrpcPolledFd {
uv_poll_stop(handle_);
uv_close(reinterpret_cast<uv_handle_t*>(handle_), ares_uv_poll_close_cb);
if (read_closure_ != nullptr) {
GRPC_CLOSURE_SCHED(read_closure_, GRPC_ERROR_CANCELLED);
grpc_core::ExecCtx::Run(DEBUG_LOCATION, read_closure_,
GRPC_ERROR_CANCELLED);
}
if (write_closure_ != nullptr) {
GRPC_CLOSURE_SCHED(write_closure_, GRPC_ERROR_CANCELLED);
grpc_core::ExecCtx::Run(DEBUG_LOCATION, write_closure_,
GRPC_ERROR_CANCELLED);
}
}
@ -120,7 +122,7 @@ struct AresUvPollCbArg {
};
static void ares_uv_poll_cb_locked(void* arg, grpc_error* error) {
grpc_core::UniquePtr<AresUvPollCbArg> arg_struct(
std::unique_ptr<AresUvPollCbArg> arg_struct(
reinterpret_cast<AresUvPollCbArg*>(arg));
uv_poll_t* handle = arg_struct->handle;
int status = arg_struct->status;
@ -135,13 +137,13 @@ static void ares_uv_poll_cb_locked(void* arg, grpc_error* error) {
}
if (events & UV_READABLE) {
GPR_ASSERT(polled_fd->read_closure_ != nullptr);
GRPC_CLOSURE_SCHED(polled_fd->read_closure_, error);
grpc_core::ExecCtx::Run(DEBUG_LOCATION, polled_fd->read_closure_, error);
polled_fd->read_closure_ = nullptr;
polled_fd->poll_events_ &= ~UV_READABLE;
}
if (events & UV_WRITABLE) {
GPR_ASSERT(polled_fd->write_closure_ != nullptr);
GRPC_CLOSURE_SCHED(polled_fd->write_closure_, error);
grpc_core::ExecCtx::Run(DEBUG_LOCATION, polled_fd->write_closure_, error);
polled_fd->write_closure_ = nullptr;
polled_fd->poll_events_ &= ~UV_WRITABLE;
}
@ -152,7 +154,7 @@ void ares_uv_poll_cb(uv_poll_t* handle, int status, int events) {
grpc_core::ExecCtx exec_ctx;
GrpcPolledFdLibuv* polled_fd =
reinterpret_cast<GrpcPolledFdLibuv*>(handle->data);
AresUvPollCbArg* arg = New<AresUvPollCbArg>(handle, status, events);
AresUvPollCbArg* arg = new AresUvPollCbArg(handle, status, events);
polled_fd->combiner_->Run(
GRPC_CLOSURE_CREATE(ares_uv_poll_cb_locked, arg, nullptr),
GRPC_ERROR_NONE);
@ -163,13 +165,14 @@ class GrpcPolledFdFactoryLibuv : public GrpcPolledFdFactory {
GrpcPolledFd* NewGrpcPolledFdLocked(ares_socket_t as,
grpc_pollset_set* driver_pollset_set,
Combiner* combiner) override {
return New<GrpcPolledFdLibuv>(as, combiner);
return new GrpcPolledFdLibuv(as, combiner);
}
void ConfigureAresChannelLocked(ares_channel channel) override {}
};
UniquePtr<GrpcPolledFdFactory> NewGrpcPolledFdFactory(Combiner* combiner) {
std::unique_ptr<GrpcPolledFdFactory> NewGrpcPolledFdFactory(
Combiner* combiner) {
return MakeUnique<GrpcPolledFdFactoryLibuv>();
}

@ -91,13 +91,14 @@ class GrpcPolledFdFactoryPosix : public GrpcPolledFdFactory {
GrpcPolledFd* NewGrpcPolledFdLocked(ares_socket_t as,
grpc_pollset_set* driver_pollset_set,
Combiner* /*combiner*/) override {
return New<GrpcPolledFdPosix>(as, driver_pollset_set);
return new GrpcPolledFdPosix(as, driver_pollset_set);
}
void ConfigureAresChannelLocked(ares_channel /*channel*/) override {}
};
UniquePtr<GrpcPolledFdFactory> NewGrpcPolledFdFactory(Combiner* /*combiner*/) {
std::unique_ptr<GrpcPolledFdFactory> NewGrpcPolledFdFactory(
Combiner* /*combiner*/) {
return MakeUnique<GrpcPolledFdFactoryPosix>();
}

@ -128,12 +128,12 @@ class GrpcPolledFdWindows {
}
void ScheduleAndNullReadClosure(grpc_error* error) {
GRPC_CLOSURE_SCHED(read_closure_, error);
grpc_core::ExecCtx::Run(DEBUG_LOCATION, read_closure_, error);
read_closure_ = nullptr;
}
void ScheduleAndNullWriteClosure(grpc_error* error) {
GRPC_CLOSURE_SCHED(write_closure_, error);
grpc_core::ExecCtx::Run(DEBUG_LOCATION, write_closure_, error);
write_closure_ = nullptr;
}
@ -752,7 +752,7 @@ class SockToPolledFdMap {
}
void AddNewSocket(SOCKET s, GrpcPolledFdWindows* polled_fd) {
SockToPolledFdEntry* new_node = New<SockToPolledFdEntry>(s, polled_fd);
SockToPolledFdEntry* new_node = new SockToPolledFdEntry(s, polled_fd);
new_node->next = head_;
head_ = new_node;
}
@ -775,7 +775,7 @@ class SockToPolledFdMap {
node = node->next) {
if (node->socket == s) {
*prev = node->next;
Delete(node);
delete node;
return;
}
prev = &node->next;
@ -805,7 +805,7 @@ class SockToPolledFdMap {
}
grpc_tcp_set_non_block(s);
GrpcPolledFdWindows* polled_fd =
New<GrpcPolledFdWindows>(s, map->combiner_, af, type);
new GrpcPolledFdWindows(s, map->combiner_, af, type);
GRPC_CARES_TRACE_LOG(
"fd:|%s| created with params af:%d type:%d protocol:%d",
polled_fd->GetName(), af, type, protocol);
@ -855,7 +855,7 @@ class SockToPolledFdMap {
"Shut down c-ares fd before without it ever having made it into the "
"driver's list"));
}
grpc_core::Delete(polled_fd);
delete polled_fd;
return 0;
}
@ -920,7 +920,7 @@ class GrpcPolledFdFactoryWindows : public GrpcPolledFdFactory {
// Set a flag so that the virtual socket "close" method knows it
// doesn't need to call ShutdownLocked, since now the driver will.
polled_fd->set_gotten_into_driver_list();
return grpc_core::New<GrpcPolledFdWindowsWrapper>(polled_fd);
return new GrpcPolledFdWindowsWrapper(polled_fd);
}
void ConfigureAresChannelLocked(ares_channel channel) override {
@ -932,7 +932,8 @@ class GrpcPolledFdFactoryWindows : public GrpcPolledFdFactory {
SockToPolledFdMap sock_to_polled_fd_map_;
};
UniquePtr<GrpcPolledFdFactory> NewGrpcPolledFdFactory(Combiner* combiner) {
std::unique_ptr<GrpcPolledFdFactory> NewGrpcPolledFdFactory(
Combiner* combiner) {
return MakeUnique<GrpcPolledFdFactoryWindows>(combiner);
}

@ -59,7 +59,7 @@ struct grpc_ares_request {
/** closure to call when the request completes */
grpc_closure* on_done;
/** the pointer to receive the resolved addresses */
grpc_core::UniquePtr<grpc_core::ServerAddressList>* addresses_out;
std::unique_ptr<grpc_core::ServerAddressList>* addresses_out;
/** the pointer to receive the service config in JSON */
char** service_config_json_out;
/** the evernt driver used by this request */
@ -148,7 +148,7 @@ void grpc_ares_complete_request_locked(grpc_ares_request* r) {
// TODO(apolcyn): allow c-ares to return a service config
// with no addresses along side it
}
GRPC_CLOSURE_SCHED(r->on_done, r->error);
grpc_core::ExecCtx::Run(DEBUG_LOCATION, r->on_done, r->error);
}
static grpc_ares_hostbyname_request* create_hostbyname_request_locked(
@ -355,8 +355,8 @@ void grpc_dns_lookup_ares_continue_after_check_localhost_and_ip_literals_locked(
grpc_ares_hostbyname_request* hr = nullptr;
ares_channel* channel = nullptr;
/* parse name, splitting it into host and port parts */
grpc_core::UniquePtr<char> host;
grpc_core::UniquePtr<char> port;
std::unique_ptr<char> host;
std::unique_ptr<char> port;
grpc_core::SplitHostPort(name, &host, &port);
if (host == nullptr) {
error = grpc_error_set_str(
@ -447,14 +447,14 @@ void grpc_dns_lookup_ares_continue_after_check_localhost_and_ip_literals_locked(
return;
error_cleanup:
GRPC_CLOSURE_SCHED(r->on_done, error);
grpc_core::ExecCtx::Run(DEBUG_LOCATION, r->on_done, error);
}
static bool inner_resolve_as_ip_literal_locked(
const char* name, const char* default_port,
grpc_core::UniquePtr<grpc_core::ServerAddressList>* addrs,
grpc_core::UniquePtr<char>* host, grpc_core::UniquePtr<char>* port,
grpc_core::UniquePtr<char>* hostport) {
std::unique_ptr<grpc_core::ServerAddressList>* addrs,
std::unique_ptr<char>* host, std::unique_ptr<char>* port,
std::unique_ptr<char>* hostport) {
grpc_core::SplitHostPort(name, host, port);
if (*host == nullptr) {
gpr_log(GPR_ERROR,
@ -489,18 +489,18 @@ static bool inner_resolve_as_ip_literal_locked(
static bool resolve_as_ip_literal_locked(
const char* name, const char* default_port,
grpc_core::UniquePtr<grpc_core::ServerAddressList>* addrs) {
grpc_core::UniquePtr<char> host;
grpc_core::UniquePtr<char> port;
grpc_core::UniquePtr<char> hostport;
std::unique_ptr<grpc_core::ServerAddressList>* addrs) {
std::unique_ptr<char> host;
std::unique_ptr<char> port;
std::unique_ptr<char> hostport;
bool out = inner_resolve_as_ip_literal_locked(name, default_port, addrs,
&host, &port, &hostport);
return out;
}
static bool target_matches_localhost_inner(const char* name,
grpc_core::UniquePtr<char>* host,
grpc_core::UniquePtr<char>* port) {
std::unique_ptr<char>* host,
std::unique_ptr<char>* port) {
if (!grpc_core::SplitHostPort(name, host, port)) {
gpr_log(GPR_ERROR, "Unable to split host and port for name: %s", name);
return false;
@ -513,16 +513,16 @@ static bool target_matches_localhost_inner(const char* name,
}
static bool target_matches_localhost(const char* name) {
grpc_core::UniquePtr<char> host;
grpc_core::UniquePtr<char> port;
std::unique_ptr<char> host;
std::unique_ptr<char> port;
return target_matches_localhost_inner(name, &host, &port);
}
#ifdef GRPC_ARES_RESOLVE_LOCALHOST_MANUALLY
static bool inner_maybe_resolve_localhost_manually_locked(
const char* name, const char* default_port,
grpc_core::UniquePtr<grpc_core::ServerAddressList>* addrs,
grpc_core::UniquePtr<char>* host, grpc_core::UniquePtr<char>* port) {
std::unique_ptr<grpc_core::ServerAddressList>* addrs,
std::unique_ptr<char>* host, std::unique_ptr<char>* port) {
grpc_core::SplitHostPort(name, host, port);
if (*host == nullptr) {
gpr_log(GPR_ERROR,
@ -571,16 +571,16 @@ static bool inner_maybe_resolve_localhost_manually_locked(
static bool grpc_ares_maybe_resolve_localhost_manually_locked(
const char* name, const char* default_port,
grpc_core::UniquePtr<grpc_core::ServerAddressList>* addrs) {
grpc_core::UniquePtr<char> host;
grpc_core::UniquePtr<char> port;
std::unique_ptr<grpc_core::ServerAddressList>* addrs) {
std::unique_ptr<char> host;
std::unique_ptr<char> port;
return inner_maybe_resolve_localhost_manually_locked(name, default_port,
addrs, &host, &port);
}
#else /* GRPC_ARES_RESOLVE_LOCALHOST_MANUALLY */
static bool grpc_ares_maybe_resolve_localhost_manually_locked(
const char* /*name*/, const char* /*default_port*/,
grpc_core::UniquePtr<grpc_core::ServerAddressList>* /*addrs*/) {
std::unique_ptr<grpc_core::ServerAddressList>* /*addrs*/) {
return false;
}
#endif /* GRPC_ARES_RESOLVE_LOCALHOST_MANUALLY */
@ -588,8 +588,8 @@ static bool grpc_ares_maybe_resolve_localhost_manually_locked(
static grpc_ares_request* grpc_dns_lookup_ares_locked_impl(
const char* dns_server, const char* name, const char* default_port,
grpc_pollset_set* interested_parties, grpc_closure* on_done,
grpc_core::UniquePtr<grpc_core::ServerAddressList>* addrs,
bool check_grpclb, char** service_config_json, int query_timeout_ms,
std::unique_ptr<grpc_core::ServerAddressList>* addrs, bool check_grpclb,
char** service_config_json, int query_timeout_ms,
grpc_core::Combiner* combiner) {
grpc_ares_request* r =
static_cast<grpc_ares_request*>(gpr_zalloc(sizeof(grpc_ares_request)));
@ -631,8 +631,8 @@ static grpc_ares_request* grpc_dns_lookup_ares_locked_impl(
grpc_ares_request* (*grpc_dns_lookup_ares_locked)(
const char* dns_server, const char* name, const char* default_port,
grpc_pollset_set* interested_parties, grpc_closure* on_done,
grpc_core::UniquePtr<grpc_core::ServerAddressList>* addrs,
bool check_grpclb, char** service_config_json, int query_timeout_ms,
std::unique_ptr<grpc_core::ServerAddressList>* addrs, bool check_grpclb,
char** service_config_json, int query_timeout_ms,
grpc_core::Combiner* combiner) = grpc_dns_lookup_ares_locked_impl;
static void grpc_cancel_ares_request_locked_impl(grpc_ares_request* r) {
@ -678,7 +678,7 @@ typedef struct grpc_resolve_address_ares_request {
/** the pointer to receive the resolved addresses */
grpc_resolved_addresses** addrs_out;
/** currently resolving addresses */
grpc_core::UniquePtr<ServerAddressList> addresses;
std::unique_ptr<ServerAddressList> addresses;
/** closure to call when the resolve_address_ares request completes */
grpc_closure* on_resolve_address_done;
/** a closure wrapping on_resolve_address_done, which should be invoked when
@ -714,9 +714,10 @@ static void on_dns_lookup_done_locked(void* arg, grpc_error* error) {
sizeof(grpc_resolved_address));
}
}
GRPC_CLOSURE_SCHED(r->on_resolve_address_done, GRPC_ERROR_REF(error));
grpc_core::ExecCtx::Run(DEBUG_LOCATION, r->on_resolve_address_done,
GRPC_ERROR_REF(error));
GRPC_COMBINER_UNREF(r->combiner, "on_dns_lookup_done_cb");
grpc_core::Delete(r);
delete r;
}
static void on_dns_lookup_done(void* arg, grpc_error* error) {
@ -746,7 +747,7 @@ static void grpc_resolve_address_ares_impl(const char* name,
grpc_closure* on_done,
grpc_resolved_addresses** addrs) {
grpc_resolve_address_ares_request* r =
grpc_core::New<grpc_resolve_address_ares_request>();
new grpc_resolve_address_ares_request();
r->combiner = grpc_combiner_create();
r->addrs_out = addrs;
r->on_resolve_address_done = on_done;

@ -63,8 +63,8 @@ extern void (*grpc_resolve_address_ares)(const char* name,
extern grpc_ares_request* (*grpc_dns_lookup_ares_locked)(
const char* dns_server, const char* name, const char* default_port,
grpc_pollset_set* interested_parties, grpc_closure* on_done,
grpc_core::UniquePtr<grpc_core::ServerAddressList>* addresses,
bool check_grpclb, char** service_config_json, int query_timeout_ms,
std::unique_ptr<grpc_core::ServerAddressList>* addresses, bool check_grpclb,
char** service_config_json, int query_timeout_ms,
grpc_core::Combiner* combiner);
/* Cancel the pending grpc_ares_request \a request */

@ -29,8 +29,8 @@ struct grpc_ares_request {
static grpc_ares_request* grpc_dns_lookup_ares_locked_impl(
const char* dns_server, const char* name, const char* default_port,
grpc_pollset_set* interested_parties, grpc_closure* on_done,
grpc_core::UniquePtr<grpc_core::ServerAddressList>* addrs,
bool check_grpclb, char** service_config_json, int query_timeout_ms,
std::unique_ptr<grpc_core::ServerAddressList>* addrs, bool check_grpclb,
char** service_config_json, int query_timeout_ms,
grpc_core::Combiner* combiner) {
return NULL;
}
@ -38,8 +38,8 @@ static grpc_ares_request* grpc_dns_lookup_ares_locked_impl(
grpc_ares_request* (*grpc_dns_lookup_ares_locked)(
const char* dns_server, const char* name, const char* default_port,
grpc_pollset_set* interested_parties, grpc_closure* on_done,
grpc_core::UniquePtr<grpc_core::ServerAddressList>* addrs,
bool check_grpclb, char** service_config_json, int query_timeout_ms,
std::unique_ptr<grpc_core::ServerAddressList>* addrs, bool check_grpclb,
char** service_config_json, int query_timeout_ms,
grpc_core::Combiner* combiner) = grpc_dns_lookup_ares_locked_impl;
static void grpc_cancel_ares_request_locked_impl(grpc_ares_request* r) {}

@ -300,8 +300,7 @@ class NativeDnsResolverFactory : public ResolverFactory {
} // namespace grpc_core
void grpc_resolver_dns_native_init() {
grpc_core::UniquePtr<char> resolver =
GPR_GLOBAL_CONFIG_GET(grpc_dns_resolver);
std::unique_ptr<char> resolver = GPR_GLOBAL_CONFIG_GET(grpc_dns_resolver);
if (gpr_stricmp(resolver.get(), "native") == 0) {
gpr_log(GPR_DEBUG, "Using native dns resolver");
grpc_core::ResolverRegistry::Builder::RegisterResolverFactory(

@ -191,7 +191,7 @@ void FakeResolverResponseGenerator::SetResponseLocked(void* arg,
resolver->has_next_result_ = true;
resolver->MaybeSendResultLocked();
}
Delete(closure_arg);
delete closure_arg;
}
void FakeResolverResponseGenerator::SetResponse(Resolver::Result result) {
@ -205,7 +205,7 @@ void FakeResolverResponseGenerator::SetResponse(Resolver::Result result) {
}
resolver = resolver_->Ref();
}
SetResponseClosureArg* closure_arg = New<SetResponseClosureArg>();
SetResponseClosureArg* closure_arg = new SetResponseClosureArg();
closure_arg->resolver = std::move(resolver);
closure_arg->result = std::move(result);
closure_arg->resolver->combiner()->Run(
@ -222,7 +222,7 @@ void FakeResolverResponseGenerator::SetReresolutionResponseLocked(
resolver->reresolution_result_ = std::move(closure_arg->result);
resolver->has_reresolution_result_ = closure_arg->has_result;
}
Delete(closure_arg);
delete closure_arg;
}
void FakeResolverResponseGenerator::SetReresolutionResponse(
@ -233,7 +233,7 @@ void FakeResolverResponseGenerator::SetReresolutionResponse(
GPR_ASSERT(resolver_ != nullptr);
resolver = resolver_->Ref();
}
SetResponseClosureArg* closure_arg = New<SetResponseClosureArg>();
SetResponseClosureArg* closure_arg = new SetResponseClosureArg();
closure_arg->resolver = std::move(resolver);
closure_arg->result = std::move(result);
closure_arg->has_result = true;
@ -250,7 +250,7 @@ void FakeResolverResponseGenerator::UnsetReresolutionResponse() {
GPR_ASSERT(resolver_ != nullptr);
resolver = resolver_->Ref();
}
SetResponseClosureArg* closure_arg = New<SetResponseClosureArg>();
SetResponseClosureArg* closure_arg = new SetResponseClosureArg();
closure_arg->resolver = std::move(resolver);
closure_arg->resolver->combiner()->Run(
GRPC_CLOSURE_INIT(&closure_arg->set_response_closure,
@ -266,7 +266,7 @@ void FakeResolverResponseGenerator::SetFailureLocked(void* arg,
resolver->return_failure_ = true;
if (closure_arg->immediate) resolver->MaybeSendResultLocked();
}
Delete(closure_arg);
delete closure_arg;
}
void FakeResolverResponseGenerator::SetFailure() {
@ -276,7 +276,7 @@ void FakeResolverResponseGenerator::SetFailure() {
GPR_ASSERT(resolver_ != nullptr);
resolver = resolver_->Ref();
}
SetResponseClosureArg* closure_arg = New<SetResponseClosureArg>();
SetResponseClosureArg* closure_arg = new SetResponseClosureArg();
closure_arg->resolver = std::move(resolver);
closure_arg->resolver->combiner()->Run(
GRPC_CLOSURE_INIT(&closure_arg->set_response_closure, SetFailureLocked,
@ -291,7 +291,7 @@ void FakeResolverResponseGenerator::SetFailureOnReresolution() {
GPR_ASSERT(resolver_ != nullptr);
resolver = resolver_->Ref();
}
SetResponseClosureArg* closure_arg = New<SetResponseClosureArg>();
SetResponseClosureArg* closure_arg = new SetResponseClosureArg();
closure_arg->resolver = std::move(resolver);
closure_arg->immediate = false;
closure_arg->resolver->combiner()->Run(
@ -306,7 +306,7 @@ void FakeResolverResponseGenerator::SetFakeResolver(
resolver_ = std::move(resolver);
if (resolver_ == nullptr) return;
if (has_result_) {
SetResponseClosureArg* closure_arg = New<SetResponseClosureArg>();
SetResponseClosureArg* closure_arg = new SetResponseClosureArg();
closure_arg->resolver = resolver_->Ref();
closure_arg->result = std::move(result_);
resolver_->combiner()->Run(

@ -97,7 +97,8 @@ bool ParseUri(const grpc_uri* uri,
bool errors_found = false;
for (size_t i = 0; i < path_parts.count; i++) {
grpc_uri ith_uri = *uri;
UniquePtr<char> part_str(grpc_slice_to_c_string(path_parts.slices[i]));
std::unique_ptr<char> part_str(
grpc_slice_to_c_string(path_parts.slices[i]));
ith_uri.path = part_str.get();
grpc_resolved_address addr;
if (!parse(&ith_uri, &addr)) {
@ -160,8 +161,8 @@ class UnixResolverFactory : public ResolverFactory {
return CreateSockaddrResolver(std::move(args), grpc_parse_unix);
}
UniquePtr<char> GetDefaultAuthority(grpc_uri* /*uri*/) const override {
return UniquePtr<char>(gpr_strdup("localhost"));
std::unique_ptr<char> GetDefaultAuthority(grpc_uri* /*uri*/) const override {
return std::unique_ptr<char>(gpr_strdup("localhost"));
}
const char* scheme() const override { return "unix"; }

@ -60,7 +60,7 @@ class XdsResolver : public Resolver {
RefCountedPtr<XdsResolver> resolver_;
};
UniquePtr<char> server_name_;
std::unique_ptr<char> server_name_;
const grpc_channel_args* args_;
grpc_pollset_set* interested_parties_;
OrphanablePtr<XdsClient> xds_client_;

@ -41,7 +41,7 @@ struct ResolverArgs {
/// The combiner under which all resolver calls will be run.
Combiner* combiner = nullptr;
/// The result handler to be used by the resolver.
UniquePtr<Resolver::ResultHandler> result_handler;
std::unique_ptr<Resolver::ResultHandler> result_handler;
};
class ResolverFactory {
@ -55,10 +55,10 @@ class ResolverFactory {
/// Returns a string representing the default authority to use for this
/// scheme.
virtual UniquePtr<char> GetDefaultAuthority(grpc_uri* uri) const {
virtual std::unique_ptr<char> GetDefaultAuthority(grpc_uri* uri) const {
const char* path = uri->path;
if (path[0] == '/') ++path;
return UniquePtr<char>(gpr_strdup(path));
return std::unique_ptr<char>(gpr_strdup(path));
}
/// Returns the URI scheme that this factory implements.

@ -40,7 +40,7 @@ class RegistryState {
default_prefix_.reset(gpr_strdup(default_resolver_prefix));
}
void RegisterResolverFactory(UniquePtr<ResolverFactory> factory) {
void RegisterResolverFactory(std::unique_ptr<ResolverFactory> factory) {
for (size_t i = 0; i < factories_.size(); ++i) {
GPR_ASSERT(strcmp(factories_[i]->scheme(), factory->scheme()) != 0);
}
@ -90,8 +90,8 @@ class RegistryState {
// more factories are needed and the additional allocations are
// hurting performance (which is unlikely, since these allocations
// only occur at gRPC initialization time).
InlinedVector<UniquePtr<ResolverFactory>, 10> factories_;
UniquePtr<char> default_prefix_;
InlinedVector<std::unique_ptr<ResolverFactory>, 10> factories_;
std::unique_ptr<char> default_prefix_;
};
static RegistryState* g_state = nullptr;
@ -103,11 +103,11 @@ static RegistryState* g_state = nullptr;
//
void ResolverRegistry::Builder::InitRegistry() {
if (g_state == nullptr) g_state = New<RegistryState>();
if (g_state == nullptr) g_state = new RegistryState();
}
void ResolverRegistry::Builder::ShutdownRegistry() {
Delete(g_state);
delete g_state;
g_state = nullptr;
}
@ -118,7 +118,7 @@ void ResolverRegistry::Builder::SetDefaultPrefix(
}
void ResolverRegistry::Builder::RegisterResolverFactory(
UniquePtr<ResolverFactory> factory) {
std::unique_ptr<ResolverFactory> factory) {
InitRegistry();
g_state->RegisterResolverFactory(std::move(factory));
}
@ -146,7 +146,7 @@ bool ResolverRegistry::IsValidTarget(const char* target) {
OrphanablePtr<Resolver> ResolverRegistry::CreateResolver(
const char* target, const grpc_channel_args* args,
grpc_pollset_set* pollset_set, Combiner* combiner,
UniquePtr<Resolver::ResultHandler> result_handler) {
std::unique_ptr<Resolver::ResultHandler> result_handler) {
GPR_ASSERT(g_state != nullptr);
grpc_uri* uri = nullptr;
char* canonical_target = nullptr;
@ -166,27 +166,29 @@ OrphanablePtr<Resolver> ResolverRegistry::CreateResolver(
return resolver;
}
UniquePtr<char> ResolverRegistry::GetDefaultAuthority(const char* target) {
std::unique_ptr<char> ResolverRegistry::GetDefaultAuthority(
const char* target) {
GPR_ASSERT(g_state != nullptr);
grpc_uri* uri = nullptr;
char* canonical_target = nullptr;
ResolverFactory* factory =
g_state->FindResolverFactory(target, &uri, &canonical_target);
UniquePtr<char> authority =
std::unique_ptr<char> authority =
factory == nullptr ? nullptr : factory->GetDefaultAuthority(uri);
grpc_uri_destroy(uri);
gpr_free(canonical_target);
return authority;
}
UniquePtr<char> ResolverRegistry::AddDefaultPrefixIfNeeded(const char* target) {
std::unique_ptr<char> ResolverRegistry::AddDefaultPrefixIfNeeded(
const char* target) {
GPR_ASSERT(g_state != nullptr);
grpc_uri* uri = nullptr;
char* canonical_target = nullptr;
g_state->FindResolverFactory(target, &uri, &canonical_target);
grpc_uri_destroy(uri);
return UniquePtr<char>(canonical_target == nullptr ? gpr_strdup(target)
: canonical_target);
return std::unique_ptr<char>(canonical_target == nullptr ? gpr_strdup(target)
: canonical_target);
}
} // namespace grpc_core

@ -47,7 +47,8 @@ class ResolverRegistry {
/// Registers a resolver factory. The factory will be used to create a
/// resolver for any URI whose scheme matches that of the factory.
/// Calls InitRegistry() if it has not already been called.
static void RegisterResolverFactory(UniquePtr<ResolverFactory> factory);
static void RegisterResolverFactory(
std::unique_ptr<ResolverFactory> factory);
};
/// Checks whether the user input \a target is valid to create a resolver.
@ -69,13 +70,13 @@ class ResolverRegistry {
static OrphanablePtr<Resolver> CreateResolver(
const char* target, const grpc_channel_args* args,
grpc_pollset_set* pollset_set, Combiner* combiner,
UniquePtr<Resolver::ResultHandler> result_handler);
std::unique_ptr<Resolver::ResultHandler> result_handler);
/// Returns the default authority to pass from a client for \a target.
static UniquePtr<char> GetDefaultAuthority(const char* target);
static std::unique_ptr<char> GetDefaultAuthority(const char* target);
/// Returns \a target with the default prefix prepended, if needed.
static UniquePtr<char> AddDefaultPrefixIfNeeded(const char* target);
static std::unique_ptr<char> AddDefaultPrefixIfNeeded(const char* target);
/// Returns the resolver factory for \a scheme.
/// Caller does NOT own the return value.

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save