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

Unified Diff: ipc/mojo/ipc_channel_mojo.cc

Issue 954643002: Update mojo sdk to rev 3d23dae011859a2aae49f1d1adde705c8e85d819 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use run_renderer_in_process() 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
« no previous file with comments | « ipc/mojo/ipc_channel_mojo.h ('k') | ipc/mojo/ipc_channel_mojo_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/mojo/ipc_channel_mojo.cc
diff --git a/ipc/mojo/ipc_channel_mojo.cc b/ipc/mojo/ipc_channel_mojo.cc
index 0c6c99478c2670cb752cb18e1739c4c4ae3b1400..6cf8130e84717d44e217c9f81679f0095b83ef8b 100644
--- a/ipc/mojo/ipc_channel_mojo.cc
+++ b/ipc/mojo/ipc_channel_mojo.cc
@@ -48,9 +48,9 @@ class MojoChannelFactory : public ChannelFactory {
//------------------------------------------------------------------------------
-class ClientChannelMojo
- : public ChannelMojo,
- public NON_EXPORTED_BASE(mojo::InterfaceImpl<ClientChannel>) {
+class ClientChannelMojo : public ChannelMojo,
+ public ClientChannel,
+ public mojo::ErrorHandler {
public:
ClientChannelMojo(ChannelMojo::Delegate* delegate,
const ChannelHandle& handle,
@@ -58,7 +58,7 @@ class ClientChannelMojo
~ClientChannelMojo() override;
// MojoBootstrap::Delegate implementation
void OnPipeAvailable(mojo::embedder::ScopedPlatformHandle handle) override;
- // InterfaceImpl implementation
+ // mojo::ErrorHandler implementation
void OnConnectionError() override;
// ClientChannel implementation
void Init(
@@ -66,13 +66,17 @@ class ClientChannelMojo
int32_t peer_pid,
const mojo::Callback<void(int32_t)>& callback) override;
+ private:
+ mojo::Binding<ClientChannel> binding_;
+
DISALLOW_COPY_AND_ASSIGN(ClientChannelMojo);
};
ClientChannelMojo::ClientChannelMojo(ChannelMojo::Delegate* delegate,
const ChannelHandle& handle,
Listener* listener)
- : ChannelMojo(delegate, handle, Channel::MODE_CLIENT, listener) {
+ : ChannelMojo(delegate, handle, Channel::MODE_CLIENT, listener),
+ binding_(this) {
}
ClientChannelMojo::~ClientChannelMojo() {
@@ -80,7 +84,7 @@ ClientChannelMojo::~ClientChannelMojo() {
void ClientChannelMojo::OnPipeAvailable(
mojo::embedder::ScopedPlatformHandle handle) {
- mojo::WeakBindToPipe(this, CreateMessagingPipe(handle.Pass()));
+ binding_.Bind(CreateMessagingPipe(handle.Pass()));
}
void ClientChannelMojo::OnConnectionError() {
@@ -106,7 +110,7 @@ class ServerChannelMojo : public ChannelMojo, public mojo::ErrorHandler {
// MojoBootstrap::Delegate implementation
void OnPipeAvailable(mojo::embedder::ScopedPlatformHandle handle) override;
- // ErrorHandler implementation
+ // mojo::ErrorHandler implementation
void OnConnectionError() override;
// Channel override
void Close() override;
@@ -180,7 +184,7 @@ base::ScopedFD TakeOrDupFile(internal::PlatformFileAttachment* attachment) {
void ChannelMojo::ChannelInfoDeleter::operator()(
mojo::embedder::ChannelInfo* ptr) const {
- mojo::embedder::DestroyChannel(ptr);
+ mojo::embedder::DestroyChannel(ptr, base::Bind(&base::DoNothing), nullptr);
}
//------------------------------------------------------------------------------
@@ -219,9 +223,10 @@ scoped_ptr<ChannelFactory> ChannelMojo::CreateServerFactory(
// static
scoped_ptr<ChannelFactory> ChannelMojo::CreateClientFactory(
+ ChannelMojo::Delegate* delegate,
const ChannelHandle& channel_handle) {
return make_scoped_ptr(
- new MojoChannelFactory(NULL, channel_handle, Channel::MODE_CLIENT));
+ new MojoChannelFactory(delegate, channel_handle, Channel::MODE_CLIENT));
}
ChannelMojo::ChannelMojo(ChannelMojo::Delegate* delegate,
@@ -253,6 +258,8 @@ ChannelMojo::~ChannelMojo() {
}
void ChannelMojo::InitDelegate(ChannelMojo::Delegate* delegate) {
+ ipc_support_.reset(
+ new ScopedIPCSupport(base::MessageLoop::current()->task_runner()));
delegate_ = delegate->ToWeakPtr();
delegate_->OnChannelCreated(weak_factory_.GetWeakPtr());
}
@@ -275,6 +282,7 @@ bool ChannelMojo::Connect() {
void ChannelMojo::Close() {
message_reader_.reset();
channel_info_.reset();
+ ipc_support_.reset();
}
void ChannelMojo::OnBootstrapError() {
@@ -288,7 +296,7 @@ void ChannelMojo::InitMessageReader(mojo::ScopedMessagePipeHandle pipe,
for (size_t i = 0; i < pending_messages_.size(); ++i) {
bool sent = message_reader_->Send(make_scoped_ptr(pending_messages_[i]));
- pending_messages_[i] = NULL;
+ pending_messages_[i] = nullptr;
if (!sent) {
pending_messages_.clear();
listener_->OnChannelError();
« no previous file with comments | « ipc/mojo/ipc_channel_mojo.h ('k') | ipc/mojo/ipc_channel_mojo_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698