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

Unified Diff: third_party/grpc/test/cpp/util/byte_buffer_proto_helper.cc

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/test/cpp/util/byte_buffer_proto_helper.cc
diff --git a/third_party/WebKit/Source/core/html/shadow/DetailsMarkerControl.h b/third_party/grpc/test/cpp/util/byte_buffer_proto_helper.cc
similarity index 64%
copy from third_party/WebKit/Source/core/html/shadow/DetailsMarkerControl.h
copy to third_party/grpc/test/cpp/util/byte_buffer_proto_helper.cc
index 06199e3f5f6868af0e5b2742e955211e359b99c5..2512c9bdf8297efd8c7429a187d38ad89a5b226c 100644
--- a/third_party/WebKit/Source/core/html/shadow/DetailsMarkerControl.h
+++ b/third_party/grpc/test/cpp/util/byte_buffer_proto_helper.cc
@@ -1,5 +1,7 @@
/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Copyright 2016, Google Inc.
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -26,37 +28,33 @@
* 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 DetailsMarkerControl_h
-#define DetailsMarkerControl_h
-
-#include "core/html/HTMLDivElement.h"
-#include "wtf/Forward.h"
-
-namespace blink {
+#include "test/cpp/util/byte_buffer_proto_helper.h"
-class HTMLSummaryElement;
+namespace grpc {
+namespace testing {
-class DetailsMarkerControl final : public HTMLDivElement {
-public:
- explicit DetailsMarkerControl(Document&);
- static DetailsMarkerControl* create(Document&);
-
-private:
- LayoutObject* createLayoutObject(const ComputedStyle&) override;
- bool layoutObjectIsNeeded(const ComputedStyle&) override;
-
- HTMLSummaryElement* summaryElement();
-};
-
-inline DetailsMarkerControl* DetailsMarkerControl::create(Document& document)
-{
- DetailsMarkerControl* element = new DetailsMarkerControl(document);
- element->setShadowPseudoId(AtomicString("-webkit-details-marker"));
- return element;
+bool ParseFromByteBuffer(ByteBuffer* buffer, grpc::protobuf::Message* message) {
+ std::vector<Slice> slices;
+ buffer->Dump(&slices);
+ grpc::string buf;
+ buf.reserve(buffer->Length());
+ for (auto s = slices.begin(); s != slices.end(); s++) {
+ buf.append(reinterpret_cast<const char*>(s->begin()), s->size());
+ }
+ return message->ParseFromString(buf);
}
-} // namespace blink
+std::unique_ptr<ByteBuffer> SerializeToByteBuffer(
+ grpc::protobuf::Message* message) {
+ grpc::string buf;
+ message->SerializeToString(&buf);
+ gpr_slice s = gpr_slice_from_copied_string(buf.c_str());
+ Slice slice(s, Slice::STEAL_REF);
+ return std::unique_ptr<ByteBuffer>(new ByteBuffer(&slice, 1));
+}
-#endif
+} // namespace testing
+} // namespace grpc
« no previous file with comments | « third_party/grpc/test/cpp/util/byte_buffer_proto_helper.h ('k') | third_party/grpc/test/cpp/util/byte_buffer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698