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

Unified Diff: blimp/client/core/context/blimp_client_context_impl.cc

Issue 2470913005: Fix the blimp settings crash. (Closed)
Patch Set: Polish the SetDelegate call. Created 4 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 | « no previous file | blimp/client/public/blimp_client_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/client/core/context/blimp_client_context_impl.cc
diff --git a/blimp/client/core/context/blimp_client_context_impl.cc b/blimp/client/core/context/blimp_client_context_impl.cc
index 81769e53483afa6bf70bf0211f742a2be050e0bc..7277f1ab6521bbcc13cd7e4189d3f7cfadf3c126 100644
--- a/blimp/client/core/context/blimp_client_context_impl.cc
+++ b/blimp/client/core/context/blimp_client_context_impl.cc
@@ -148,7 +148,20 @@ BlimpClientContextImpl::~BlimpClientContextImpl() {
}
void BlimpClientContextImpl::SetDelegate(BlimpClientContextDelegate* delegate) {
+ DCHECK(!delegate_ || !delegate);
delegate_ = delegate;
+
+ // TODO(xingliu): Pass the IdentityProvider needed by |assignment_fetcher_|
+ // in the constructor, see crbug/661848.
+ if (delegate_) {
+ assignment_fetcher_ = base::MakeUnique<AssignmentFetcher>(
+ io_thread_task_runner_, file_thread_task_runner_,
+ delegate_->CreateIdentityProvider(), GetAssignerURL(),
+ base::Bind(&BlimpClientContextImpl::OnAssignmentReceived,
+ weak_factory_.GetWeakPtr()),
+ base::Bind(&BlimpClientContextDelegate::OnAuthenticationError,
+ base::Unretained(delegate_)));
+ }
}
std::unique_ptr<BlimpContents> BlimpClientContextImpl::CreateBlimpContents(
@@ -161,15 +174,7 @@ std::unique_ptr<BlimpContents> BlimpClientContextImpl::CreateBlimpContents(
}
void BlimpClientContextImpl::Connect() {
- if (!assignment_fetcher_) {
- assignment_fetcher_ = base::MakeUnique<AssignmentFetcher>(
- io_thread_task_runner_, file_thread_task_runner_,
- delegate_->CreateIdentityProvider(), GetAssignerURL(),
- base::Bind(&BlimpClientContextImpl::OnAssignmentReceived,
- weak_factory_.GetWeakPtr()),
- base::Bind(&BlimpClientContextDelegate::OnAuthenticationError,
- base::Unretained(delegate_)));
- }
+ DCHECK(assignment_fetcher_);
assignment_fetcher_->Fetch();
}
@@ -187,6 +192,7 @@ BlimpClientContextImpl::CreateFeedbackData() {
}
IdentitySource* BlimpClientContextImpl::GetIdentitySource() {
+ DCHECK(assignment_fetcher_);
return assignment_fetcher_->GetIdentitySource();
}
« no previous file with comments | « no previous file | blimp/client/public/blimp_client_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698