summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-03 19:56:17 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-03 19:56:17 +0000
commit3714c8b156378fb4ce5357ea28e73c7e2f255a63 (patch)
treeb7a6354e7a59b75b59e7258db75bf136732492b0
parented5ddb14ce14bef9a5e6aec853bcc1e344184b1f (diff)
downloadchromium_src-3714c8b156378fb4ce5357ea28e73c7e2f255a63.zip
chromium_src-3714c8b156378fb4ce5357ea28e73c7e2f255a63.tar.gz
chromium_src-3714c8b156378fb4ce5357ea28e73c7e2f255a63.tar.bz2
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 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254541 0039d316-1c4b-4281-b951-d872f2087c98
-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, 197 insertions, 68 deletions
diff --git a/mojo/mojo_public.gypi b/mojo/mojo_public.gypi
index b4ad543..8a88155 100644
--- a/mojo/mojo_public.gypi
+++ b/mojo/mojo_public.gypi
@@ -222,6 +222,7 @@
'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 6add826..960171c 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());
- message.AdoptData(builder.Finish());
+ builder.Finish(&message);
receiver_->Accept(&message);
}
@@ -76,12 +76,12 @@ params->{{param.name}}()
{%- endmacro %}
bool {{class_name}}Stub::Accept(mojo::Message* message) {
- switch (message->data()->header.name) {
+ switch (message->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_data()->payload);
+ message->mutable_payload());
if (!params->DecodePointersAndHandles(message))
return false;
@@ -93,3 +93,9 @@ 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 a01c5f4..e5da257 100644
--- a/mojo/public/bindings/generators/cpp_templates/interface_stub_declaration.tmpl
+++ b/mojo/public/bindings/generators/cpp_templates/interface_stub_declaration.tmpl
@@ -3,6 +3,9 @@ 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 a472b07..36d4bab 100644
--- a/mojo/public/bindings/interface.h
+++ b/mojo/public/bindings/interface.h
@@ -22,6 +22,8 @@ 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 f0b14d6..31603a4 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 = reinterpret_cast<const uint8_t*>(message.data());
- const uint8_t* data_end = data_start + message.data()->header.num_bytes;
+ const uint8_t* data_start = message.data();
+ const uint8_t* data_end = data_start + message.data_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 e2709fd..076e30b 100644
--- a/mojo/public/bindings/lib/connector.cc
+++ b/mojo/public/bindings/lib/connector.cc
@@ -4,6 +4,7 @@
#include "mojo/public/bindings/lib/connector.h"
+#include <assert.h>
#include <stdlib.h>
#include "mojo/public/bindings/error_handler.h"
@@ -42,7 +43,7 @@ bool Connector::Accept(Message* message) {
MojoResult rv = WriteMessageRaw(
message_pipe_.get(),
message->data(),
- message->data()->header.num_bytes,
+ message->data_num_bytes(),
message->mutable_handles()->empty() ? NULL :
reinterpret_cast<const MojoHandle*>(
&message->mutable_handles()->front()),
@@ -70,6 +71,13 @@ 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);
@@ -119,7 +127,7 @@ void Connector::ReadMore() {
}
Message message;
- message.AllocData(num_bytes);
+ message.AllocUninitializedData(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 09bc4b5..c0d9802 100644
--- a/mojo/public/bindings/lib/connector.h
+++ b/mojo/public/bindings/lib/connector.h
@@ -48,6 +48,8 @@ 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 a7cf3ff..cb7b11d 100644
--- a/mojo/public/bindings/lib/interface.cc
+++ b/mojo/public/bindings/lib/interface.cc
@@ -10,5 +10,10 @@ 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 56561b3..f33f250a 100644
--- a/mojo/public/bindings/lib/message.cc
+++ b/mojo/public/bindings/lib/message.cc
@@ -12,7 +12,8 @@
namespace mojo {
Message::Message()
- : data_(NULL) {
+ : data_num_bytes_(0),
+ data_(NULL) {
}
Message::~Message() {
@@ -25,17 +26,20 @@ Message::~Message() {
}
}
-void Message::AllocData(uint32_t num_bytes) {
+void Message::AllocUninitializedData(uint32_t num_bytes) {
assert(!data_);
- data_ = static_cast<MessageData*>(malloc(num_bytes));
+ data_num_bytes_ = num_bytes;
+ data_ = static_cast<internal::MessageData*>(malloc(num_bytes));
}
-void Message::AdoptData(MessageData* data) {
+void Message::AdoptData(uint32_t num_bytes, internal::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 a553e68..5cbe037 100644
--- a/mojo/public/bindings/lib/message_builder.cc
+++ b/mojo/public/bindings/lib/message_builder.cc
@@ -9,19 +9,43 @@
namespace mojo {
namespace internal {
-MessageBuilder::MessageBuilder(uint32_t message_name, size_t payload_size)
+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)
: buf_(sizeof(MessageHeader) + payload_size) {
- MessageHeader* header =
- static_cast<MessageHeader*>(buf_.Allocate(sizeof(MessageHeader)));
- header->num_bytes = static_cast<uint32_t>(buf_.size());
- header->name = message_name;
+ MessageHeader* header;
+ Allocate(&buf_, &header);
+ header->num_fields = 2;
+ header->name = name;
}
MessageBuilder::~MessageBuilder() {
}
-MessageData* MessageBuilder::Finish() {
- return static_cast<MessageData*>(buf_.Leak());
+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;
}
} // namespace internal
diff --git a/mojo/public/bindings/lib/message_builder.h b/mojo/public/bindings/lib/message_builder.h
index a8dfdfa..a8a0240 100644
--- a/mojo/public/bindings/lib/message_builder.h
+++ b/mojo/public/bindings/lib/message_builder.h
@@ -10,14 +10,13 @@
#include "mojo/public/bindings/lib/fixed_buffer.h"
namespace mojo {
-struct MessageData;
+class Message;
namespace internal {
-// Used to construct a MessageData object.
class MessageBuilder {
public:
- MessageBuilder(uint32_t message_name, size_t payload_size);
+ MessageBuilder(uint32_t name, size_t payload_size);
~MessageBuilder();
Buffer* buffer() { return &buf_; }
@@ -25,14 +24,21 @@ 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.
- MessageData* Finish();
+ void Finish(Message* message);
- private:
+ protected:
+ explicit MessageBuilder(size_t size);
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
new file mode 100644
index 0000000..d3f8338
--- /dev/null
+++ b/mojo/public/bindings/lib/message_internal.h
@@ -0,0 +1,50 @@
+// 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 eee0be4..f27fc17 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.AllocData(num_bytes);
+ message.AllocUninitializedData(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 fa13515..7b058b8 100644
--- a/mojo/public/bindings/message.h
+++ b/mojo/public/bindings/message.h
@@ -5,52 +5,60 @@
#ifndef MOJO_PUBLIC_BINDINGS_MESSAGE_H_
#define MOJO_PUBLIC_BINDINGS_MESSAGE_H_
+#include <assert.h>
+
#include <vector>
-#include "mojo/public/system/core_cpp.h"
+#include "mojo/public/bindings/lib/message_internal.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
-// manipulate the data and handles members.
+// mutate the data and handles members. The message's data is comprised of a
+// header followed by payload.
class Message {
public:
Message();
~Message();
- // These may only be called on a newly initialized Message object.
- void AllocData(uint32_t num_bytes); // |data()| is uninitialized.
- void AdoptData(MessageData* data);
+ // 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);
// Swaps data and handles between this Message and another.
void Swap(Message* other);
- const MessageData* data() const { return data_; }
- MessageData* mutable_data() { return data_; }
+ 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; }
+ // 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:
- MessageData* data_; // Heap-allocated using malloc.
+ uint32_t data_num_bytes_;
+ internal::MessageData* data_; // Heap-allocated using malloc.
std::vector<Handle> handles_;
MOJO_DISALLOW_COPY_AND_ASSIGN(Message);
@@ -58,11 +66,17 @@ class Message {
class MessageReceiver {
public:
- // 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
+ // The receiver may mutate the given message. 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 8ff7de5..b0f9cf1 100644
--- a/mojo/public/bindings/tests/connector_unittest.cc
+++ b/mojo/public/bindings/tests/connector_unittest.cc
@@ -6,6 +6,7 @@
#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"
@@ -25,6 +26,11 @@ class MessageAccumulator : public MessageReceiver {
return true;
}
+ virtual bool AcceptWithResponder(Message* message, MessageReceiver* responder)
+ MOJO_OVERRIDE {
+ return false;
+ }
+
bool IsEmpty() const {
return queue_.IsEmpty();
}
@@ -51,12 +57,9 @@ class ConnectorTest : public testing::Test {
void AllocMessage(const char* text, Message* message) {
size_t payload_size = strlen(text) + 1; // Plus null terminator.
- 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);
+ internal::MessageBuilder builder(1, payload_size);
+ memcpy(builder.buffer()->Allocate(payload_size), text, payload_size);
+ builder.Finish(message);
}
void PumpMessages() {
@@ -95,8 +98,7 @@ TEST_F(ConnectorTest, Basic) {
EXPECT_EQ(
std::string(kText),
- std::string(
- reinterpret_cast<const char*>(message_received.data()->payload)));
+ std::string(reinterpret_cast<const char*>(message_received.payload())));
}
TEST_F(ConnectorTest, Basic_EarlyIncomingReceiver) {
@@ -122,8 +124,7 @@ TEST_F(ConnectorTest, Basic_EarlyIncomingReceiver) {
EXPECT_EQ(
std::string(kText),
- std::string(
- reinterpret_cast<const char*>(message_received.data()->payload)));
+ std::string(reinterpret_cast<const char*>(message_received.payload())));
}
TEST_F(ConnectorTest, Basic_TwoMessages) {
@@ -152,8 +153,7 @@ TEST_F(ConnectorTest, Basic_TwoMessages) {
EXPECT_EQ(
std::string(kText[i]),
- std::string(
- reinterpret_cast<const char*>(message_received.data()->payload)));
+ std::string(reinterpret_cast<const char*>(message_received.payload())));
}
}
@@ -215,8 +215,7 @@ TEST_F(ConnectorTest, MessageWithHandles) {
EXPECT_EQ(
std::string(kText),
- std::string(
- reinterpret_cast<const char*>(message_received.data()->payload)));
+ std::string(reinterpret_cast<const char*>(message_received.payload())));
ASSERT_EQ(1U, message_received.handles()->size());
// Now send a message to the transferred handle and confirm it's sent through
@@ -243,8 +242,7 @@ TEST_F(ConnectorTest, MessageWithHandles) {
EXPECT_EQ(
std::string(kText),
- std::string(
- reinterpret_cast<const char*>(message_received.data()->payload)));
+ std::string(reinterpret_cast<const char*>(message_received.payload())));
}
} // namespace test
diff --git a/mojo/public/bindings/tests/sample_service_unittest.cc b/mojo/public/bindings/tests/sample_service_unittest.cc
index b7d8f6c..390c78b 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()->header.num_bytes);
+ message->data_num_bytes());
}
// In the receiving process, an implementation of ServiceStub is known to
@@ -281,6 +281,12 @@ 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