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

Unified Diff: remoting/host/screen_recorder.cc

Issue 8495024: Access ChromotingHost::clients_ only on network thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 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/host/screen_recorder.h ('k') | remoting/host/screen_recorder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/screen_recorder.cc
diff --git a/remoting/host/screen_recorder.cc b/remoting/host/screen_recorder.cc
index d779ecac5a93a4e72d2edc83700be9f8b4626de4..951ef2243bf9718e11f6bf910a912bb42ac1f376 100644
--- a/remoting/host/screen_recorder.cc
+++ b/remoting/host/screen_recorder.cc
@@ -81,24 +81,27 @@ 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, base::Bind(&ScreenRecorder::DoInvalidateFullScreen, this));
-
- // Add the client to the list so it can receive update stream.
- network_loop_->PostTask(
- FROM_HERE, base::Bind(&ScreenRecorder::DoAddConnection,
- this, connection));
}
void ScreenRecorder::RemoveConnection(
scoped_refptr<ConnectionToClient> connection) {
- network_loop_->PostTask(
- FROM_HERE, base::Bind(&ScreenRecorder::DoRemoveClient, this, 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, base::Bind(&ScreenRecorder::DoRemoveAllClients, this));
+ DCHECK(network_loop_->BelongsToCurrentThread());
+ connections_.clear();
}
void ScreenRecorder::UpdateSequenceNumber(int64 sequence_number) {
@@ -271,31 +274,6 @@ void ScreenRecorder::FrameSentCallback(VideoPacket* packet) {
FROM_HERE, base::Bind(&ScreenRecorder::DoFinishOneRecording, this));
}
-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());
« no previous file with comments | « remoting/host/screen_recorder.h ('k') | remoting/host/screen_recorder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698