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

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

Issue 2470913005: Fix the blimp settings crash. (Closed)
Patch Set: Put init code into SetDelegate. 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
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..7ac95eebc6e7fb13991990a010cba7dc420fdf63 100644
--- a/blimp/client/core/context/blimp_client_context_impl.cc
+++ b/blimp/client/core/context/blimp_client_context_impl.cc
@@ -149,6 +149,17 @@ BlimpClientContextImpl::~BlimpClientContextImpl() {
void BlimpClientContextImpl::SetDelegate(BlimpClientContextDelegate* delegate) {
Khushal 2016/11/03 00:13:35 This is being called with a null delegate from its
nyquist 2016/11/03 00:21:40 This makes sense to me.
xingliu 2016/11/03 00:33:31 Sorry I didn't notice in dtor it sets to nullptr.
Khushal 2016/11/03 00:50:48 I just looked at that class, and yes, it does look
xingliu 2016/11/03 01:45:37 Yeah, that's probably the right way to do that :)
delegate_ = delegate;
+
+ // |assignment_fetcher_| needs services from BlimpClientContextDelegate, so
+ // it can't be created in the constructor.
+ DCHECK(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 +172,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 +190,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') | blimp/client/public/blimp_client_context.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698