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

Unified Diff: mojo/public/java/bindings/src/org/chromium/mojo/bindings/Message.java

Issue 526303003: mojo: java bindings rename Message subclasses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor inheritance Created 6 years, 3 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: mojo/public/java/bindings/src/org/chromium/mojo/bindings/Message.java
diff --git a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Message.java b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Message.java
index 4c302d9a0c82ff0b8fe7d9b22317d946d7358c85..1b3097a1e7fd13a69d80aa5e55e00198c2d80b23 100644
--- a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Message.java
+++ b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Message.java
@@ -12,24 +12,58 @@ import java.util.List;
/**
* A raw message to be sent/received from a {@link MessagePipeHandle}. Note that this can contain
- * any data, not necessarily a Mojo message with a proper header. See also {@link MessageWithHeader}
- * and {@link SimpleMessage}.
+ * any data, not necessarily a Mojo message with a proper header. See also {@link ServiceMessage}.
*/
-public interface Message {
+public class Message {
/**
- * The data part of the message.
+ * The data of the message.
*/
- public ByteBuffer getData();
+ private final ByteBuffer mBuffer;
/**
- * The handles part of the message.
+ * The handles of the message.
*/
- public List<? extends Handle> getHandles();
+ private final List<? extends Handle> mHandle;
/**
- * Returns the message considered as a message with a header.
+ * This message interpreted with headers.
ppi 2014/09/03 11:44:08 -> This message interpreted as a message for a moj
qsr 2014/09/03 14:11:29 Done.
*/
- public MessageWithHeader asMojoMessage();
+ private ServiceMessage mWithHeader = null;
+ /**
+ * Constructor.
+ *
+ * @param buffer The buffer containing the bytes to send. This must be a direct buffer.
+ * @param handles The list of handles to send.
+ */
+ public Message(ByteBuffer buffer, List<? extends Handle> handles) {
+ assert buffer.isDirect();
+ mBuffer = buffer;
+ mHandle = handles;
+ }
+
+ /**
+ * The data of the message.
+ */
+ public ByteBuffer getData() {
+ return mBuffer;
+ }
+
+ /**
+ * The handles of the message.
+ */
+ public List<? extends Handle> getHandles() {
+ return mHandle;
+ }
+
+ /**
+ * Returns the message considered as a message for a mojo service.
ppi 2014/09/03 11:44:08 s/considered/interpreted/
qsr 2014/09/03 14:11:29 Done.
+ */
+ public ServiceMessage asServiceMessage() {
+ if (mWithHeader == null) {
+ mWithHeader = new ServiceMessage(this);
+ }
+ return mWithHeader;
+ }
}

Powered by Google App Engine
This is Rietveld 408576698