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

Unified Diff: remoting/protocol/host_message_dispatcher.h

Issue 4336001: Stub classes for Chromoting and use them in HostMessageDispatcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years, 1 month 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 | « remoting/protocol/host_event_message_handler.h ('k') | remoting/protocol/host_message_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/host_message_dispatcher.h
diff --git a/remoting/protocol/host_message_dispatcher.h b/remoting/protocol/host_message_dispatcher.h
index 23dc55af06a92dfe2fa7f4e49d0f339d4804f173..73577234f5fa002da1b766d6e662a9ab94ea1a8b 100644
--- a/remoting/protocol/host_message_dispatcher.h
+++ b/remoting/protocol/host_message_dispatcher.h
@@ -8,16 +8,20 @@
#include "base/basictypes.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
+#include "base/task.h"
namespace remoting {
class ChromotocolConnection;
-class ClientControlMessage;
-class ClientEventMessage;
-class HostControlMessageHandler;
-class HostEventMessageHandler;
+class EventMessage;
class MessageReader;
+namespace protocol {
+
+class ControlMessage;
+class HostStub;
+class InputStub;
+
// A message dispatcher used to listen for messages received in
// ChromotocolConnection. It dispatches messages to the corresponding
// handler.
@@ -39,35 +43,16 @@ class HostMessageDispatcher :
// message handlers.
// Return true if initalization was successful.
bool Initialize(ChromotocolConnection* connection,
- HostControlMessageHandler* control_message_handler,
- HostEventMessageHandler* event_message_handler);
+ HostStub* host_stub, InputStub* input_stub);
private:
- // A single protobuf can contain multiple messages that will be handled by
- // different message handlers. We use this wrapper to ensure that the
- // protobuf is only deleted after all the handlers have finished executing.
- template <typename T>
- class RefCountedMessage : public base::RefCounted<RefCountedMessage<T> > {
- public:
- RefCountedMessage(T* message) : message_(message) { }
-
- T* message() { return message_.get(); }
-
- private:
- scoped_ptr<T> message_;
- };
-
// This method is called by |control_channel_reader_| when a control
// message is received.
- void OnControlMessageReceived(ClientControlMessage* message);
+ void OnControlMessageReceived(ControlMessage* message);
// This method is called by |event_channel_reader_| when a event
// message is received.
- void OnEventMessageReceived(ClientEventMessage* message);
-
- // Dummy methods to destroy messages.
- template <class T>
- static void DeleteMessage(scoped_refptr<T> message) { }
+ void OnEventMessageReceived(EventMessage* message);
// MessageReader that runs on the control channel. It runs a loop
// that parses data on the channel and then delegates the message to this
@@ -77,12 +62,13 @@ class HostMessageDispatcher :
// MessageReader that runs on the event channel.
scoped_ptr<MessageReader> event_message_reader_;
- // Event handlers for control channel and event channel respectively.
- // Method calls to these objects are made on the message loop given.
- scoped_ptr<HostControlMessageHandler> control_message_handler_;
- scoped_ptr<HostEventMessageHandler> event_message_handler_;
+ // Stubs for host and input. These objects are not owned.
+ // They are called on the thread there data is received, i.e. jingle thread.
+ HostStub* host_stub_;
+ InputStub* input_stub_;
};
+} // namespace protocol
} // namespace remoting
#endif // REMOTING_PROTOCOL_HOST_MESSAGE_DISPATCHER_H_
« no previous file with comments | « remoting/protocol/host_event_message_handler.h ('k') | remoting/protocol/host_message_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698