aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2018-03-01 20:45:26 -0800
committerGravatar ncteisen <ncteisen@gmail.com>2018-03-01 20:45:26 -0800
commitbf5237a723501c3a0c6324f7d8662b2759bfb816 (patch)
tree7947bafa15dd6f72c72f2a1d62e1755844c7035e /src/core
parent240fbf9fd60fd2b61e0c0ddd937ab5bb891f59ef (diff)
reviewer comments
Diffstat (limited to 'src/core')
-rw-r--r--src/core/lib/channel/object_registry.cc5
-rw-r--r--src/core/lib/channel/object_registry.h9
-rw-r--r--src/core/lib/surface/channel.cc6
-rw-r--r--src/core/lib/surface/channel.h8
4 files changed, 14 insertions, 14 deletions
diff --git a/src/core/lib/channel/object_registry.cc b/src/core/lib/channel/object_registry.cc
index ef2aa1d591..108552a3c6 100644
--- a/src/core/lib/channel/object_registry.cc
+++ b/src/core/lib/channel/object_registry.cc
@@ -18,6 +18,7 @@
#include "src/core/lib/channel/object_registry.h"
#include "src/core/lib/avl/avl.h"
+#include "src/core/lib/gpr/useful.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -25,7 +26,7 @@
// file global lock and avl.
static gpr_mu g_mu;
static grpc_avl g_avl;
-static intptr_t g_uuid = 0;
+static gpr_atm g_uuid = 0;
typedef struct {
void* object;
@@ -37,7 +38,7 @@ typedef struct {
static void destroy_intptr(void* not_used, void* user_data) {}
static void* copy_intptr(void* key, void* user_data) { return key; }
static long compare_intptr(void* key1, void* key2, void* user_data) {
- return (intptr_t)key1 - (intptr_t)key2;
+ return GPR_ICMP(key1, key2);
}
static void destroy_tracker(void* tracker, void* user_data) {
diff --git a/src/core/lib/channel/object_registry.h b/src/core/lib/channel/object_registry.h
index 744bbd8e99..2747522cc1 100644
--- a/src/core/lib/channel/object_registry.h
+++ b/src/core/lib/channel/object_registry.h
@@ -21,7 +21,10 @@
#include <stdint.h>
-// Different types that may be stored in the general object registry
+// TODO(ncteisen): convert this file to C++
+
+// Different types that may be stored in the general object registry. For now,
+// the only use case is channel tracers, but the design has been left general.
typedef enum {
// Used to hold uuid -> ChannelTracer mappings to allow for the trace data
// to be looked up by uuid, rather then have to walk the entire tree of
@@ -34,9 +37,13 @@ typedef enum {
void grpc_object_registry_init();
void grpc_object_registry_shutdown();
+// globally registers the object. Returns its unique uuid
intptr_t grpc_object_registry_register_object(void* object,
grpc_object_registry_type type);
+// globally unregisters the object that is associated to uuid.
void grpc_object_registry_unregister_object(intptr_t uuid);
+// if object with uuid has previously been registered, stores it in *object.
+// if not, returns GRPC_OBJECT_REGISTRY_UNKNOWN and sets *object unchanged.
grpc_object_registry_type grpc_object_registry_get_object(intptr_t uuid,
void** object);
diff --git a/src/core/lib/surface/channel.cc b/src/core/lib/surface/channel.cc
index 837e78e85f..18ff89d5bb 100644
--- a/src/core/lib/surface/channel.cc
+++ b/src/core/lib/surface/channel.cc
@@ -173,8 +173,8 @@ grpc_channel* grpc_channel_create_with_builder(
} else if (0 == strcmp(args->args[i].key,
GRPC_ARG_MAX_CHANNEL_TRACE_EVENTS_PER_NODE)) {
GPR_ASSERT(channel_tracer_max_nodes == 0);
- // max_nodes defaults to 10, clamped between 0 and 100.
- const grpc_integer_options options = {10, 0, 100};
+ // max_nodes defaults to 0 (which is off), clamped between 0 and 100.
+ const grpc_integer_options options = {0, 0, 100};
channel_tracer_max_nodes =
(size_t)grpc_channel_arg_get_integer(&args->args[i], options);
}
@@ -405,7 +405,7 @@ static void destroy_channel(void* arg, grpc_error* error) {
GRPC_MDELEM_UNREF(rc->authority);
gpr_free(rc);
}
- channel->tracer.reset(nullptr);
+ channel->tracer.reset();
GRPC_MDELEM_UNREF(channel->default_authority);
gpr_mu_destroy(&channel->registered_call_mu);
gpr_free(channel->target);
diff --git a/src/core/lib/surface/channel.h b/src/core/lib/surface/channel.h
index c980151537..288313951e 100644
--- a/src/core/lib/surface/channel.h
+++ b/src/core/lib/surface/channel.h
@@ -60,14 +60,6 @@ grpc_mdelem grpc_channel_get_reffed_status_elem(grpc_channel* channel,
size_t grpc_channel_get_call_size_estimate(grpc_channel* channel);
void grpc_channel_update_call_size_estimate(grpc_channel* channel, size_t size);
-// Returns the JSON formatted channel trace for this channel. If recursive
-// is true, it will render all of the trace for this channel's subchannels.
-char* grpc_channel_get_trace(grpc_channel* channel, bool recursive);
-
-// Returns the channel uuid, which can be used to look up its trace at a
-// later time.
-intptr_t grpc_channel_get_uuid(grpc_channel* channel);
-
#ifndef NDEBUG
void grpc_channel_internal_ref(grpc_channel* channel, const char* reason);
void grpc_channel_internal_unref(grpc_channel* channel, const char* reason);