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

Issue 8495024: Access ChromotingHost::clients_ only on network thread. (Closed)

Created:
9 years, 1 month ago by Sergey Ulanov
Modified:
9 years, 1 month ago
Reviewers:
Wez
CC:
chromium-reviews, jamiewalch+watch_chromium.org, hclam+watch_chromium.org, simonmorris+watch_chromium.org, wez+watch_chromium.org, Paweł Hajdan Jr., dmaclach+watch_chromium.org, garykac+watch_chromium.org, lambroslambrou+watch_chromium.org, ajwong+watch_chromium.org, sergeyu+watch_chromium.org
Visibility:
Public.

Description

Access ChromotingHost::clients_ only on network thread. Previously ChromotingHost was doing some work on the main thread and some on the network thread. |clients_| and some other members were accessed without lock on both of these threads. Moved most of the ChromotingHost activity to the network thread to avoid possible race conditions. BUG=96325 TEST=Chromoting works Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=109556

Patch Set 1 #

Total comments: 51

Patch Set 2 : - #

Total comments: 4

Patch Set 3 : - #

Patch Set 4 : - #

Patch Set 5 : - #

Unified diffs Side-by-side diffs Delta from patch set Stats (+256 lines, -314 lines) Patch
M remoting/host/chromoting_host.h View 1 2 3 4 chunks +14 lines, -23 lines 0 comments Download
M remoting/host/chromoting_host.cc View 1 2 3 4 12 chunks +127 lines, -199 lines 0 comments Download
M remoting/host/chromoting_host_unittest.cc View 1 2 3 4 6 chunks +23 lines, -9 lines 0 comments Download
M remoting/host/client_session.h View 1 2 1 chunk +0 lines, -2 lines 0 comments Download
M remoting/host/client_session.cc View 1 2 3 3 chunks +5 lines, -3 lines 0 comments Download
M remoting/host/client_session_unittest.cc View 1 2 3 2 chunks +8 lines, -1 line 0 comments Download
M remoting/host/host_status_observer.h View 1 1 chunk +8 lines, -7 lines 0 comments Download
M remoting/host/plugin/host_script_object.cc View 1 2 4 chunks +22 lines, -4 lines 0 comments Download
M remoting/host/screen_recorder.h View 1 chunk +0 lines, -4 lines 0 comments Download
M remoting/host/screen_recorder.cc View 1 2 2 chunks +12 lines, -34 lines 0 comments Download
M remoting/host/screen_recorder_unittest.cc View 1 2 3 2 chunks +10 lines, -1 line 0 comments Download
M remoting/protocol/connection_to_client.h View 1 2 1 chunk +1 line, -4 lines 0 comments Download
M remoting/protocol/connection_to_client.cc View 1 2 3 2 chunks +14 lines, -11 lines 0 comments Download
M remoting/protocol/connection_to_client_unittest.cc View 1 2 3 2 chunks +5 lines, -8 lines 0 comments Download
M remoting/protocol/jingle_session_manager.cc View 3 2 chunks +2 lines, -4 lines 0 comments Download
M remoting/protocol/session.h View 1 2 1 chunk +5 lines, -0 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
Sergey Ulanov
9 years, 1 month ago (2011-11-08 19:57:13 UTC) #1
Wez
LGTM, but see comments. http://codereview.chromium.org/8495024/diff/1/remoting/client/chromoting_client.cc File remoting/client/chromoting_client.cc (right): http://codereview.chromium.org/8495024/diff/1/remoting/client/chromoting_client.cc#newcode70 remoting/client/chromoting_client.cc:70: received_packets_.pop_front(); This looks leaked from ...
9 years, 1 month ago (2011-11-09 02:32:22 UTC) #2
Sergey Ulanov
http://codereview.chromium.org/8495024/diff/1/remoting/client/chromoting_client.cc File remoting/client/chromoting_client.cc (right): http://codereview.chromium.org/8495024/diff/1/remoting/client/chromoting_client.cc#newcode70 remoting/client/chromoting_client.cc:70: received_packets_.pop_front(); On 2011/11/09 02:32:22, Wez wrote: > This looks ...
9 years, 1 month ago (2011-11-09 21:24:00 UTC) #3
Wez
LGTM w/ a few remaining comments. The main one is around the Disconnect() semantics; I'm ...
9 years, 1 month ago (2011-11-09 23:18:45 UTC) #4
Sergey Ulanov
Two annoying things when Disconnect() method is expected to trigger a callback: - Disconnect() method ...
9 years, 1 month ago (2011-11-10 21:06:14 UTC) #5
Wez
On 2011/11/10 21:06:14, sergeyu wrote: > Two annoying things when Disconnect() method is expected to ...
9 years, 1 month ago (2011-11-10 23:26:05 UTC) #6
Wez
On 2011/11/10 23:26:05, Wez wrote: > On 2011/11/10 21:06:14, sergeyu wrote: > > Two annoying ...
9 years, 1 month ago (2011-11-10 23:26:36 UTC) #7
Sergey Ulanov
9 years, 1 month ago (2011-11-10 23:46:52 UTC) #8
On Thu, Nov 10, 2011 at 3:26 PM, <wez@chromium.org> wrote:

> On 2011/11/10 21:06:14, sergeyu wrote:
>
>> Two annoying things when Disconnect() method is expected to trigger a
>>
> callback:
>
>>  - Disconnect() method needs to expect that the object may be destroyed
>> in the
>> callback, so it needs to call the callback only at the end.
>>
>
> Unfortunately it's generally true that we have to be careful when we
> choose to
> invoke simple callbacks.
>

True, but in this case the callback is not called explicitly:
ClientSession::Disconnect() just calls ConnectionToClient::Disconnect(),
and which triggers call ClientSession::OnConnectionClosed(), etc. Each such
case needs to be documented, and it makes interaction between layers very
convoluted.


>
>   - It's harder to mock ConnectionToHost, ClientSession because
>> Disconnect()
>> method is supposed to call a callback.
>>
>
> ConnectionToHost is really an internal implementation detail of
> ChromotingHost,
> though, so do we even want to be mocking it for use with ChromotingHost?
>

Sorry, I meant ConnectionToClient. Currently it is mocked in ChromotingHost
unittests. We could mock protocol::Session instead (not sure if that would
make the tests simpler), but protocol::Session has exactly the same problem
- state change callback is expected in response to Close() call..



>
>
>
http://codereview.chromium.**org/8495024/<http://codereview.chromium.org/8495...
>

Powered by Google App Engine
This is Rietveld 408576698