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

Unified Diff: third_party/grpc/src/core/surface/channel_ping.c

Issue 1932353002: Initial checkin of gRPC to third_party/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/grpc/src/core/surface/channel_ping.c
diff --git a/third_party/WebKit/Source/core/inspector/InspectorFrontendClient.h b/third_party/grpc/src/core/surface/channel_ping.c
similarity index 52%
copy from third_party/WebKit/Source/core/inspector/InspectorFrontendClient.h
copy to third_party/grpc/src/core/surface/channel_ping.c
index 9347f471e0abb521c67ff818174f8bf2ebb99b80..983f1c8a66d7f29db84d9d59d0f6ec929cd822de 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorFrontendClient.h
+++ b/third_party/grpc/src/core/surface/channel_ping.c
@@ -1,5 +1,7 @@
/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Copyright 2015-2016, Google Inc.
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -26,32 +28,52 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
*/
-#ifndef InspectorFrontendClient_h
-#define InspectorFrontendClient_h
-
-#include "platform/heap/Handle.h"
-#include "wtf/Forward.h"
-
-namespace blink {
-
-class ContextMenuProvider;
-class LocalFrame;
+#include "src/core/surface/channel.h"
-class InspectorFrontendClient {
-public:
- virtual ~InspectorFrontendClient() { }
+#include <string.h>
- virtual void sendMessageToEmbedder(const String&) = 0;
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
- virtual bool isUnderTest() = 0;
+#include "src/core/surface/api_trace.h"
+#include "src/core/surface/completion_queue.h"
- virtual void showContextMenu(LocalFrame* targetFrame, float x, float y, ContextMenuProvider*) = 0;
+typedef struct {
+ grpc_closure closure;
+ void *tag;
+ grpc_completion_queue *cq;
+ grpc_cq_completion completion_storage;
+} ping_result;
- virtual void setInjectedScriptForOrigin(const String& origin, const String& source) = 0;
-};
+static void ping_destroy(grpc_exec_ctx *exec_ctx, void *arg,
+ grpc_cq_completion *storage) {
+ gpr_free(arg);
+}
-} // namespace blink
+static void ping_done(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
+ ping_result *pr = arg;
+ grpc_cq_end_op(exec_ctx, pr->cq, pr->tag, success, ping_destroy, pr,
+ &pr->completion_storage);
+}
-#endif
+void grpc_channel_ping(grpc_channel *channel, grpc_completion_queue *cq,
+ void *tag, void *reserved) {
+ grpc_transport_op op;
+ ping_result *pr = gpr_malloc(sizeof(*pr));
+ grpc_channel_element *top_elem =
+ grpc_channel_stack_element(grpc_channel_get_channel_stack(channel), 0);
+ grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ GPR_ASSERT(reserved == NULL);
+ memset(&op, 0, sizeof(op));
+ pr->tag = tag;
+ pr->cq = cq;
+ grpc_closure_init(&pr->closure, ping_done, pr);
+ op.send_ping = &pr->closure;
+ op.bind_pollset = grpc_cq_pollset(cq);
+ grpc_cq_begin_op(cq, tag);
+ top_elem->filter->start_transport_op(&exec_ctx, top_elem, &op);
+ grpc_exec_ctx_finish(&exec_ctx);
+}
« no previous file with comments | « third_party/grpc/src/core/surface/channel_create.c ('k') | third_party/grpc/src/core/surface/completion_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698