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

Unified Diff: remoting/protocol/channel_multiplexer.h

Issue 10981009: Fix ChannelMultiplexer to properly handle base channel creation failure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
« no previous file with comments | « no previous file | remoting/protocol/channel_multiplexer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/channel_multiplexer.h
diff --git a/remoting/protocol/channel_multiplexer.h b/remoting/protocol/channel_multiplexer.h
index 0f16fb16da0d877c0a05e510b71ed4a68f13f84a..74c86ef9c87aa3ee5963646cb3131cb337b42ca6 100644
--- a/remoting/protocol/channel_multiplexer.h
+++ b/remoting/protocol/channel_multiplexer.h
@@ -5,6 +5,7 @@
#ifndef REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_
#define REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_
+#include "base/memory/weak_ptr.h"
#include "remoting/proto/mux.pb.h"
#include "remoting/protocol/buffered_socket_writer.h"
#include "remoting/protocol/channel_factory.h"
@@ -40,11 +41,19 @@ class ChannelMultiplexer : public ChannelFactory {
// Callback for |base_channel_| creation.
void OnBaseChannelReady(scoped_ptr<net::StreamSocket> socket);
+ // Helper to create channels asynchronously.
+ void DoCreatePendingChannels();
+
// Helper method used to create channels.
MuxChannel* GetOrCreateChannel(const std::string& name);
- // Callbacks for |writer_| and |reader_|.
+ // Error handling callback for |writer_|.
void OnWriteFailed(int error);
+
+ // Failed write notifier, queued asynchronously by OnWriteFailed().
+ void NotifyWriteFailed(const std::string& name);
+
+ // Callback for |reader_;
void OnIncomingPacket(scoped_ptr<MultiplexPacket> packet,
const base::Closure& done_task);
@@ -75,8 +84,7 @@ class ChannelMultiplexer : public ChannelFactory {
BufferedSocketWriter writer_;
ProtobufMessageReader<MultiplexPacket> reader_;
- // Flag used by OnWriteFailed() to detect when the multiplexer is destroyed.
- bool* destroyed_flag_;
+ base::WeakPtrFactory<ChannelMultiplexer> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ChannelMultiplexer);
};
« no previous file with comments | « no previous file | remoting/protocol/channel_multiplexer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698