Index: third_party/grpc/include/grpc++/impl/codegen/client_unary_call.h |
diff --git a/third_party/WebKit/Source/core/layout/OrderIterator.cpp b/third_party/grpc/include/grpc++/impl/codegen/client_unary_call.h |
similarity index 52% |
copy from third_party/WebKit/Source/core/layout/OrderIterator.cpp |
copy to third_party/grpc/include/grpc++/impl/codegen/client_unary_call.h |
index 8813561b862d5882183732d768d453e309737a4f..0134dec800ccfaa4d204b7c1a2adb7b99edcbeec 100644 |
--- a/third_party/WebKit/Source/core/layout/OrderIterator.cpp |
+++ b/third_party/grpc/include/grpc++/impl/codegen/client_unary_call.h |
@@ -1,5 +1,7 @@ |
/* |
- * Copyright (C) 2011 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,66 +28,48 @@ |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+ * |
*/ |
-#include "core/layout/OrderIterator.h" |
+#ifndef GRPCXX_IMPL_CODEGEN_CLIENT_UNARY_CALL_H |
+#define GRPCXX_IMPL_CODEGEN_CLIENT_UNARY_CALL_H |
-#include "core/layout/LayoutBox.h" |
+#include <grpc++/impl/codegen/call.h> |
+#include <grpc++/impl/codegen/channel_interface.h> |
+#include <grpc++/impl/codegen/config.h> |
+#include <grpc++/impl/codegen/status.h> |
-namespace blink { |
+namespace grpc { |
-OrderIterator::OrderIterator(const LayoutBox* containerBox) |
- : m_containerBox(containerBox) |
- , m_currentChild(nullptr) |
- , m_isReset(false) |
-{ |
-} |
+class Channel; |
+class ClientContext; |
+class CompletionQueue; |
+class RpcMethod; |
-LayoutBox* OrderIterator::first() |
-{ |
- reset(); |
- return next(); |
+// Wrapper that performs a blocking unary call |
+template <class InputMessage, class OutputMessage> |
+Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method, |
+ ClientContext* context, const InputMessage& request, |
+ OutputMessage* result) { |
+ CompletionQueue cq; |
+ Call call(channel->CreateCall(method, context, &cq)); |
+ CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, |
+ CallOpRecvInitialMetadata, CallOpRecvMessage<OutputMessage>, |
+ CallOpClientSendClose, CallOpClientRecvStatus> ops; |
+ Status status = ops.SendMessage(request); |
+ if (!status.ok()) { |
+ return status; |
+ } |
+ ops.SendInitialMetadata(context->send_initial_metadata_); |
+ ops.RecvInitialMetadata(context); |
+ ops.RecvMessage(result); |
+ ops.ClientSendClose(); |
+ ops.ClientRecvStatus(context, &status); |
+ call.PerformOps(&ops); |
+ GPR_ASSERT((cq.Pluck(&ops) && ops.got_message) || !status.ok()); |
+ return status; |
} |
-LayoutBox* OrderIterator::next() |
-{ |
- do { |
- if (!m_currentChild) { |
- if (m_orderValuesIterator == m_orderValues.end()) |
- return nullptr; |
- |
- if (!m_isReset) { |
- ++m_orderValuesIterator; |
- if (m_orderValuesIterator == m_orderValues.end()) |
- return nullptr; |
- } else { |
- m_isReset = false; |
- } |
- |
- m_currentChild = m_containerBox->firstChildBox(); |
- } else { |
- m_currentChild = m_currentChild->nextSiblingBox(); |
- } |
- } while (!m_currentChild || m_currentChild->style()->order() != *m_orderValuesIterator); |
- |
- return m_currentChild; |
-} |
- |
-void OrderIterator::reset() |
-{ |
- m_currentChild = nullptr; |
- m_orderValuesIterator = m_orderValues.begin(); |
- m_isReset = true; |
-} |
- |
-OrderIteratorPopulator::~OrderIteratorPopulator() |
-{ |
- m_iterator.reset(); |
-} |
- |
-void OrderIteratorPopulator::collectChild(const LayoutBox* child) |
-{ |
- m_iterator.m_orderValues.insert(child->style()->order()); |
-} |
+} // namespace grpc |
-} // namespace blink |
+#endif // GRPCXX_IMPL_CODEGEN_CLIENT_UNARY_CALL_H |