summaryrefslogtreecommitdiffstats
path: root/mojo
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-04 16:53:10 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-04 16:53:10 +0000
commitd5304ca03e63566a7fcd65f42edc5f670ce7e5de (patch)
treebb544a132ea5068400ca679e0c0cd85167f3f751 /mojo
parenta907c5fcc0c91a3723b2e544dbcdb5d6acb8cb0b (diff)
downloadchromium_src-d5304ca03e63566a7fcd65f42edc5f670ce7e5de.zip
chromium_src-d5304ca03e63566a7fcd65f42edc5f670ce7e5de.tar.gz
chromium_src-d5304ca03e63566a7fcd65f42edc5f670ce7e5de.tar.bz2
Revert 254541 "Mojo: add scaffolding for request/response support"
Reverting as broke mojo_public_bindings_unittests and mojo_service_manager_unittests > Mojo: add scaffolding for request/response support > > Introduces MessageHeaderWithRequestID, which extends MessageHeader, and a corresponding MessageWithRequestIDBuilder. > > Adds an AcceptWithResponder method to MessageReceiver. The idea is that this will be used by generated proxy code to kick off a request that expects a response. Somehow we will bind a user supplied callback to a MessageReceiver::Accept implementation. Details TBD. > > Internally, Connector might get broken down into two layers: a core pump layer (the code that currently exists) and a router layer that'll be responsible for routing incoming messages to the proper MessageReceiver, either a registered responder or the default incoming receiver. > > R=davemoore@chromium.org > > Review URL: https://codereview.chromium.org/185803002 TBR=darin@chromium.org Review URL: https://codereview.chromium.org/177853004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254769 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo')
-rw-r--r--mojo/mojo_public.gypi1
-rw-r--r--mojo/public/bindings/generators/cpp_templates/interface_definition.tmpl12
-rw-r--r--mojo/public/bindings/generators/cpp_templates/interface_stub_declaration.tmpl3
-rw-r--r--mojo/public/bindings/interface.h2
-rw-r--r--mojo/public/bindings/lib/bindings_serialization.cc4
-rw-r--r--mojo/public/bindings/lib/connector.cc12
-rw-r--r--mojo/public/bindings/lib/connector.h2
-rw-r--r--mojo/public/bindings/lib/interface.cc5
-rw-r--r--mojo/public/bindings/lib/message.cc12
-rw-r--r--mojo/public/bindings/lib/message_builder.cc38
-rw-r--r--mojo/public/bindings/lib/message_builder.h16
-rw-r--r--mojo/public/bindings/lib/message_internal.h50
-rw-r--r--mojo/public/bindings/lib/sync_dispatcher.cc2
-rw-r--r--mojo/public/bindings/message.h68
-rw-r--r--mojo/public/bindings/tests/connector_unittest.cc30
-rw-r--r--mojo/public/bindings/tests/sample_service_unittest.cc8
16 files changed, 68 insertions, 197 deletions
diff --git a/mojo/mojo_public.gypi b/mojo/mojo_public.gypi
index 8a88155..b4ad543 100644
--- a/mojo/mojo_public.gypi
+++ b/mojo/mojo_public.gypi
@@ -222,7 +222,6 @@
'public/bindings/lib/message.cc',
'public/bindings/lib/message_builder.cc',
'public/bindings/lib/message_builder.h',
- 'public/bindings/lib/message_internal.h',
'public/bindings/lib/message_queue.cc',
'public/bindings/lib/message_queue.h',
'public/bindings/lib/scratch_buffer.cc',
diff --git a/mojo/public/bindings/generators/cpp_templates/interface_definition.tmpl b/mojo/public/bindings/generators/cpp_templates/interface_definition.tmpl
index 960171c..6add826 100644
--- a/mojo/public/bindings/generators/cpp_templates/interface_definition.tmpl
+++ b/mojo/public/bindings/generators/cpp_templates/interface_definition.tmpl
@@ -49,7 +49,7 @@ void {{proxy_name}}::{{method.name}}({{params_list(method)}}) {
mojo::Message message;
params->EncodePointersAndHandles(message.mutable_handles());
- builder.Finish(&message);
+ message.AdoptData(builder.Finish());
receiver_->Accept(&message);
}
@@ -76,12 +76,12 @@ params->{{param.name}}()
{%- endmacro %}
bool {{class_name}}Stub::Accept(mojo::Message* message) {
- switch (message->header()->name) {
+ switch (message->data()->header.name) {
{%- for method in interface.methods %}
case internal::k{{class_name}}_{{method.name}}_Name: {
internal::{{class_name}}_{{method.name}}_Params_Data* params =
reinterpret_cast<internal::{{class_name}}_{{method.name}}_Params_Data*>(
- message->mutable_payload());
+ message->mutable_data()->payload);
if (!params->DecodePointersAndHandles(message))
return false;
@@ -93,9 +93,3 @@ bool {{class_name}}Stub::Accept(mojo::Message* message) {
}
return true;
}
-
-bool {{class_name}}Stub::AcceptWithResponder(mojo::Message* message,
- mojo::MessageReceiver* responder) {
- // TODO(darin): Implement this!
- return false;
-}
diff --git a/mojo/public/bindings/generators/cpp_templates/interface_stub_declaration.tmpl b/mojo/public/bindings/generators/cpp_templates/interface_stub_declaration.tmpl
index e5da257..a01c5f4 100644
--- a/mojo/public/bindings/generators/cpp_templates/interface_stub_declaration.tmpl
+++ b/mojo/public/bindings/generators/cpp_templates/interface_stub_declaration.tmpl
@@ -3,9 +3,6 @@ class {{interface.name}}Stub : public mojo::MessageReceiver {
explicit {{interface.name}}Stub({{interface.name}}* sink);
virtual bool Accept(mojo::Message* message) MOJO_OVERRIDE;
- virtual bool AcceptWithResponder(mojo::Message* message,
- mojo::MessageReceiver* responder)
- MOJO_OVERRIDE;
private:
{{interface.name}}* sink_;
diff --git a/mojo/public/bindings/interface.h b/mojo/public/bindings/interface.h
index 36d4bab..a472b07 100644
--- a/mojo/public/bindings/interface.h
+++ b/mojo/public/bindings/interface.h
@@ -22,8 +22,6 @@ class NoInterfaceStub : public MessageReceiver {
public:
NoInterfaceStub(NoInterface* unused) {}
virtual bool Accept(Message* message) MOJO_OVERRIDE;
- virtual bool AcceptWithResponder(Message* message, MessageReceiver* responder)
- MOJO_OVERRIDE;
};
class NoInterface {
diff --git a/mojo/public/bindings/lib/bindings_serialization.cc b/mojo/public/bindings/lib/bindings_serialization.cc
index 31603a4..f0b14d6 100644
--- a/mojo/public/bindings/lib/bindings_serialization.cc
+++ b/mojo/public/bindings/lib/bindings_serialization.cc
@@ -40,8 +40,8 @@ bool ValidatePointer(const void* ptr, const Message& message) {
if (reinterpret_cast<ptrdiff_t>(data) % 8 != 0)
return false;
- const uint8_t* data_start = message.data();
- const uint8_t* data_end = data_start + message.data_num_bytes();
+ const uint8_t* data_start = reinterpret_cast<const uint8_t*>(message.data());
+ const uint8_t* data_end = data_start + message.data()->header.num_bytes;
return data >= data_start && data < data_end;
}
diff --git a/mojo/public/bindings/lib/connector.cc b/mojo/public/bindings/lib/connector.cc
index 076e30b..e2709fd 100644
--- a/mojo/public/bindings/lib/connector.cc
+++ b/mojo/public/bindings/lib/connector.cc
@@ -4,7 +4,6 @@
#include "mojo/public/bindings/lib/connector.h"
-#include <assert.h>
#include <stdlib.h>
#include "mojo/public/bindings/error_handler.h"
@@ -43,7 +42,7 @@ bool Connector::Accept(Message* message) {
MojoResult rv = WriteMessageRaw(
message_pipe_.get(),
message->data(),
- message->data_num_bytes(),
+ message->data()->header.num_bytes,
message->mutable_handles()->empty() ? NULL :
reinterpret_cast<const MojoHandle*>(
&message->mutable_handles()->front()),
@@ -71,13 +70,6 @@ bool Connector::Accept(Message* message) {
return true;
}
-bool Connector::AcceptWithResponder(Message* message,
- MessageReceiver* responder) {
- // TODO(darin): Implement this!
- assert(false);
- return false;
-}
-
// static
void Connector::CallOnHandleReady(void* closure, MojoResult result) {
Connector* self = static_cast<Connector*>(closure);
@@ -127,7 +119,7 @@ void Connector::ReadMore() {
}
Message message;
- message.AllocUninitializedData(num_bytes);
+ message.AllocData(num_bytes);
message.mutable_handles()->resize(num_handles);
rv = ReadMessageRaw(
diff --git a/mojo/public/bindings/lib/connector.h b/mojo/public/bindings/lib/connector.h
index c0d9802..09bc4b5 100644
--- a/mojo/public/bindings/lib/connector.h
+++ b/mojo/public/bindings/lib/connector.h
@@ -48,8 +48,6 @@ class Connector : public MessageReceiver {
// MessageReceiver implementation:
virtual bool Accept(Message* message) MOJO_OVERRIDE;
- virtual bool AcceptWithResponder(Message* message, MessageReceiver* responder)
- MOJO_OVERRIDE;
private:
static void CallOnHandleReady(void* closure, MojoResult result);
diff --git a/mojo/public/bindings/lib/interface.cc b/mojo/public/bindings/lib/interface.cc
index cb7b11d..a7cf3ff 100644
--- a/mojo/public/bindings/lib/interface.cc
+++ b/mojo/public/bindings/lib/interface.cc
@@ -10,10 +10,5 @@ bool NoInterfaceStub::Accept(Message* message) {
return false;
}
-bool NoInterfaceStub::AcceptWithResponder(Message* message,
- MessageReceiver* responder) {
- return false;
-}
-
} // namespace mojo
diff --git a/mojo/public/bindings/lib/message.cc b/mojo/public/bindings/lib/message.cc
index f33f250a..56561b3 100644
--- a/mojo/public/bindings/lib/message.cc
+++ b/mojo/public/bindings/lib/message.cc
@@ -12,8 +12,7 @@
namespace mojo {
Message::Message()
- : data_num_bytes_(0),
- data_(NULL) {
+ : data_(NULL) {
}
Message::~Message() {
@@ -26,20 +25,17 @@ Message::~Message() {
}
}
-void Message::AllocUninitializedData(uint32_t num_bytes) {
+void Message::AllocData(uint32_t num_bytes) {
assert(!data_);
- data_num_bytes_ = num_bytes;
- data_ = static_cast<internal::MessageData*>(malloc(num_bytes));
+ data_ = static_cast<MessageData*>(malloc(num_bytes));
}
-void Message::AdoptData(uint32_t num_bytes, internal::MessageData* data) {
+void Message::AdoptData(MessageData* data) {
assert(!data_);
- data_num_bytes_ = num_bytes;
data_ = data;
}
void Message::Swap(Message* other) {
- std::swap(data_num_bytes_, other->data_num_bytes_);
std::swap(data_, other->data_);
std::swap(handles_, other->handles_);
}
diff --git a/mojo/public/bindings/lib/message_builder.cc b/mojo/public/bindings/lib/message_builder.cc
index 5cbe037..a553e68 100644
--- a/mojo/public/bindings/lib/message_builder.cc
+++ b/mojo/public/bindings/lib/message_builder.cc
@@ -9,43 +9,19 @@
namespace mojo {
namespace internal {
-template <typename Header>
-void Allocate(Buffer* buf, Header** header) {
- *header = static_cast<Header*>(buf->Allocate(sizeof(Header)));
- (*header)->num_bytes = sizeof(Header);
-}
-
-MessageBuilder::MessageBuilder(uint32_t name, size_t payload_size)
+MessageBuilder::MessageBuilder(uint32_t message_name, size_t payload_size)
: buf_(sizeof(MessageHeader) + payload_size) {
- MessageHeader* header;
- Allocate(&buf_, &header);
- header->num_fields = 2;
- header->name = name;
+ MessageHeader* header =
+ static_cast<MessageHeader*>(buf_.Allocate(sizeof(MessageHeader)));
+ header->num_bytes = static_cast<uint32_t>(buf_.size());
+ header->name = message_name;
}
MessageBuilder::~MessageBuilder() {
}
-void MessageBuilder::Finish(Message* message) {
- message->AdoptData(static_cast<uint32_t>(buf_.size()),
- static_cast<MessageData*>(buf_.Leak()));
-}
-
-MessageBuilder::MessageBuilder(size_t size)
- : buf_(size) {
-}
-
-MessageWithRequestIDBuilder::MessageWithRequestIDBuilder(uint32_t name,
- size_t payload_size,
- uint32_t flags,
- uint64_t request_id)
- : MessageBuilder(sizeof(MessageHeaderWithRequestID) + payload_size) {
- MessageHeaderWithRequestID* header;
- Allocate(&buf_, &header);
- header->num_fields = 3;
- header->name = name;
- header->flags = flags;
- header->request_id = request_id;
+MessageData* MessageBuilder::Finish() {
+ return static_cast<MessageData*>(buf_.Leak());
}
} // namespace internal
diff --git a/mojo/public/bindings/lib/message_builder.h b/mojo/public/bindings/lib/message_builder.h
index a8a0240..a8dfdfa 100644
--- a/mojo/public/bindings/lib/message_builder.h
+++ b/mojo/public/bindings/lib/message_builder.h
@@ -10,13 +10,14 @@
#include "mojo/public/bindings/lib/fixed_buffer.h"
namespace mojo {
-class Message;
+struct MessageData;
namespace internal {
+// Used to construct a MessageData object.
class MessageBuilder {
public:
- MessageBuilder(uint32_t name, size_t payload_size);
+ MessageBuilder(uint32_t message_name, size_t payload_size);
~MessageBuilder();
Buffer* buffer() { return &buf_; }
@@ -24,21 +25,14 @@ class MessageBuilder {
// Call Finish when done making allocations in |buffer()|. A heap-allocated
// MessageData object will be returned. When no longer needed, use |free()|
// to release the MessageData object's memory.
- void Finish(Message* message);
+ MessageData* Finish();
- protected:
- explicit MessageBuilder(size_t size);
+ private:
FixedBuffer buf_;
MOJO_DISALLOW_COPY_AND_ASSIGN(MessageBuilder);
};
-class MessageWithRequestIDBuilder : public MessageBuilder {
- public:
- MessageWithRequestIDBuilder(uint32_t name, size_t payload_size,
- uint32_t flags, uint64_t request_id);
-};
-
} // namespace internal
} // namespace mojo
diff --git a/mojo/public/bindings/lib/message_internal.h b/mojo/public/bindings/lib/message_internal.h
deleted file mode 100644
index d3f8338..0000000
--- a/mojo/public/bindings/lib/message_internal.h
+++ /dev/null
@@ -1,50 +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.
-
-#ifndef MOJO_PUBLIC_BINDINGS_LIB_MESSAGE_INTERNAL_H_
-#define MOJO_PUBLIC_BINDINGS_LIB_MESSAGE_INTERNAL_H_
-
-#include "mojo/public/bindings/lib/bindings_internal.h"
-
-namespace mojo {
-namespace internal {
-
-#pragma pack(push, 1)
-
-enum {
- kMessageExpectsResponse = 1 << 0,
- kMessageIsResponse = 1 << 1
-};
-
-struct MessageHeader : internal::StructHeader {
- uint32_t name;
- uint32_t flags;
-};
-MOJO_COMPILE_ASSERT(sizeof(MessageHeader) == 16, bad_sizeof_MessageHeader);
-
-struct MessageHeaderWithRequestID : MessageHeader {
- uint64_t request_id;
-};
-MOJO_COMPILE_ASSERT(sizeof(MessageHeaderWithRequestID) == 24,
- bad_sizeof_MessageHeaderWithRequestID);
-
-struct MessageData {
- MessageHeader header;
- uint8_t payload[1];
-};
-MOJO_COMPILE_ASSERT(sizeof(MessageData) == 17, bad_sizeof_MessageData);
-
-struct MessageDataWithRequestID {
- MessageHeaderWithRequestID header;
- uint8_t payload[1];
-};
-MOJO_COMPILE_ASSERT(sizeof(MessageDataWithRequestID) == 25,
- bad_sizeof_MessageDataWithRequestID);
-
-#pragma pack(pop)
-
-} // namespace internal
-} // namespace mojo
-
-#endif // MOJO_PUBLIC_BINDINGS_LIB_MESSAGE_INTERNAL_H_
diff --git a/mojo/public/bindings/lib/sync_dispatcher.cc b/mojo/public/bindings/lib/sync_dispatcher.cc
index f27fc17..eee0be4 100644
--- a/mojo/public/bindings/lib/sync_dispatcher.cc
+++ b/mojo/public/bindings/lib/sync_dispatcher.cc
@@ -30,7 +30,7 @@ bool WaitForMessageAndDispatch(MessagePipeHandle handle,
}
Message message;
- message.AllocUninitializedData(num_bytes);
+ message.AllocData(num_bytes);
message.mutable_handles()->resize(num_handles);
MojoResult rv = ReadMessageRaw(
diff --git a/mojo/public/bindings/message.h b/mojo/public/bindings/message.h
index 7b058b8..fa13515 100644
--- a/mojo/public/bindings/message.h
+++ b/mojo/public/bindings/message.h
@@ -5,60 +5,52 @@
#ifndef MOJO_PUBLIC_BINDINGS_MESSAGE_H_
#define MOJO_PUBLIC_BINDINGS_MESSAGE_H_
-#include <assert.h>
-
#include <vector>
-#include "mojo/public/bindings/lib/message_internal.h"
+#include "mojo/public/system/core_cpp.h"
namespace mojo {
+#pragma pack(push, 1)
+
+struct MessageHeader {
+ //uint32_t deprecated_num_bytes;
+ uint32_t num_bytes;
+ uint32_t name;
+};
+MOJO_COMPILE_ASSERT(sizeof(MessageHeader) == 8, bad_sizeof_MessageHeader);
+
+struct MessageData {
+ MessageHeader header;
+ uint8_t payload[1];
+};
+MOJO_COMPILE_ASSERT(sizeof(MessageData) == 9, bad_sizeof_MessageData);
+
+#pragma pack(pop)
+
// Message is a holder for the data and handles to be sent over a MessagePipe.
// Message owns its data and handles, but a consumer of Message is free to
-// mutate the data and handles members. The message's data is comprised of a
-// header followed by payload.
+// manipulate the data and handles members.
class Message {
public:
Message();
~Message();
- // These may only be called on a newly created Message object.
- void AllocUninitializedData(uint32_t num_bytes);
- void AdoptData(uint32_t num_bytes, internal::MessageData* data);
+ // These may only be called on a newly initialized Message object.
+ void AllocData(uint32_t num_bytes); // |data()| is uninitialized.
+ void AdoptData(MessageData* data);
// Swaps data and handles between this Message and another.
void Swap(Message* other);
- uint32_t data_num_bytes() const { return data_num_bytes_; }
-
- // Access the raw bytes of the message.
- const uint8_t* data() const { return
- reinterpret_cast<const uint8_t*>(data_);
- }
- uint8_t* mutable_data() { return reinterpret_cast<uint8_t*>(data_); }
-
- // Access the header.
- const internal::MessageHeader* header() const { return &data_->header; }
+ const MessageData* data() const { return data_; }
+ MessageData* mutable_data() { return data_; }
- // Access the request_id field (if present).
- bool has_request_id() const { return data_->header.num_fields == 3; }
- uint64_t request_id() const {
- assert(has_request_id());
- return static_cast<internal::MessageHeaderWithRequestID*>(&data_->header)->
- request_id;
- }
-
- // Access the payload.
- const uint8_t* payload() const { return data_->payload; }
- uint8_t* mutable_payload() { return data_->payload; }
-
- // Access the handles.
const std::vector<Handle>* handles() const { return &handles_; }
std::vector<Handle>* mutable_handles() { return &handles_; }
private:
- uint32_t data_num_bytes_;
- internal::MessageData* data_; // Heap-allocated using malloc.
+ MessageData* data_; // Heap-allocated using malloc.
std::vector<Handle> handles_;
MOJO_DISALLOW_COPY_AND_ASSIGN(Message);
@@ -66,17 +58,11 @@ class Message {
class MessageReceiver {
public:
- // The receiver may mutate the given message. Returns true if the message
+ // The receiver may mutate the given message or take ownership of its
+ // |message->data| member by setting it to NULL. Returns true if the message
// was accepted and false otherwise, indicating that the message was invalid
// or malformed.
virtual bool Accept(Message* message) = 0;
-
- // A variant on Accept that registers a receiver to handle the response
- // message generated from the given message. The responder's Accept method
- // will be called some time after AcceptWithResponder returns. The responder
- // will be unregistered once its Accept method has been called.
- virtual bool AcceptWithResponder(Message* message,
- MessageReceiver* responder) = 0;
};
} // namespace mojo
diff --git a/mojo/public/bindings/tests/connector_unittest.cc b/mojo/public/bindings/tests/connector_unittest.cc
index b0f9cf1..8ff7de5 100644
--- a/mojo/public/bindings/tests/connector_unittest.cc
+++ b/mojo/public/bindings/tests/connector_unittest.cc
@@ -6,7 +6,6 @@
#include <string.h>
#include "mojo/public/bindings/lib/connector.h"
-#include "mojo/public/bindings/lib/message_builder.h"
#include "mojo/public/bindings/lib/message_queue.h"
#include "mojo/public/environment/environment.h"
#include "mojo/public/system/macros.h"
@@ -26,11 +25,6 @@ class MessageAccumulator : public MessageReceiver {
return true;
}
- virtual bool AcceptWithResponder(Message* message, MessageReceiver* responder)
- MOJO_OVERRIDE {
- return false;
- }
-
bool IsEmpty() const {
return queue_.IsEmpty();
}
@@ -57,9 +51,12 @@ class ConnectorTest : public testing::Test {
void AllocMessage(const char* text, Message* message) {
size_t payload_size = strlen(text) + 1; // Plus null terminator.
- internal::MessageBuilder builder(1, payload_size);
- memcpy(builder.buffer()->Allocate(payload_size), text, payload_size);
- builder.Finish(message);
+ size_t num_bytes = sizeof(MessageHeader) + payload_size;
+ message->AllocData(static_cast<uint32_t>(num_bytes));
+ message->mutable_data()->header.num_bytes =
+ static_cast<uint32_t>(num_bytes);
+ message->mutable_data()->header.name = 1;
+ memcpy(message->mutable_data()->payload, text, payload_size);
}
void PumpMessages() {
@@ -98,7 +95,8 @@ TEST_F(ConnectorTest, Basic) {
EXPECT_EQ(
std::string(kText),
- std::string(reinterpret_cast<const char*>(message_received.payload())));
+ std::string(
+ reinterpret_cast<const char*>(message_received.data()->payload)));
}
TEST_F(ConnectorTest, Basic_EarlyIncomingReceiver) {
@@ -124,7 +122,8 @@ TEST_F(ConnectorTest, Basic_EarlyIncomingReceiver) {
EXPECT_EQ(
std::string(kText),
- std::string(reinterpret_cast<const char*>(message_received.payload())));
+ std::string(
+ reinterpret_cast<const char*>(message_received.data()->payload)));
}
TEST_F(ConnectorTest, Basic_TwoMessages) {
@@ -153,7 +152,8 @@ TEST_F(ConnectorTest, Basic_TwoMessages) {
EXPECT_EQ(
std::string(kText[i]),
- std::string(reinterpret_cast<const char*>(message_received.payload())));
+ std::string(
+ reinterpret_cast<const char*>(message_received.data()->payload)));
}
}
@@ -215,7 +215,8 @@ TEST_F(ConnectorTest, MessageWithHandles) {
EXPECT_EQ(
std::string(kText),
- std::string(reinterpret_cast<const char*>(message_received.payload())));
+ std::string(
+ reinterpret_cast<const char*>(message_received.data()->payload)));
ASSERT_EQ(1U, message_received.handles()->size());
// Now send a message to the transferred handle and confirm it's sent through
@@ -242,7 +243,8 @@ TEST_F(ConnectorTest, MessageWithHandles) {
EXPECT_EQ(
std::string(kText),
- std::string(reinterpret_cast<const char*>(message_received.payload())));
+ std::string(
+ reinterpret_cast<const char*>(message_received.data()->payload)));
}
} // namespace test
diff --git a/mojo/public/bindings/tests/sample_service_unittest.cc b/mojo/public/bindings/tests/sample_service_unittest.cc
index 390c78b..b7d8f6c 100644
--- a/mojo/public/bindings/tests/sample_service_unittest.cc
+++ b/mojo/public/bindings/tests/sample_service_unittest.cc
@@ -271,7 +271,7 @@ class SimpleMessageReceiver : public mojo::MessageReceiver {
if (g_dump_message_as_hex) {
DumpHex(reinterpret_cast<const uint8_t*>(message->data()),
- message->data_num_bytes());
+ message->data()->header.num_bytes);
}
// In the receiving process, an implementation of ServiceStub is known to
@@ -281,12 +281,6 @@ class SimpleMessageReceiver : public mojo::MessageReceiver {
ServiceStub stub(&impl);
return stub.Accept(message);
}
-
- virtual bool AcceptWithResponder(mojo::Message* message,
- mojo::MessageReceiver* responder)
- MOJO_OVERRIDE {
- return false;
- }
};
} // namespace