Clean up Assignment Create in BlimpClientContextImpl.
This is the intial commit for cleaning up BlimpClientContextImpl, pulling
out assignment creation code into AssignmentFetcher.
BUG=645129
Committed: https://crrev.com/52420812ebff2adf3788d464e51cabeb246a5717
Cr-Commit-Position: refs/heads/master@{#427486}
Unit test forthcoming after initial review. Let me know if this is what was intended ...
4 years, 2 months ago
(2016-10-11 21:26:19 UTC)
#2
Unit test forthcoming after initial review. Let me know if this is what was
intended by the bug.
David Trainor- moved to gerrit
Thanks so much for looking into this! :D This looks great. I have some smaller ...
4 years, 2 months ago
(2016-10-13 03:52:30 UTC)
#3
Thanks so much for looking into this! :D
This looks great. I have some smaller nit suggestions around the structure for
more clean up. Let me know what you think.
There'll be more work involved in the near future around abstracting out the
host environment (basically the current assigner vs. the new gRPC
implementation). If you're interested and have cycles, we should talk to
gcasto@ and markellis@ to figure out what they need from an 'auth/assignment'
standpoint. lmk!
It might look very much the same, but with the 'Assignment' just pointing to a
static endpoint. In that case we can keep the code all the same but just have
some kind of "HostingEnvironment" interface we pass in that hides the
differences from the AssignmentFetcher. Then we can build the correct
HostingEnvironment based on which one we need.
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
File blimp/client/core/context/assignment_fetcher.cc (right):
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.cc:32:
AssignmentFetcher::~AssignmentFetcher() {}
= default
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.cc:34: void
AssignmentFetcher::Fetch(BlimpClientContextDelegate* delegate) {
Should this just take the AssignmentRequestResult callback? What do you think
about joining the Assigner and IdentitySource errors?
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.cc:48: void
AssignmentFetcher::CreateIdentitySource() {
If we don't need a delegate we could probably just create this in the
constructor. It needs an IdentityProvider, maybe we can make that an
AssignmentFetcher constructor argument and lazily build the fetcher?
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.cc:50: delegate_,
base::Bind(&AssignmentFetcher::OnAuthTokenReceived,
If we remove the delegate dependency we could also pass in an error callback or
something?
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.cc:66: GURL
AssignmentFetcher::GetAssignerURL() {
This was overridden by blimp_client_context_impl_android to pass the right
assigner URL. Should we just pass this as an argument? We could also
potentially pass in the Settings object mlliu@ is working on right now to pull
the assigner URL from in the future.
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
File blimp/client/core/context/assignment_fetcher.h (right):
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.h:17: class AssignmentFetcher {
This might be better off in core/session
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.h:21:
assignment_receieved_callback,
receieved -> received
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
File blimp/client/core/context/blimp_client_context_impl.cc (right):
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
blimp/client/core/context/blimp_client_context_impl.cc:157: return
assignment_fetcher_->GetIdentitySource();
I wonder if we can pass the IdentityProvider directly to the settings object
instead? We can talk to xingliu@ about it.
David Trainor- moved to gerrit
Thanks so much for looking into this! :D This looks great. I have some smaller ...
4 years, 2 months ago
(2016-10-13 03:52:30 UTC)
#4
Thanks so much for looking into this! :D
This looks great. I have some smaller nit suggestions around the structure for
more clean up. Let me know what you think.
There'll be more work involved in the near future around abstracting out the
host environment (basically the current assigner vs. the new gRPC
implementation). If you're interested and have cycles, we should talk to
gcasto@ and markellis@ to figure out what they need from an 'auth/assignment'
standpoint. lmk!
It might look very much the same, but with the 'Assignment' just pointing to a
static endpoint. In that case we can keep the code all the same but just have
some kind of "HostingEnvironment" interface we pass in that hides the
differences from the AssignmentFetcher. Then we can build the correct
HostingEnvironment based on which one we need.
CJ
Sorry if I'm a bit slow on the uptake on some of your comments. Haven't ...
4 years, 2 months ago
(2016-10-13 21:19:17 UTC)
#5
Sorry if I'm a bit slow on the uptake on some of your comments. Haven't really
been tuning into the discussion around this part of the code. If you'd be open
to discussing things in detail, let me know so I can throw up a calendar event.
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
File blimp/client/core/context/assignment_fetcher.cc (right):
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.cc:32:
AssignmentFetcher::~AssignmentFetcher() {}
On 2016/10/13 03:52:29, David Trainor wrote:
> = default
Done.
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.cc:34: void
AssignmentFetcher::Fetch(BlimpClientContextDelegate* delegate) {
On 2016/10/13 03:52:29, David Trainor wrote:
> Should this just take the AssignmentRequestResult callback? What do you think
> about joining the Assigner and IdentitySource errors?
Not sure what u mean by the errors, but otherwise done.
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.cc:48: void
AssignmentFetcher::CreateIdentitySource() {
On 2016/10/13 03:52:29, David Trainor wrote:
> If we don't need a delegate we could probably just create this in the
> constructor. It needs an IdentityProvider, maybe we can make that an
> AssignmentFetcher constructor argument and lazily build the fetcher?
I am unfamiliar with doing things lazily. Would you have some time to maybe
explain this to me later?
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.cc:50: delegate_,
base::Bind(&AssignmentFetcher::OnAuthTokenReceived,
On 2016/10/13 03:52:29, David Trainor wrote:
> If we remove the delegate dependency we could also pass in an error callback
or
> something?
Not sure what you mean. It needs the delegate to make the IdentitySource. Not
following.
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.cc:66: GURL
AssignmentFetcher::GetAssignerURL() {
On 2016/10/13 03:52:29, David Trainor wrote:
> This was overridden by blimp_client_context_impl_android to pass the right
> assigner URL. Should we just pass this as an argument? We could also
> potentially pass in the Settings object mlliu@ is working on right now to pull
> the assigner URL from in the future.
Done.
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
File blimp/client/core/context/blimp_client_context_impl.cc (right):
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
blimp/client/core/context/blimp_client_context_impl.cc:157: return
assignment_fetcher_->GetIdentitySource();
On 2016/10/13 03:52:29, David Trainor wrote:
> I wonder if we can pass the IdentityProvider directly to the settings object
> instead? We can talk to xingliu@ about it.
Yeah I'm pretty out of the loop when it comes to settings.
David Trainor- moved to gerrit
Yeah I'd be happy to chat. I'll throw something on your calendar this afternoon. Sorry ...
4 years, 2 months ago
(2016-10-14 16:38:33 UTC)
#6
Yeah I'd be happy to chat. I'll throw something on your calendar this
afternoon. Sorry for the delayed responses!
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
File blimp/client/core/context/assignment_fetcher.cc (right):
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.cc:34: void
AssignmentFetcher::Fetch(BlimpClientContextDelegate* delegate) {
On 2016/10/13 21:19:16, CJ wrote:
> On 2016/10/13 03:52:29, David Trainor wrote:
> > Should this just take the AssignmentRequestResult callback? What do you
think
> > about joining the Assigner and IdentitySource errors?
>
> Not sure what u mean by the errors, but otherwise done.
So one of the main reasons we have to pass in a delegate with fetch is that we
rely on the delegate for a few things:
- Accessing an IdentityProvider (IIRC)
- Notifying the caller of IdentitySource errors.
If we could decouple those requirements from this class we wouldn't need to pass
in a delegate here :).
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.cc:48: void
AssignmentFetcher::CreateIdentitySource() {
On 2016/10/13 21:19:16, CJ wrote:
> On 2016/10/13 03:52:29, David Trainor wrote:
> > If we don't need a delegate we could probably just create this in the
> > constructor. It needs an IdentityProvider, maybe we can make that an
> > AssignmentFetcher constructor argument and lazily build the fetcher?
>
> I am unfamiliar with doing things lazily. Would you have some time to maybe
> explain this to me later?
Sure! Want to have a quick vc at 1:30 or something?
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.cc:50: delegate_,
base::Bind(&AssignmentFetcher::OnAuthTokenReceived,
On 2016/10/13 21:19:16, CJ wrote:
> On 2016/10/13 03:52:29, David Trainor wrote:
> > If we remove the delegate dependency we could also pass in an error callback
> or
> > something?
>
> Not sure what you mean. It needs the delegate to make the IdentitySource. Not
> following.
Yeah I was hoping we could rip that whole dependency out of that class too.
That's what some of the earlier comments were about. Sorry for the confusion
:(.
CJ
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/context/assignment_fetcher.cc File blimp/client/core/context/assignment_fetcher.cc (right): https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/context/assignment_fetcher.cc#newcode34 blimp/client/core/context/assignment_fetcher.cc:34: void AssignmentFetcher::Fetch(BlimpClientContextDelegate* delegate) { On 2016/10/14 16:38:33, David Trainor ...
4 years, 2 months ago
(2016-10-18 00:18:32 UTC)
#7
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
File blimp/client/core/context/assignment_fetcher.cc (right):
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.cc:34: void
AssignmentFetcher::Fetch(BlimpClientContextDelegate* delegate) {
On 2016/10/14 16:38:33, David Trainor wrote:
> On 2016/10/13 21:19:16, CJ wrote:
> > On 2016/10/13 03:52:29, David Trainor wrote:
> > > Should this just take the AssignmentRequestResult callback? What do you
> think
> > > about joining the Assigner and IdentitySource errors?
> >
> > Not sure what u mean by the errors, but otherwise done.
>
> So one of the main reasons we have to pass in a delegate with fetch is that we
> rely on the delegate for a few things:
>
> - Accessing an IdentityProvider (IIRC)
> - Notifying the caller of IdentitySource errors.
>
> If we could decouple those requirements from this class we wouldn't need to
pass
> in a delegate here :).
Done.
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.cc:48: void
AssignmentFetcher::CreateIdentitySource() {
On 2016/10/14 16:38:33, David Trainor wrote:
> On 2016/10/13 21:19:16, CJ wrote:
> > On 2016/10/13 03:52:29, David Trainor wrote:
> > > If we don't need a delegate we could probably just create this in the
> > > constructor. It needs an IdentityProvider, maybe we can make that an
> > > AssignmentFetcher constructor argument and lazily build the fetcher?
> >
> > I am unfamiliar with doing things lazily. Would you have some time to maybe
> > explain this to me later?
>
> Sure! Want to have a quick vc at 1:30 or something?
Acknowledged.
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.cc:50: delegate_,
base::Bind(&AssignmentFetcher::OnAuthTokenReceived,
On 2016/10/14 16:38:33, David Trainor wrote:
> On 2016/10/13 21:19:16, CJ wrote:
> > On 2016/10/13 03:52:29, David Trainor wrote:
> > > If we remove the delegate dependency we could also pass in an error
callback
> > or
> > > something?
> >
> > Not sure what you mean. It needs the delegate to make the IdentitySource.
Not
> > following.
>
> Yeah I was hoping we could rip that whole dependency out of that class too.
> That's what some of the earlier comments were about. Sorry for the confusion
> :(.
Done.
David Trainor- moved to gerrit
sorry for the delayed reply. this is looking really good :) https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/context/blimp_client_context_impl.cc File blimp/client/core/context/blimp_client_context_impl.cc (right): ...
4 years, 2 months ago
(2016-10-20 16:50:32 UTC)
#8
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/context/blimp_client_context_impl.cc File blimp/client/core/context/blimp_client_context_impl.cc (right): https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/context/blimp_client_context_impl.cc#newcode157 blimp/client/core/context/blimp_client_context_impl.cc:157: return assignment_fetcher_->GetIdentitySource(); On 2016/10/20 16:50:32, David Trainor wrote: > ...
4 years, 2 months ago
(2016-10-20 20:52:58 UTC)
#9
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
File blimp/client/core/context/blimp_client_context_impl.cc (right):
https://codereview.chromium.org/2406403003/diff/20001/blimp/client/core/conte...
blimp/client/core/context/blimp_client_context_impl.cc:157: return
assignment_fetcher_->GetIdentitySource();
On 2016/10/20 16:50:32, David Trainor wrote:
> On 2016/10/13 21:19:16, CJ wrote:
> > On 2016/10/13 03:52:29, David Trainor wrote:
> > > I wonder if we can pass the IdentityProvider directly to the settings
object
> > > instead? We can talk to xingliu@ about it.
> >
> > Yeah I'm pretty out of the loop when it comes to settings.
>
> Don't worry about this for now, I/we can look into it afterwards.
Acknowledged.
https://codereview.chromium.org/2406403003/diff/80001/blimp/client/core/conte...
File blimp/client/core/context/assignment_fetcher.h (right):
https://codereview.chromium.org/2406403003/diff/80001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.h:21: const
base::Callback<void(const GoogleServiceAuthError&)> error_callback,
On 2016/10/20 16:50:32, David Trainor wrote:
> using AuthErrorCallback = base::Callback<void(const GoogleServiceAuthError&)>;
>
> using AssignmentResultCallback = base::Callback<void(AssignmentRequestResult,
> const Assignment&)>;
Done.
https://codereview.chromium.org/2406403003/diff/80001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.h:28: void
Fetch(base::Callback<void(AssignmentRequestResult, const Assignment&)>
On 2016/10/20 16:50:32, David Trainor wrote:
> Hmm what do you think? Now that I'm looking at this, does it make sense to
pull
> the error callback into fetch or this callback in to the constructor? It
looks
> like we never clear the callback so it might make sense just to set it once
and
> keep it forever.
>
> Sorry for the back and forth. Does one seem cleaner to you?
Sounds good to me. It doesn't even make testing easier, so no need to pass it in
this way.
https://codereview.chromium.org/2406403003/diff/80001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.h:29:
assignment_receieved_callback);
On 2016/10/20 16:50:32, David Trainor wrote:
> receieved -> received
Done.
https://codereview.chromium.org/2406403003/diff/80001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.h:31: IdentitySource*
GetIdentitySource();
On 2016/10/20 16:50:32, David Trainor wrote:
> Do we still have to expose this?
I believe so. BlimpClientContextImpl is expected to be able to provide an
IdentitySource due to its fulfillment of BlimpSettingsDelegate. Unless this has
changed, or if we want to store the IdentitySource on BllimpClientContextImpl
somehow, this has to stay.
https://codereview.chromium.org/2406403003/diff/80001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.h:39:
std::unique_ptr<IdentitySource> identity_source_;
On 2016/10/20 16:50:32, David Trainor wrote:
> Yay!
Acknowledged.
https://codereview.chromium.org/2406403003/diff/80001/blimp/client/core/conte...
blimp/client/core/context/assignment_fetcher.h:41: GURL assigner_url_;
On 2016/10/20 16:50:32, David Trainor wrote:
> The comments still seemed valid :).
Done.
https://codereview.chromium.org/2406403003/diff/80001/blimp/client/core/sessi...
File blimp/client/core/session/identity_source.h (right):
https://codereview.chromium.org/2406403003/diff/80001/blimp/client/core/sessi...
blimp/client/core/session/identity_source.h:26: typedef
base::Callback<void(const std::string&)> TokenCallback;
On 2016/10/20 16:50:32, David Trainor wrote:
> Make this using for consistency :D
Done.
https://codereview.chromium.org/2406403003/diff/80001/blimp/client/core/sessi...
blimp/client/core/session/identity_source.h:30: base::Callback<void(const
GoogleServiceAuthError&)> error_callback,
On 2016/10/20 16:50:32, David Trainor wrote:
> put "using TokenErrorCallback = base::Callback<void(const
> GoogleServiceAuthError&)>;" above and use TokenErrorCallback as the param
type.
Done.
CJ
The CQ bit was checked by lethalantidote@chromium.org to run a CQ dry run
4 years, 2 months ago
(2016-10-20 20:53:04 UTC)
#10
Dry run: Try jobs failed on following builders: linux_android_rel_ng on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/165033)
4 years, 2 months ago
(2016-10-20 21:30:03 UTC)
#13
4 years, 1 month ago
(2016-10-25 21:37:22 UTC)
#19
Message was sent while issue was closed.
Committed patchset #7 (id:120001)
commit-bot: I haz the power
Description was changed from ========== Clean up Assignment Create in BlimpClientContextImpl. This is the intial ...
4 years, 1 month ago
(2016-10-25 21:41:15 UTC)
#20
Message was sent while issue was closed.
Description was changed from
==========
Clean up Assignment Create in BlimpClientContextImpl.
This is the intial commit for cleaning up BlimpClientContextImpl, pulling
out assignment creation code into AssignmentFetcher.
BUG=645129
==========
to
==========
Clean up Assignment Create in BlimpClientContextImpl.
This is the intial commit for cleaning up BlimpClientContextImpl, pulling
out assignment creation code into AssignmentFetcher.
BUG=645129
Committed: https://crrev.com/52420812ebff2adf3788d464e51cabeb246a5717
Cr-Commit-Position: refs/heads/master@{#427486}
==========
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/52420812ebff2adf3788d464e51cabeb246a5717 Cr-Commit-Position: refs/heads/master@{#427486}
4 years, 1 month ago
(2016-10-25 21:41:17 UTC)
#21
Issue 2406403003: Clean up Assignment Create in BlimpClientContextImpl.
(Closed)
Created 4 years, 2 months ago by CJ
Modified 4 years, 1 month ago
Reviewers: David Trainor- moved to gerrit
Base URL:
Comments: 46