Index: remoting/host/screen_recorder.cc |
diff --git a/remoting/host/screen_recorder.cc b/remoting/host/screen_recorder.cc |
index 9c23874da2a60dd298adddd1a0cd1a2f8efa039b..3f8aad1ac6d60fb9e3f27d02d858dec2c931eb7a 100644 |
--- a/remoting/host/screen_recorder.cc |
+++ b/remoting/host/screen_recorder.cc |
@@ -81,27 +81,28 @@ void ScreenRecorder::Stop(const base::Closure& done_task) { |
void ScreenRecorder::AddConnection( |
scoped_refptr<ConnectionToClient> connection) { |
+ DCHECK(network_loop_->BelongsToCurrentThread()); |
+ connections_.push_back(connection); |
+ |
capture_loop_->PostTask( |
FROM_HERE, |
NewRunnableMethod(this, &ScreenRecorder::DoInvalidateFullScreen)); |
- |
- // Add the client to the list so it can receive update stream. |
- network_loop_->PostTask( |
- FROM_HERE, |
- NewRunnableMethod(this, &ScreenRecorder::DoAddConnection, connection)); |
} |
void ScreenRecorder::RemoveConnection( |
scoped_refptr<ConnectionToClient> connection) { |
- network_loop_->PostTask( |
- FROM_HERE, |
- NewRunnableMethod(this, &ScreenRecorder::DoRemoveClient, connection)); |
+ DCHECK(network_loop_->BelongsToCurrentThread()); |
+ |
+ ConnectionToClientList::iterator it = |
+ std::find(connections_.begin(), connections_.end(), connection); |
+ if (it != connections_.end()) { |
+ connections_.erase(it); |
+ } |
} |
void ScreenRecorder::RemoveAllConnections() { |
- network_loop_->PostTask( |
- FROM_HERE, |
- NewRunnableMethod(this, &ScreenRecorder::DoRemoveAllClients)); |
+ DCHECK(network_loop_->BelongsToCurrentThread()); |
+ connections_.clear(); |
} |
void ScreenRecorder::UpdateSequenceNumber(int64 sequence_number) { |
@@ -277,31 +278,6 @@ void ScreenRecorder::FrameSentCallback(VideoPacket* packet) { |
&ScreenRecorder::DoFinishOneRecording)); |
} |
-void ScreenRecorder::DoAddConnection( |
- scoped_refptr<ConnectionToClient> connection) { |
- DCHECK(network_loop_->BelongsToCurrentThread()); |
- |
- connections_.push_back(connection); |
-} |
- |
-void ScreenRecorder::DoRemoveClient( |
- scoped_refptr<ConnectionToClient> connection) { |
- DCHECK(network_loop_->BelongsToCurrentThread()); |
- |
- ConnectionToClientList::iterator it = |
- std::find(connections_.begin(), connections_.end(), connection); |
- if (it != connections_.end()) { |
- connections_.erase(it); |
- } |
-} |
- |
-void ScreenRecorder::DoRemoveAllClients() { |
- DCHECK(network_loop_->BelongsToCurrentThread()); |
- |
- // Clear the list of connections. |
- connections_.clear(); |
-} |
- |
void ScreenRecorder::DoStopOnNetworkThread(const base::Closure& done_task) { |
DCHECK(network_loop_->BelongsToCurrentThread()); |