diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-04 00:46:01 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-04 00:46:01 +0000 |
commit | d87c404738c7c89968ee01353d71d3a31f91669f (patch) | |
tree | 91e581d1d29cbcb64f22634961bb212b674ed1c7 /remoting | |
parent | de9bdd1e4d2f87f53b1c2d3eacfbe43ef6ca1019 (diff) | |
download | chromium_src-d87c404738c7c89968ee01353d71d3a31f91669f.zip chromium_src-d87c404738c7c89968ee01353d71d3a31f91669f.tar.gz chromium_src-d87c404738c7c89968ee01353d71d3a31f91669f.tar.bz2 |
Move protocol classes to the remoting::protocol namespace
BUG=None
TEST=compiles
Review URL: http://codereview.chromium.org/4233005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65006 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
47 files changed, 148 insertions, 79 deletions
diff --git a/remoting/client/chromoting_client.cc b/remoting/client/chromoting_client.cc index c47ecd8..edb1ce3 100644 --- a/remoting/client/chromoting_client.cc +++ b/remoting/client/chromoting_client.cc @@ -17,7 +17,7 @@ namespace remoting { ChromotingClient::ChromotingClient(const ClientConfig& config, ClientContext* context, - HostConnection* connection, + protocol::HostConnection* connection, ChromotingView* view, RectangleUpdateDecoder* rectangle_decoder, InputHandler* input_handler, @@ -93,7 +93,7 @@ void ChromotingClient::SetViewport(int x, int y, int width, int height) { view_->SetViewport(x, y, width, height); } -void ChromotingClient::HandleMessage(HostConnection* conn, +void ChromotingClient::HandleMessage(protocol::HostConnection* conn, ChromotingHostMessage* msg) { if (message_loop() != MessageLoop::current()) { message_loop()->PostTask( @@ -146,17 +146,17 @@ void ChromotingClient::DispatchPacket() { *packet, NewTracedMethod(this, &ChromotingClient::OnPacketDone)); } -void ChromotingClient::OnConnectionOpened(HostConnection* conn) { +void ChromotingClient::OnConnectionOpened(protocol::HostConnection* conn) { VLOG(1) << "ChromotingClient::OnConnectionOpened"; SetConnectionState(CONNECTED); } -void ChromotingClient::OnConnectionClosed(HostConnection* conn) { +void ChromotingClient::OnConnectionClosed(protocol::HostConnection* conn) { VLOG(1) << "ChromotingClient::OnConnectionClosed"; SetConnectionState(DISCONNECTED); } -void ChromotingClient::OnConnectionFailed(HostConnection* conn) { +void ChromotingClient::OnConnectionFailed(protocol::HostConnection* conn) { VLOG(1) << "ChromotingClient::OnConnectionFailed"; SetConnectionState(FAILED); } diff --git a/remoting/client/chromoting_client.h b/remoting/client/chromoting_client.h index 57e799c..bb7688a 100644 --- a/remoting/client/chromoting_client.h +++ b/remoting/client/chromoting_client.h @@ -26,13 +26,13 @@ class InputHandler; class RectangleUpdateDecoder; // TODO(sergeyu): Move VideoStub implementation to RectangleUpdateDecoder. -class ChromotingClient : public HostConnection::HostEventCallback, - public VideoStub { +class ChromotingClient : public protocol::HostConnection::HostEventCallback, + public protocol::VideoStub { public: // Objects passed in are not owned by this class. ChromotingClient(const ClientConfig& config, ClientContext* context, - HostConnection* connection, + protocol::HostConnection* connection, ChromotingView* view, RectangleUpdateDecoder* rectangle_decoder, InputHandler* input_handler, @@ -55,11 +55,11 @@ class ChromotingClient : public HostConnection::HostEventCallback, virtual void SetViewport(int x, int y, int width, int height); // HostConnection::HostEventCallback implementation. - virtual void HandleMessage(HostConnection* conn, + virtual void HandleMessage(protocol::HostConnection* conn, ChromotingHostMessage* messages); - virtual void OnConnectionOpened(HostConnection* conn); - virtual void OnConnectionClosed(HostConnection* conn); - virtual void OnConnectionFailed(HostConnection* conn); + virtual void OnConnectionOpened(protocol::HostConnection* conn); + virtual void OnConnectionClosed(protocol::HostConnection* conn); + virtual void OnConnectionFailed(protocol::HostConnection* conn); // VideoStub implementation. virtual void ProcessVideoPacket(const VideoPacket* packet, Task* done); @@ -90,7 +90,7 @@ class ChromotingClient : public HostConnection::HostEventCallback, // The following are not owned by this class. ClientConfig config_; ClientContext* context_; - HostConnection* connection_; + protocol::HostConnection* connection_; ChromotingView* view_; RectangleUpdateDecoder* rectangle_decoder_; InputHandler* input_handler_; diff --git a/remoting/client/host_connection.h b/remoting/client/host_connection.h index 3d27ceb..9cdcbc1 100644 --- a/remoting/client/host_connection.h +++ b/remoting/client/host_connection.h @@ -12,10 +12,12 @@ namespace remoting { -class VideoStub; - struct ClientConfig; +namespace protocol { + +class VideoStub; + class HostConnection { public: class HostEventCallback { @@ -55,6 +57,7 @@ class HostConnection { DISALLOW_COPY_AND_ASSIGN(HostConnection); }; +} // namespace protocol } // namespace remoting #endif // REMOTING_CLIENT_HOST_CONNECTION_H_ diff --git a/remoting/client/input_handler.cc b/remoting/client/input_handler.cc index 69c70c5..c9a7fe7 100644 --- a/remoting/client/input_handler.cc +++ b/remoting/client/input_handler.cc @@ -12,7 +12,7 @@ namespace remoting { InputHandler::InputHandler(ClientContext* context, - HostConnection* connection, + protocol::HostConnection* connection, ChromotingView* view) : context_(context), connection_(connection), diff --git a/remoting/client/input_handler.h b/remoting/client/input_handler.h index 6f2e376..91af063 100644 --- a/remoting/client/input_handler.h +++ b/remoting/client/input_handler.h @@ -13,12 +13,15 @@ namespace remoting { class ClientContext; class ChromotingView; + +namespace protocol { class HostConnection; +} // namespace protocol class InputHandler { public: InputHandler(ClientContext* context, - HostConnection* connection, + protocol::HostConnection* connection, ChromotingView* view); virtual ~InputHandler() {} @@ -30,7 +33,7 @@ class InputHandler { void SendMouseButtonEvent(bool down, MouseButton button); ClientContext* context_; - HostConnection* connection_; + protocol::HostConnection* connection_; ChromotingView* view_; private: diff --git a/remoting/client/jingle_host_connection.cc b/remoting/client/jingle_host_connection.cc index aa55c84..62a1841 100644 --- a/remoting/client/jingle_host_connection.cc +++ b/remoting/client/jingle_host_connection.cc @@ -11,10 +11,12 @@ #include "remoting/client/jingle_host_connection.h" #include "remoting/jingle_glue/jingle_thread.h" #include "remoting/protocol/jingle_session_manager.h" +#include "remoting/protocol/video_reader.h" #include "remoting/protocol/video_stub.h" #include "remoting/protocol/util.h" namespace remoting { +namespace protocol { JingleHostConnection::JingleHostConnection(ClientContext* context) : context_(context), @@ -171,4 +173,5 @@ MessageLoop* JingleHostConnection::message_loop() { return context_->jingle_thread()->message_loop(); } +} // namespace protocol } // namespace remoting diff --git a/remoting/client/jingle_host_connection.h b/remoting/client/jingle_host_connection.h index 16d0b14..a7362fb 100644 --- a/remoting/client/jingle_host_connection.h +++ b/remoting/client/jingle_host_connection.h @@ -29,17 +29,18 @@ #include "remoting/protocol/session.h" #include "remoting/protocol/session_manager.h" #include "remoting/protocol/stream_writer.h" -#include "remoting/protocol/video_reader.h" class MessageLoop; namespace remoting { +struct ClientConfig; +class JingleThread; + namespace protocol { -class VideoStub; -} // namespace protocol -struct ClientConfig; +class VideoReader; +class VideoStub; class JingleHostConnection : public HostConnection, public JingleClient::Callback { @@ -102,8 +103,9 @@ class JingleHostConnection : public HostConnection, DISALLOW_COPY_AND_ASSIGN(JingleHostConnection); }; +} // namespace protocol } // namespace remoting -DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::JingleHostConnection); +DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::protocol::JingleHostConnection); #endif // REMOTING_CLIENT_JINGLE_HOST_CONNECTION_H_ diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc index 67979c0..80ce290 100644 --- a/remoting/client/plugin/chromoting_instance.cc +++ b/remoting/client/plugin/chromoting_instance.cc @@ -67,7 +67,7 @@ bool ChromotingInstance::Init(uint32_t argc, context_.Start(); // Create the chromoting objects. - host_connection_.reset(new JingleHostConnection(&context_)); + host_connection_.reset(new protocol::JingleHostConnection(&context_)); view_.reset(new PepperView(this, &context_)); rectangle_decoder_.reset( new RectangleUpdateDecoder(context_.decode_message_loop(), view_.get())); diff --git a/remoting/client/plugin/chromoting_instance.h b/remoting/client/plugin/chromoting_instance.h index f706478..9f6bec2 100644 --- a/remoting/client/plugin/chromoting_instance.h +++ b/remoting/client/plugin/chromoting_instance.h @@ -36,12 +36,15 @@ namespace remoting { class ChromotingClient; class ClientContext; -class HostConnection; class InputHandler; class JingleThread; class PepperView; class RectangleUpdateDecoder; +namespace protocol { +class HostConnection; +} // namespace protocol + class ChromotingInstance : public pp::Instance { public: // The mimetype for which this plugin is registered. @@ -74,7 +77,7 @@ class ChromotingInstance : public pp::Instance { MessageLoop* pepper_main_loop_dont_post_to_me_; ClientContext context_; - scoped_ptr<HostConnection> host_connection_; + scoped_ptr<protocol::HostConnection> host_connection_; scoped_ptr<PepperView> view_; scoped_ptr<RectangleUpdateDecoder> rectangle_decoder_; scoped_ptr<InputHandler> input_handler_; diff --git a/remoting/client/plugin/pepper_input_handler.cc b/remoting/client/plugin/pepper_input_handler.cc index 5599655..3398cf4 100644 --- a/remoting/client/plugin/pepper_input_handler.cc +++ b/remoting/client/plugin/pepper_input_handler.cc @@ -9,7 +9,7 @@ namespace remoting { PepperInputHandler::PepperInputHandler(ClientContext* context, - HostConnection* connection, + protocol::HostConnection* connection, ChromotingView* view) : InputHandler(context, connection, view) { } diff --git a/remoting/client/plugin/pepper_input_handler.h b/remoting/client/plugin/pepper_input_handler.h index f7ad657..14df881 100644 --- a/remoting/client/plugin/pepper_input_handler.h +++ b/remoting/client/plugin/pepper_input_handler.h @@ -16,7 +16,7 @@ namespace remoting { class PepperInputHandler : public InputHandler { public: PepperInputHandler(ClientContext* context, - HostConnection* connection, + protocol::HostConnection* connection, ChromotingView* view); virtual ~PepperInputHandler(); diff --git a/remoting/client/x11_client.cc b/remoting/client/x11_client.cc index 258f20f..91d32d6 100644 --- a/remoting/client/x11_client.cc +++ b/remoting/client/x11_client.cc @@ -30,7 +30,7 @@ int main(int argc, char** argv) { MessageLoop ui_loop; remoting::ClientContext context; - remoting::JingleHostConnection connection(&context); + remoting::protocol::JingleHostConnection connection(&context); remoting::X11View view; remoting::RectangleUpdateDecoder rectangle_decoder( context.decode_message_loop(), &view); diff --git a/remoting/client/x11_input_handler.cc b/remoting/client/x11_input_handler.cc index bd63af9..84a21c3 100644 --- a/remoting/client/x11_input_handler.cc +++ b/remoting/client/x11_input_handler.cc @@ -17,7 +17,7 @@ namespace remoting { X11InputHandler::X11InputHandler(ClientContext* context, - HostConnection* connection, + protocol::HostConnection* connection, ChromotingView* view) : InputHandler(context, connection, view) { } diff --git a/remoting/client/x11_input_handler.h b/remoting/client/x11_input_handler.h index e84e4b9..3dd34d7 100644 --- a/remoting/client/x11_input_handler.h +++ b/remoting/client/x11_input_handler.h @@ -15,7 +15,7 @@ class ChromotingView; class X11InputHandler : public InputHandler { public: X11InputHandler(ClientContext* context, - HostConnection* connection, + protocol::HostConnection* connection, ChromotingView* view); virtual ~X11InputHandler(); diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc index 4a75d52..89389a6 100644 --- a/remoting/host/chromoting_host.cc +++ b/remoting/host/chromoting_host.cc @@ -134,7 +134,7 @@ void ChromotingHost::Shutdown() { } // This method is called if a client is connected to this object. -void ChromotingHost::OnClientConnected(ClientConnection* client) { +void ChromotingHost::OnClientConnected(protocol::ClientConnection* client) { DCHECK_EQ(context_->main_message_loop(), MessageLoop::current()); // Create a new RecordSession if there was none. @@ -158,7 +158,7 @@ void ChromotingHost::OnClientConnected(ClientConnection* client) { VLOG(1) << "Session manager started"; } -void ChromotingHost::OnClientDisconnected(ClientConnection* client) { +void ChromotingHost::OnClientDisconnected(protocol::ClientConnection* client) { DCHECK_EQ(context_->main_message_loop(), MessageLoop::current()); // Remove the client from the session manager and pause the session. @@ -176,8 +176,8 @@ void ChromotingHost::OnClientDisconnected(ClientConnection* client) { } //////////////////////////////////////////////////////////////////////////// -// ClientConnection::EventHandler implementations -void ChromotingHost::HandleMessage(ClientConnection* client, +// protocol::ClientConnection::EventHandler implementations +void ChromotingHost::HandleMessage(protocol::ClientConnection* client, ChromotingClientMessage* message) { DCHECK_EQ(context_->main_message_loop(), MessageLoop::current()); @@ -187,7 +187,7 @@ void ChromotingHost::HandleMessage(ClientConnection* client, executor_->HandleInputEvent(message); } -void ChromotingHost::OnConnectionOpened(ClientConnection* client) { +void ChromotingHost::OnConnectionOpened(protocol::ClientConnection* client) { DCHECK_EQ(context_->main_message_loop(), MessageLoop::current()); // Completes the client connection. @@ -195,14 +195,14 @@ void ChromotingHost::OnConnectionOpened(ClientConnection* client) { OnClientConnected(client_.get()); } -void ChromotingHost::OnConnectionClosed(ClientConnection* client) { +void ChromotingHost::OnConnectionClosed(protocol::ClientConnection* client) { DCHECK_EQ(context_->main_message_loop(), MessageLoop::current()); VLOG(1) << "Connection to client closed."; OnClientDisconnected(client_.get()); } -void ChromotingHost::OnConnectionFailed(ClientConnection* client) { +void ChromotingHost::OnConnectionFailed(protocol::ClientConnection* client) { DCHECK_EQ(context_->main_message_loop(), MessageLoop::current()); LOG(ERROR) << "Connection failed unexpectedly."; @@ -281,7 +281,7 @@ void ChromotingHost::OnNewClientSession( // If we accept the connected then create a client object and set the // callback. - client_ = new ClientConnection(context_->main_message_loop(), this); + client_ = new protocol::ClientConnection(context_->main_message_loop(), this); client_->Init(session); } @@ -308,5 +308,4 @@ Encoder* ChromotingHost::CreateEncoder(const ChromotocolConfig* config) { return NULL; } - } // namespace remoting diff --git a/remoting/host/chromoting_host.h b/remoting/host/chromoting_host.h index b091cb3..04b0d2b 100644 --- a/remoting/host/chromoting_host.h +++ b/remoting/host/chromoting_host.h @@ -56,7 +56,7 @@ class SessionManager; // return to the idle state. We then go to step (2) if there a new // incoming connection. class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, - public ClientConnection::EventHandler, + public protocol::ClientConnection::EventHandler, public JingleClient::Callback { public: ChromotingHost(ChromotingHostContext* context, MutableHostConfig* config, @@ -78,18 +78,18 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, void Shutdown(); // This method is called if a client is connected to this object. - void OnClientConnected(ClientConnection* client); + void OnClientConnected(protocol::ClientConnection* client); // This method is called if a client is disconnected from the host. - void OnClientDisconnected(ClientConnection* client); + void OnClientDisconnected(protocol::ClientConnection* client); //////////////////////////////////////////////////////////////////////////// - // ClientConnection::EventHandler implementations - virtual void HandleMessage(ClientConnection* client, + // protocol::ClientConnection::EventHandler implementations + virtual void HandleMessage(protocol::ClientConnection* client, ChromotingClientMessage* message); - virtual void OnConnectionOpened(ClientConnection* client); - virtual void OnConnectionClosed(ClientConnection* client); - virtual void OnConnectionFailed(ClientConnection* client); + virtual void OnConnectionOpened(protocol::ClientConnection* client); + virtual void OnConnectionClosed(protocol::ClientConnection* client); + virtual void OnConnectionFailed(protocol::ClientConnection* client); //////////////////////////////////////////////////////////////////////////// // JingleClient::Callback implementations @@ -145,7 +145,7 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, // A ClientConnection manages the connectino to a remote client. // TODO(hclam): Expand this to a list of clients. - scoped_refptr<ClientConnection> client_; + scoped_refptr<protocol::ClientConnection> client_; // Session manager for the host process. scoped_refptr<SessionManager> session_; diff --git a/remoting/host/client_connection.cc b/remoting/host/client_connection.cc index 3a769326..779e630 100644 --- a/remoting/host/client_connection.cc +++ b/remoting/host/client_connection.cc @@ -11,6 +11,7 @@ #include "remoting/protocol/util.h" namespace remoting { +namespace protocol { // Determine how many update streams we should count to find the size of // average update stream. @@ -136,4 +137,5 @@ void ClientConnection::MessageReceivedTask(ChromotingClientMessage* message) { void ClientConnection::OnClosed() { } +} // namespace protocol } // namespace remoting diff --git a/remoting/host/client_connection.h b/remoting/host/client_connection.h index f5e05c1..50589e69 100644 --- a/remoting/host/client_connection.h +++ b/remoting/host/client_connection.h @@ -18,6 +18,7 @@ #include "remoting/protocol/video_writer.h" namespace remoting { +namespace protocol { // This class represents a remote viewer connected to the chromoting host // through a libjingle connection. A viewer object is responsible for sending @@ -114,6 +115,7 @@ class ClientConnection : public base::RefCountedThreadSafe<ClientConnection> { DISALLOW_COPY_AND_ASSIGN(ClientConnection); }; +} // namespace protocol } // namespace remoting #endif // REMOTING_HOST_CLIENT_CONNECTION_H_ diff --git a/remoting/host/client_connection_unittest.cc b/remoting/host/client_connection_unittest.cc index 7c043bb..8f522db 100644 --- a/remoting/host/client_connection_unittest.cc +++ b/remoting/host/client_connection_unittest.cc @@ -26,7 +26,7 @@ class ClientConnectionTest : public testing::Test { session_->set_message_loop(&message_loop_); // Allocate a ClientConnection object with the mock objects. - viewer_ = new ClientConnection(&message_loop_, &handler_); + viewer_ = new protocol::ClientConnection(&message_loop_, &handler_); viewer_->Init(session_); EXPECT_CALL(handler_, OnConnectionOpened(viewer_.get())); session_->state_change_callback()->Run( @@ -35,8 +35,8 @@ class ClientConnectionTest : public testing::Test { } MessageLoop message_loop_; - MockClientConnectionEventHandler handler_; - scoped_refptr<ClientConnection> viewer_; + protocol::MockClientConnectionEventHandler handler_; + scoped_refptr<protocol::ClientConnection> viewer_; scoped_refptr<protocol::FakeSession> session_; diff --git a/remoting/host/mock_objects.h b/remoting/host/mock_objects.h index 79b8d6f..a28f32d 100644 --- a/remoting/host/mock_objects.h +++ b/remoting/host/mock_objects.h @@ -41,6 +41,8 @@ class MockEventExecutor : public EventExecutor { DISALLOW_COPY_AND_ASSIGN(MockEventExecutor); }; +namespace protocol { + class MockClientConnection : public ClientConnection { public: MockClientConnection(){} @@ -70,6 +72,8 @@ class MockClientConnectionEventHandler : public ClientConnection::EventHandler { DISALLOW_COPY_AND_ASSIGN(MockClientConnectionEventHandler); }; +} // namespace protocol + } // namespace remoting #endif // REMOTING_HOST_MOCK_OBJECTS_H_ diff --git a/remoting/host/session_manager.cc b/remoting/host/session_manager.cc index 1867f07..68458bc 100644 --- a/remoting/host/session_manager.cc +++ b/remoting/host/session_manager.cc @@ -74,14 +74,16 @@ void SessionManager::SetMaxRate(double rate) { FROM_HERE, NewTracedMethod(this, &SessionManager::DoSetMaxRate, rate)); } -void SessionManager::AddClient(scoped_refptr<ClientConnection> client) { +void SessionManager::AddClient( + scoped_refptr<protocol::ClientConnection> client) { // Gets the init information for the client. capture_loop_->PostTask( FROM_HERE, NewTracedMethod(this, &SessionManager::DoGetInitInfo, client)); } -void SessionManager::RemoveClient(scoped_refptr<ClientConnection> client) { +void SessionManager::RemoveClient( + scoped_refptr<protocol::ClientConnection> client) { network_loop_->PostTask( FROM_HERE, NewTracedMethod(this, &SessionManager::DoRemoveClient, client)); @@ -243,7 +245,8 @@ void SessionManager::DoFinishEncode() { DoCapture(); } -void SessionManager::DoGetInitInfo(scoped_refptr<ClientConnection> client) { +void SessionManager::DoGetInitInfo( + scoped_refptr<protocol::ClientConnection> client) { DCHECK_EQ(capture_loop_, MessageLoop::current()); ScopedTracer tracer("init"); @@ -342,22 +345,25 @@ void SessionManager::DoSendVideoPacket(VideoPacket* packet) { TraceContext::tracer()->PrintString("DoSendUpdate done"); } -void SessionManager::DoSendInit(scoped_refptr<ClientConnection> client, - int width, int height) { +void SessionManager::DoSendInit( + scoped_refptr<protocol::ClientConnection> client, + int width, int height) { DCHECK_EQ(network_loop_, MessageLoop::current()); // Sends the client init information. client->SendInitClientMessage(width, height); } -void SessionManager::DoAddClient(scoped_refptr<ClientConnection> client) { +void SessionManager::DoAddClient( + scoped_refptr<protocol::ClientConnection> client) { DCHECK_EQ(network_loop_, MessageLoop::current()); // TODO(hclam): Force a full frame for next encode. clients_.push_back(client); } -void SessionManager::DoRemoveClient(scoped_refptr<ClientConnection> client) { +void SessionManager::DoRemoveClient( + scoped_refptr<protocol::ClientConnection> client) { DCHECK_EQ(network_loop_, MessageLoop::current()); // TODO(hclam): Is it correct to do to a scoped_refptr? diff --git a/remoting/host/session_manager.h b/remoting/host/session_manager.h index fedfc4f..c58ef32 100644 --- a/remoting/host/session_manager.h +++ b/remoting/host/session_manager.h @@ -19,7 +19,10 @@ namespace remoting { class CaptureData; + +namespace protocol { class ClientConnection; +} // namespace protocol // A class for controlling and coordinate Capturer, Encoder // and NetworkChannel in a record session. @@ -84,10 +87,10 @@ class SessionManager : public base::RefCountedThreadSafe<SessionManager> { void SetMaxRate(double rate); // Add a client to this recording session. - void AddClient(scoped_refptr<ClientConnection> client); + void AddClient(scoped_refptr<protocol::ClientConnection> client); // Remove a client from receiving screen updates. - void RemoveClient(scoped_refptr<ClientConnection> client); + void RemoveClient(scoped_refptr<protocol::ClientConnection> client); // Remove all clients. void RemoveAllClients(); @@ -112,7 +115,7 @@ class SessionManager : public base::RefCountedThreadSafe<SessionManager> { void CaptureDoneCallback(scoped_refptr<CaptureData> capture_data); void DoFinishEncode(); - void DoGetInitInfo(scoped_refptr<ClientConnection> client); + void DoGetInitInfo(scoped_refptr<protocol::ClientConnection> client); // Network thread ----------------------------------------------------------- @@ -126,11 +129,11 @@ class SessionManager : public base::RefCountedThreadSafe<SessionManager> { // DoSendUpdate takes ownership of header and is responsible for deleting it. void DoSendVideoPacket(VideoPacket* packet); - void DoSendInit(scoped_refptr<ClientConnection> client, + void DoSendInit(scoped_refptr<protocol::ClientConnection> client, int width, int height); - void DoAddClient(scoped_refptr<ClientConnection> client); - void DoRemoveClient(scoped_refptr<ClientConnection> client); + void DoAddClient(scoped_refptr<protocol::ClientConnection> client); + void DoRemoveClient(scoped_refptr<protocol::ClientConnection> client); void DoRemoveAllClients(); // Encoder thread ----------------------------------------------------------- @@ -158,7 +161,8 @@ class SessionManager : public base::RefCountedThreadSafe<SessionManager> { // This member is always accessed on the NETWORK thread. // TODO(hclam): Have to scoped_refptr the clients since they have a shorter // lifetime than this object. - typedef std::vector<scoped_refptr<ClientConnection> > ClientConnectionList; + typedef std::vector<scoped_refptr<protocol::ClientConnection> > + ClientConnectionList; ClientConnectionList clients_; // The following members are accessed on the capture thread. diff --git a/remoting/host/session_manager_unittest.cc b/remoting/host/session_manager_unittest.cc index f3870e2..7291c3e 100644 --- a/remoting/host/session_manager_unittest.cc +++ b/remoting/host/session_manager_unittest.cc @@ -32,7 +32,7 @@ class SessionManagerTest : public testing::Test { void Init() { capturer_ = new MockCapturer(); encoder_ = new MockEncoder(); - client_ = new MockClientConnection(); + client_ = new protocol::MockClientConnection(); record_ = new SessionManager(&message_loop_, &message_loop_, &message_loop_, @@ -41,7 +41,7 @@ class SessionManagerTest : public testing::Test { } scoped_refptr<SessionManager> record_; - scoped_refptr<MockClientConnection> client_; + scoped_refptr<protocol::MockClientConnection> client_; MockCapturer* capturer_; MockEncoder* encoder_; MessageLoop message_loop_; diff --git a/remoting/protocol/buffered_socket_writer.cc b/remoting/protocol/buffered_socket_writer.cc index 0650cbe..1931cd5 100644 --- a/remoting/protocol/buffered_socket_writer.cc +++ b/remoting/protocol/buffered_socket_writer.cc @@ -8,6 +8,7 @@ #include "net/base/net_errors.h" namespace remoting { +namespace protocol { BufferedSocketWriterBase::BufferedSocketWriterBase() : buffer_size_(0), @@ -164,4 +165,5 @@ void BufferedDatagramWriter::AdvanceBufferPosition_Locked(int written) { } +} // namespace protocol } // namespace remoting diff --git a/remoting/protocol/buffered_socket_writer.h b/remoting/protocol/buffered_socket_writer.h index dd1cde8..04e41b6 100644 --- a/remoting/protocol/buffered_socket_writer.h +++ b/remoting/protocol/buffered_socket_writer.h @@ -19,6 +19,7 @@ class Socket; } // namespace net namespace remoting { +namespace protocol { // BufferedSocketWriter and BufferedDatagramWriter implement write data queue // for stream and datagram sockets. BufferedSocketWriterBase is a base class @@ -109,6 +110,7 @@ class BufferedDatagramWriter : public BufferedSocketWriterBase { virtual void AdvanceBufferPosition_Locked(int written); }; +} // namespace protocol } // namespace remoting #endif // REMOTING_PROTOCOL_BUFFERED_SOCKET_WRITER_H_ diff --git a/remoting/protocol/protobuf_video_reader.cc b/remoting/protocol/protobuf_video_reader.cc index e809bd9..f777363 100644 --- a/remoting/protocol/protobuf_video_reader.cc +++ b/remoting/protocol/protobuf_video_reader.cc @@ -8,6 +8,7 @@ #include "remoting/protocol/session.h" namespace remoting { +namespace protocol { ProtobufVideoReader::ProtobufVideoReader() { } ProtobufVideoReader::~ProtobufVideoReader() { } @@ -27,4 +28,5 @@ void ProtobufVideoReader::OnNewData(VideoPacket* packet) { video_stub_->ProcessVideoPacket(packet, new DeleteTask<VideoPacket>(packet)); } +} // namespace protocol } // namespace remoting diff --git a/remoting/protocol/protobuf_video_reader.h b/remoting/protocol/protobuf_video_reader.h index fab8f44..669cd0b 100644 --- a/remoting/protocol/protobuf_video_reader.h +++ b/remoting/protocol/protobuf_video_reader.h @@ -9,10 +9,9 @@ #include "remoting/protocol/video_reader.h" namespace remoting { - namespace protocol { + class Session; -} // namespace protocol class ProtobufVideoReader : public VideoReader { public: @@ -34,6 +33,7 @@ class ProtobufVideoReader : public VideoReader { DISALLOW_COPY_AND_ASSIGN(ProtobufVideoReader); }; +} // namespace protocol } // namespace remoting #endif // REMOTING_PROTOCOL_PROTOBUF_VIDEO_READER_H_ diff --git a/remoting/protocol/protobuf_video_writer.cc b/remoting/protocol/protobuf_video_writer.cc index b4d6999..9bbd88b 100644 --- a/remoting/protocol/protobuf_video_writer.cc +++ b/remoting/protocol/protobuf_video_writer.cc @@ -9,6 +9,7 @@ #include "remoting/protocol/util.h" namespace remoting { +namespace protocol { ProtobufVideoWriter::ProtobufVideoWriter() { } @@ -33,4 +34,5 @@ void ProtobufVideoWriter::Close() { buffered_writer_->Close(); } +} // namespace protocol } // namespace remoting diff --git a/remoting/protocol/protobuf_video_writer.h b/remoting/protocol/protobuf_video_writer.h index c1ba183..ba02584 100644 --- a/remoting/protocol/protobuf_video_writer.h +++ b/remoting/protocol/protobuf_video_writer.h @@ -9,12 +9,10 @@ #include "remoting/protocol/video_writer.h" namespace remoting { - namespace protocol { -class Session; -} // namespace protocol class BufferedSocketWriter; +class Session; class ProtobufVideoWriter : public VideoWriter { public: @@ -33,6 +31,7 @@ class ProtobufVideoWriter : public VideoWriter { DISALLOW_COPY_AND_ASSIGN(ProtobufVideoWriter); }; +} // namespace protocol } // namespace remoting #endif // REMOTING_PROTOCOL_PROTOBUF_VIDEO_WRITER_H_ diff --git a/remoting/protocol/rtp_reader.cc b/remoting/protocol/rtp_reader.cc index 31b133e..9609a6d 100644 --- a/remoting/protocol/rtp_reader.cc +++ b/remoting/protocol/rtp_reader.cc @@ -8,6 +8,7 @@ #include "net/base/io_buffer.h" namespace remoting { +namespace protocol { RtpPacket::RtpPacket() {} RtpPacket::~RtpPacket() {} @@ -37,4 +38,5 @@ void RtpReader::OnDataReceived(net::IOBuffer* buffer, int data_size) { on_message_callback_->Run(packet); } +} // namespace protocol } // namespace remoting diff --git a/remoting/protocol/rtp_reader.h b/remoting/protocol/rtp_reader.h index 3fc3983..c159f8d 100644 --- a/remoting/protocol/rtp_reader.h +++ b/remoting/protocol/rtp_reader.h @@ -10,6 +10,7 @@ #include "remoting/protocol/socket_reader_base.h" namespace remoting { +namespace protocol { struct RtpPacket { RtpPacket(); @@ -45,6 +46,7 @@ class RtpReader : public SocketReaderBase { DISALLOW_COPY_AND_ASSIGN(RtpReader); }; +} // namespace protocol } // namespace remoting diff --git a/remoting/protocol/rtp_utils.cc b/remoting/protocol/rtp_utils.cc index 25cbefc..1337795 100644 --- a/remoting/protocol/rtp_utils.cc +++ b/remoting/protocol/rtp_utils.cc @@ -13,6 +13,7 @@ using talk_base::SetBE16; using talk_base::SetBE32; namespace remoting { +namespace protocol { namespace { const int kRtpBaseHeaderSize = 12; @@ -84,4 +85,5 @@ int UnpackRtpHeader(const uint8* buffer, int buffer_size, RtpHeader* header) { return GetRtpHeaderSize(header->sources); } +} // namespace protocol } // namespace remoting diff --git a/remoting/protocol/rtp_utils.h b/remoting/protocol/rtp_utils.h index 43f6c66..f1275a9 100644 --- a/remoting/protocol/rtp_utils.h +++ b/remoting/protocol/rtp_utils.h @@ -8,6 +8,7 @@ #include "base/basictypes.h" namespace remoting { +namespace protocol { struct RtpHeader { // RTP version is always set to 2. @@ -35,6 +36,7 @@ void PackRtpHeader(uint8* buffer, int buffer_size, int UnpackRtpHeader(const uint8* buffer, int buffer_size, RtpHeader* header); +} // namespace protocol } // namespace remoting #endif // REMOTING_PROTOCOL_RTP_UTILS_H_ diff --git a/remoting/protocol/rtp_video_reader.cc b/remoting/protocol/rtp_video_reader.cc index 8f30613..8660371 100644 --- a/remoting/protocol/rtp_video_reader.cc +++ b/remoting/protocol/rtp_video_reader.cc @@ -8,6 +8,7 @@ #include "remoting/protocol/session.h" namespace remoting { +namespace protocol { RtpVideoReader::RtpVideoReader() { } RtpVideoReader::~RtpVideoReader() { } @@ -38,4 +39,5 @@ void RtpVideoReader::OnRtpPacket(const RtpPacket& rtp_packet) { video_stub_->ProcessVideoPacket(packet, new DeleteTask<VideoPacket>(packet)); } +} // namespace protocol } // namespace remoting diff --git a/remoting/protocol/rtp_video_reader.h b/remoting/protocol/rtp_video_reader.h index 39a8c33..ccfb53e 100644 --- a/remoting/protocol/rtp_video_reader.h +++ b/remoting/protocol/rtp_video_reader.h @@ -9,10 +9,9 @@ #include "remoting/protocol/video_reader.h" namespace remoting { - namespace protocol { + class Session; -} // namespace protocol class RtpVideoReader : public VideoReader { public: @@ -34,6 +33,7 @@ class RtpVideoReader : public VideoReader { DISALLOW_COPY_AND_ASSIGN(RtpVideoReader); }; +} // namespace protocol } // namespace remoting #endif // REMOTING_PROTOCOL_RTP_VIDEO_READER_H_ diff --git a/remoting/protocol/rtp_video_writer.cc b/remoting/protocol/rtp_video_writer.cc index 5fb645c..5bd1c80 100644 --- a/remoting/protocol/rtp_video_writer.cc +++ b/remoting/protocol/rtp_video_writer.cc @@ -8,6 +8,7 @@ #include "remoting/protocol/rtp_writer.h" namespace remoting { +namespace protocol { RtpVideoWriter::RtpVideoWriter() { } @@ -32,4 +33,5 @@ void RtpVideoWriter::Close() { rtp_writer_.Close(); } +} // namespace protocol } // namespace remoting diff --git a/remoting/protocol/rtp_video_writer.h b/remoting/protocol/rtp_video_writer.h index a0bd3b9..3d05925 100644 --- a/remoting/protocol/rtp_video_writer.h +++ b/remoting/protocol/rtp_video_writer.h @@ -9,10 +9,9 @@ #include "remoting/protocol/video_writer.h" namespace remoting { - namespace protocol { + class Session; -} // namespace protocol class RtpVideoWriter : public VideoWriter { public: @@ -31,6 +30,7 @@ class RtpVideoWriter : public VideoWriter { DISALLOW_COPY_AND_ASSIGN(RtpVideoWriter); }; +} // namespace protocol } // namespace remoting #endif // REMOTING_PROTOCOL_RTP_VIDEO_WRITER_H_ diff --git a/remoting/protocol/rtp_writer.cc b/remoting/protocol/rtp_writer.cc index 909a572..c27260e 100644 --- a/remoting/protocol/rtp_writer.cc +++ b/remoting/protocol/rtp_writer.cc @@ -9,6 +9,7 @@ #include "remoting/protocol/rtp_utils.h" namespace remoting { +namespace protocol { namespace { const int kMtu = 1200; @@ -89,4 +90,5 @@ void RtpWriter::Close() { buffered_rtp_writer_->Close(); } +} // namespace protocol } // namespace remoting diff --git a/remoting/protocol/rtp_writer.h b/remoting/protocol/rtp_writer.h index 6bcd7ec..86e92c0 100644 --- a/remoting/protocol/rtp_writer.h +++ b/remoting/protocol/rtp_writer.h @@ -9,6 +9,7 @@ #include "remoting/protocol/buffered_socket_writer.h" namespace remoting { +namespace protocol { class RtpWriter { public: @@ -38,6 +39,7 @@ class RtpWriter { scoped_refptr<BufferedDatagramWriter> buffered_rtp_writer_; }; +} // namespace protocol } // namespace remoting #endif // REMOTING_PROTOCOL_RTP_WRITER_H_ diff --git a/remoting/protocol/session.h b/remoting/protocol/session.h index 9319fef..0b63d17 100644 --- a/remoting/protocol/session.h +++ b/remoting/protocol/session.h @@ -25,8 +25,7 @@ namespace protocol { // Provides access to the connection channels, but doesn't depend on the // protocol used for each channel. // TODO(sergeyu): Remove refcounting? -class Session - : public base::RefCountedThreadSafe<Session> { +class Session : public base::RefCountedThreadSafe<Session> { public: enum State { INITIALIZING, diff --git a/remoting/protocol/stream_writer.cc b/remoting/protocol/stream_writer.cc index 2ed9121..33a4798 100644 --- a/remoting/protocol/stream_writer.cc +++ b/remoting/protocol/stream_writer.cc @@ -9,6 +9,7 @@ #include "remoting/protocol/util.h" namespace remoting { +namespace protocol { StreamWriterBase::StreamWriterBase() : socket_(NULL), @@ -42,4 +43,5 @@ bool ControlStreamWriter::SendMessage(const ChromotingHostMessage& message) { return buffered_writer_->Write(SerializeAndFrameMessage(message)); } +} // namespace protocol } // namespace remoting diff --git a/remoting/protocol/stream_writer.h b/remoting/protocol/stream_writer.h index f5b018b..7c5a3bd 100644 --- a/remoting/protocol/stream_writer.h +++ b/remoting/protocol/stream_writer.h @@ -13,6 +13,7 @@ class Socket; } // namespace net namespace remoting { +namespace protocol { class BufferedSocketWriter; @@ -52,6 +53,7 @@ class ControlStreamWriter : public StreamWriterBase { bool SendMessage(const ChromotingHostMessage& message); }; +} // namespace protocol } // namespace remoting #endif // REMOTING_PROTOCOL_STREAM_WRITER_H_ diff --git a/remoting/protocol/video_reader.cc b/remoting/protocol/video_reader.cc index 63cdae3..b026ac9 100644 --- a/remoting/protocol/video_reader.cc +++ b/remoting/protocol/video_reader.cc @@ -9,6 +9,7 @@ #include "remoting/protocol/rtp_video_reader.h" namespace remoting { +namespace protocol { VideoReader::~VideoReader() { } @@ -23,4 +24,5 @@ VideoReader* VideoReader::Create(const ChromotocolConfig* config) { return NULL; } +} // namespace protocol } // namespace remoting diff --git a/remoting/protocol/video_reader.h b/remoting/protocol/video_reader.h index 0c8ef87..9ead3c9f 100644 --- a/remoting/protocol/video_reader.h +++ b/remoting/protocol/video_reader.h @@ -21,6 +21,8 @@ class Session; class ChromotocolConfig; class ChromotocolConnection; +namespace protocol { + class VideoReader { public: static VideoReader* Create(const ChromotocolConfig* config); @@ -42,6 +44,7 @@ class VideoReader { DISALLOW_COPY_AND_ASSIGN(VideoReader); }; +} // namespace protocol } // namespace remoting #endif // REMOTING_PROTOCOL_VIDEO_READER_H_ diff --git a/remoting/protocol/video_stub.h b/remoting/protocol/video_stub.h index 9f9657f..5c59ca0 100644 --- a/remoting/protocol/video_stub.h +++ b/remoting/protocol/video_stub.h @@ -10,6 +10,7 @@ class Task; namespace remoting { +namespace protocol { class VideoStub { public: @@ -28,6 +29,7 @@ class VideoStub { DISALLOW_COPY_AND_ASSIGN(VideoStub); }; +} // namespace protocol } // namespace remoting #endif // REMOTING_PROTOCOL_VIDEO_STUB_H_ diff --git a/remoting/protocol/video_writer.cc b/remoting/protocol/video_writer.cc index c451010..6fc7a88 100644 --- a/remoting/protocol/video_writer.cc +++ b/remoting/protocol/video_writer.cc @@ -9,6 +9,7 @@ #include "remoting/protocol/rtp_video_writer.h" namespace remoting { +namespace protocol { VideoWriter::~VideoWriter() { } @@ -23,4 +24,5 @@ VideoWriter* VideoWriter::Create(const ChromotocolConfig* config) { return NULL; } +} // namespace protocol } // namespace remoting diff --git a/remoting/protocol/video_writer.h b/remoting/protocol/video_writer.h index 49bdeb6..0b39bcb 100644 --- a/remoting/protocol/video_writer.h +++ b/remoting/protocol/video_writer.h @@ -22,6 +22,8 @@ class Session; class ChromotocolConfig; class ChromotocolConnection; +namespace protocol { + // TODO(sergeyu): VideoWriter should implement VideoStub interface. class VideoWriter { public: @@ -47,6 +49,7 @@ class VideoWriter { DISALLOW_COPY_AND_ASSIGN(VideoWriter); }; +} // namespace protocol } // namespace remoting #endif // REMOTING_PROTOCOL_VIDEO_WRITER_H_ |