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

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

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 4 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/ServiceMessage.java
diff --git a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/ServiceMessage.java b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/ServiceMessage.java
deleted file mode 100644
index 313dc6aea398d68e3f0c1cadaaa199be668c451c..0000000000000000000000000000000000000000
--- a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/ServiceMessage.java
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2014 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.
-
-package org.chromium.mojo.bindings;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-/**
- * Represents a {@link Message} which contains a {@link MessageHeader}. Deals with parsing the
- * {@link MessageHeader} for a message.
- */
-public class ServiceMessage extends Message {
-
- private final MessageHeader mHeader;
- private Message mPayload;
-
- /**
- * Reinterpret the given |message| as a message with the given |header|. The |message| must
- * contain the |header| as the start of its raw data.
- */
- public ServiceMessage(Message baseMessage, MessageHeader header) {
- super(baseMessage.getData(), baseMessage.getHandles());
- assert header.equals(new org.chromium.mojo.bindings.MessageHeader(baseMessage));
- this.mHeader = header;
- }
-
- /**
- * Reinterpret the given |message| as a message with a header. The |message| must contain a
- * header as the start of it's raw data, which will be parsed by this constructor.
- */
- ServiceMessage(Message baseMessage) {
- this(baseMessage, new org.chromium.mojo.bindings.MessageHeader(baseMessage));
- }
-
- /**
- * @see Message#asServiceMessage()
- */
- @Override
- public ServiceMessage asServiceMessage() {
- return this;
- }
-
- /**
- * Returns the header of the given message. This will throw a {@link DeserializationException}
- * if the start of the message is not a valid header.
- */
- public MessageHeader getHeader() {
- return mHeader;
- }
-
- /**
- * Returns the payload of the message.
- */
- public Message getPayload() {
- if (mPayload == null) {
- ByteBuffer truncatedBuffer =
- ((ByteBuffer) getData().position(getHeader().getSize())).slice();
- truncatedBuffer.order(ByteOrder.LITTLE_ENDIAN);
- mPayload = new Message(truncatedBuffer, getHandles());
- }
- return mPayload;
- }
-
- /**
- * Set the request identifier on the message.
- */
- void setRequestId(long requestId) {
- mHeader.setRequestId(getData(), requestId);
- }
-
-}

Powered by Google App Engine
This is Rietveld 408576698