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

Issue 23606019: Refactor the daemon controller so that the callbacks are called on the caller thread. (Closed)

Created:
7 years, 3 months ago by alexeypa (please no reviews)
Modified:
7 years, 3 months ago
Reviewers:
Sergey Ulanov, Wez
CC:
chromium-reviews, jamiewalch+watch_chromium.org, dcaiafa+watch_chromium.org, hclam+watch_chromium.org, wez+watch_chromium.org, amit, sanjeevr, garykac+watch_chromium.org, lambroslambrou+watch_chromium.org, rmsousa+watch_chromium.org, weitaosu+watch_chromium.org, alexeypa+watch_chromium.org, sergeyu+watch_chromium.org
Visibility:
Public.

Description

Refactor the daemon controller so that the callbacks are called on the caller thread. This CL switches DaemonController to the same model that is used by PairingRegistry. DaemonController becomes a ref-counted object responsible for dispatching calls between threads. Platform-specific logic is implemented in non thread-safe delegate class. Most of the delegate's methods are synchronous and are running on a backgorund thread. BUG=173509 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=222162

Patch Set 1 #

Total comments: 22

Patch Set 2 : rebased (for trybots) and feedback #

Total comments: 2

Patch Set 3 : feedback #2 #

Patch Set 4 : fix the license #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1122 lines, -2396 lines) Patch
M remoting/host/plugin/host_script_object.h View 2 chunks +4 lines, -5 lines 0 comments Download
M remoting/host/plugin/host_script_object.cc View 12 chunks +10 lines, -48 lines 0 comments Download
M remoting/host/setup/daemon_controller.h View 4 chunks +133 lines, -22 lines 0 comments Download
A remoting/host/setup/daemon_controller.cc View 1 1 chunk +241 lines, -0 lines 0 comments Download
A remoting/host/setup/daemon_controller_delegate_linux.h View 1 1 chunk +39 lines, -0 lines 0 comments Download
A + remoting/host/setup/daemon_controller_delegate_linux.cc View 1 11 chunks +73 lines, -147 lines 0 comments Download
A remoting/host/setup/daemon_controller_delegate_mac.h View 1 2 3 1 chunk +56 lines, -0 lines 0 comments Download
A + remoting/host/setup/daemon_controller_delegate_mac.mm View 1 2 7 chunks +145 lines, -228 lines 0 comments Download
A remoting/host/setup/daemon_controller_delegate_win.h View 1 chunk +81 lines, -0 lines 0 comments Download
A + remoting/host/setup/daemon_controller_delegate_win.cc View 1 7 chunks +238 lines, -450 lines 0 comments Download
D remoting/host/setup/daemon_controller_linux.cc View 1 chunk +0 lines, -371 lines 0 comments Download
D remoting/host/setup/daemon_controller_mac.mm View 1 chunk +0 lines, -378 lines 0 comments Download
D remoting/host/setup/daemon_controller_win.cc View 1 chunk +0 lines, -668 lines 0 comments Download
M remoting/host/setup/host_starter.h View 3 chunks +3 lines, -2 lines 0 comments Download
M remoting/host/setup/host_starter.cc View 2 chunks +4 lines, -4 lines 0 comments Download
M remoting/host/setup/native_messaging_host.h View 3 chunks +5 lines, -6 lines 0 comments Download
M remoting/host/setup/native_messaging_host.cc View 8 chunks +12 lines, -16 lines 0 comments Download
M remoting/host/setup/native_messaging_host_unittest.cc View 6 chunks +71 lines, -48 lines 0 comments Download
M remoting/remoting.gyp View 1 1 chunk +7 lines, -3 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
alexeypa (please no reviews)
PTAL. PS. I'm sure you can do this one in an hour. :-)
7 years, 3 months ago (2013-09-06 22:37:25 UTC) #1
Sergey Ulanov
https://codereview.chromium.org/23606019/diff/1/remoting/host/setup/daemon_controller.cc File remoting/host/setup/daemon_controller.cc (right): https://codereview.chromium.org/23606019/diff/1/remoting/host/setup/daemon_controller.cc#newcode126 remoting/host/setup/daemon_controller.cc:126: if (!delegate_task_runner_->BelongsToCurrentThread()) { Here and in other Do*() methods ...
7 years, 3 months ago (2013-09-09 18:12:31 UTC) #2
alexeypa (please no reviews)
https://codereview.chromium.org/23606019/diff/1/remoting/host/setup/daemon_controller.cc File remoting/host/setup/daemon_controller.cc (right): https://codereview.chromium.org/23606019/diff/1/remoting/host/setup/daemon_controller.cc#newcode126 remoting/host/setup/daemon_controller.cc:126: if (!delegate_task_runner_->BelongsToCurrentThread()) { On 2013/09/09 18:12:31, Sergey Ulanov wrote: ...
7 years, 3 months ago (2013-09-09 19:30:56 UTC) #3
Sergey Ulanov
lgtm https://codereview.chromium.org/23606019/diff/9001/remoting/host/setup/daemon_controller_delegate_mac.mm File remoting/host/setup/daemon_controller_delegate_mac.mm (right): https://codereview.chromium.org/23606019/diff/9001/remoting/host/setup/daemon_controller_delegate_mac.mm#newcode1 remoting/host/setup/daemon_controller_delegate_mac.mm:1: // Copyright 2013 The Chromium Authors. All rights ...
7 years, 3 months ago (2013-09-09 20:19:50 UTC) #4
alexeypa (please no reviews)
https://chromiumcodereview.appspot.com/23606019/diff/9001/remoting/host/setup/daemon_controller_delegate_mac.mm File remoting/host/setup/daemon_controller_delegate_mac.mm (right): https://chromiumcodereview.appspot.com/23606019/diff/9001/remoting/host/setup/daemon_controller_delegate_mac.mm#newcode1 remoting/host/setup/daemon_controller_delegate_mac.mm:1: // Copyright 2013 The Chromium Authors. All rights reserved. ...
7 years, 3 months ago (2013-09-09 20:39:59 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/alexeypa@chromium.org/23606019/21001
7 years, 3 months ago (2013-09-09 20:40:44 UTC) #6
commit-bot: I haz the power
Retried try job too often on chromium_presubmit for step(s) presubmit http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=chromium_presubmit&number=24478
7 years, 3 months ago (2013-09-09 20:50:11 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/alexeypa@chromium.org/23606019/26001
7 years, 3 months ago (2013-09-09 21:28:37 UTC) #8
commit-bot: I haz the power
Step "update" is always a major failure. Look at the try server FAQ for more ...
7 years, 3 months ago (2013-09-09 21:33:52 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/alexeypa@chromium.org/23606019/26001
7 years, 3 months ago (2013-09-09 21:54:45 UTC) #10
commit-bot: I haz the power
Change committed as 222162
7 years, 3 months ago (2013-09-10 00:54:10 UTC) #11
Wez
Sorry, have only just started reviewing this; some initial comments below. https://chromiumcodereview.appspot.com/23606019/diff/1/remoting/host/plugin/host_script_object.cc File remoting/host/plugin/host_script_object.cc (right): ...
7 years, 3 months ago (2013-09-10 09:05:36 UTC) #12
alexeypa (please no reviews)
7 years, 3 months ago (2013-09-10 16:59:22 UTC) #13
Message was sent while issue was closed.
This CL has landed. I uploaded the fixes for you comments to
https://codereview.chromium.org/23578017. I haven't tested it much and I,
probably, will not have to to do this. Feel free to take over.

https://chromiumcodereview.appspot.com/23606019/diff/1/remoting/host/plugin/h...
File remoting/host/plugin/host_script_object.cc (right):

https://chromiumcodereview.appspot.com/23606019/diff/1/remoting/host/plugin/h...
remoting/host/plugin/host_script_object.cc:1560: if
(!plugin_task_runner_->BelongsToCurrentThread()) {
On 2013/09/10 09:05:37, Wez wrote:
> nit: This can be replaced by
> DCHECK(plugin_task_runner_->BelongsToCurrentThread()), I think, since
> PairingRegistry always calls back on the caller thread.

Done.

https://chromiumcodereview.appspot.com/23606019/diff/1/remoting/host/plugin/h...
File remoting/host/plugin/host_script_object.h (right):

https://chromiumcodereview.appspot.com/23606019/diff/1/remoting/host/plugin/h...
remoting/host/plugin/host_script_object.h:259: const ScopedRefNPObject&
callback,
On 2013/09/10 09:05:37, Wez wrote:
> nit: This, and any other methods that get bound to run off the plugin thread,
> should be passed scoped_ptr<ScopedRefNPObject>&
> 
> (NPObject ref-counting isn't thread-safe)

Done.

https://chromiumcodereview.appspot.com/23606019/diff/1/remoting/host/setup/da...
File remoting/host/setup/daemon_controller.h (right):

https://chromiumcodereview.appspot.com/23606019/diff/1/remoting/host/setup/da...
remoting/host/setup/daemon_controller.h:88: struct UsageStatsConsent {
On 2013/09/10 09:05:37, Wez wrote:
> nit: UsageStatsConsentFlags?

It is long enough already.

https://chromiumcodereview.appspot.com/23606019/diff/1/remoting/host/setup/da...
remoting/host/setup/daemon_controller.h:97: // information whether the crash
dump reporting is controlled by policy.
On 2013/09/10 09:05:37, Wez wrote:
> Move the member descriptions to document the struct members, above.

Done.

https://chromiumcodereview.appspot.com/23606019/diff/1/remoting/host/setup/da...
remoting/host/setup/daemon_controller.h:122: // finished or fails.
On 2013/09/10 09:05:37, Wez wrote:
> nit: Indicate which thread |done| is invoked upon.  (PairingRegistry should do
> so, too, but doesn't, I notice...)

Done.

https://chromiumcodereview.appspot.com/23606019/diff/1/remoting/host/setup/da...
remoting/host/setup/daemon_controller.h:247: // task runner is used to guarantee
that one one method of the delegate is
On 2013/09/10 09:05:37, Wez wrote:
> typo: one one

Done.

https://chromiumcodereview.appspot.com/23606019/diff/1/remoting/host/setup/da...
remoting/host/setup/daemon_controller.h:248: // called at a time.
On 2013/09/10 09:05:37, Wez wrote:
> nit: Couldn't any SequenceTaskRunner provide the necessary ordering/exclusion
> guarantee on method calls?

No. |delegate_thread_| can be used to invoke COM methods that requires
|delegate_thread_| to be a concrete UI thread, not a bunch of random threads.

Powered by Google App Engine
This is Rietveld 408576698