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

Unified Diff: content/public/common/message_port_types.h

Issue 921013002: Optionally have MessagePort pass data as base::Value, part 1. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-c-move-v8-value-converter
Patch Set: update to match changes in blink side patch Created 5 years, 10 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: content/public/common/message_port_types.h
diff --git a/content/public/common/message_port_types.h b/content/public/common/message_port_types.h
new file mode 100644
index 0000000000000000000000000000000000000000..5601ff8036e95db61e9e6250eae472bbf2a3be21
--- /dev/null
+++ b/content/public/common/message_port_types.h
@@ -0,0 +1,36 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_PUBLIC_COMMON_MESSAGE_PORT_TYPES_H_
+#define CONTENT_PUBLIC_COMMON_MESSAGE_PORT_TYPES_H_
+
+#include <vector>
+
+#include "base/strings/string16.h"
+#include "base/values.h"
+
+namespace content {
+
+// Struct representing a message sent across a message port. This struct hides
+// the fact that messages can be serialized/encoded in multiple ways from code
+// that doesn't care about the message contents.
+struct MessagePortMessage {
+ MessagePortMessage();
+ explicit MessagePortMessage(const base::string16& message);
+ explicit MessagePortMessage(const base::Value* message);
+ MessagePortMessage(const MessagePortMessage& other);
+ MessagePortMessage& operator=(const MessagePortMessage& other);
+ ~MessagePortMessage();
+
+ // Message serialized using blink::WebSerializedScriptValue. Only one of
+ // |message_as_string| and |message_as_value| should be non-empty.
+ base::string16 message_as_string;
+ // Message as a base::Value. This is either an empty list or a list
+ // containing exactly one item.
+ base::ListValue message_as_value;
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_COMMON_MESSAGE_PORT_TYPES_H_

Powered by Google App Engine
This is Rietveld 408576698