Chromium Code Reviews| Index: blimp/client/session/blimp_client_session.cc |
| diff --git a/blimp/client/session/blimp_client_session.cc b/blimp/client/session/blimp_client_session.cc |
| index e681a0ab8b9fc7f20da2211afdd133627ef56e9d..6ff7ca98c5e8cf3bff1ae6921763c6d006710c63 100644 |
| --- a/blimp/client/session/blimp_client_session.cc |
| +++ b/blimp/client/session/blimp_client_session.cc |
| @@ -10,6 +10,7 @@ |
| #include "base/command_line.h" |
| #include "base/numerics/safe_conversions.h" |
| #include "base/strings/string_number_conversions.h" |
| +#include "base/thread_task_runner_handle.h" |
| #include "base/threading/sequenced_task_runner_handle.h" |
| #include "blimp/client/app/blimp_client_switches.h" |
| #include "blimp/client/feature/navigation_feature.h" |
| @@ -106,10 +107,8 @@ void ClientNetworkComponents::RegisterFeature( |
| outgoing_message_processors_.push_back(std::move(outgoing_message_processor)); |
| } |
| -BlimpClientSession::BlimpClientSession( |
| - scoped_ptr<AssignmentSource> assignment_source) |
| - : assignment_source_(std::move(assignment_source)), |
| - io_thread_("BlimpIOThread"), |
| +BlimpClientSession::BlimpClientSession() |
| + : io_thread_("BlimpIOThread"), |
| tab_control_feature_(new TabControlFeature), |
| navigation_feature_(new NavigationFeature), |
| render_widget_feature_(new RenderWidgetFeature), |
| @@ -119,6 +118,9 @@ BlimpClientSession::BlimpClientSession( |
| options.message_loop_type = base::MessageLoop::TYPE_IO; |
| io_thread_.StartWithOptions(options); |
| + assignment_source_.reset(new AssignmentSource( |
| + base::ThreadTaskRunnerHandle::Get(), io_thread_.task_runner())); |
| + |
| // Register features' message senders and receivers. |
| tab_control_feature_->set_outgoing_message_processor( |
| RegisterFeature(BlimpMessage::TAB_CONTROL, tab_control_feature_.get())); |
| @@ -144,12 +146,19 @@ BlimpClientSession::~BlimpClientSession() { |
| io_thread_.task_runner()->DeleteSoon(FROM_HERE, net_components_.release()); |
| } |
| -void BlimpClientSession::Connect() { |
| - assignment_source_->GetAssignment(base::Bind( |
| - &BlimpClientSession::ConnectWithAssignment, weak_factory_.GetWeakPtr())); |
| +void BlimpClientSession::Connect(const std::string& token) { |
| + assignment_source_->GetAssignment( |
| + token, base::Bind(&BlimpClientSession::ConnectWithAssignment, |
| + weak_factory_.GetWeakPtr())); |
| } |
| -void BlimpClientSession::ConnectWithAssignment(const Assignment& assignment) { |
| +void BlimpClientSession::ConnectWithAssignment(AssignmentSourceResult result, |
| + const Assignment& assignment) { |
| + if (result != ASSIGNMENT_SOURCE_RESULT_OKAY) { |
| + DVLOG(1) << "Assignment request failed: " << result; |
| + return; |
|
Kevin M
2016/02/12 19:45:27
Should the subclasses be filtering out the erroneo
David Trainor- moved to gerrit
2016/02/17 21:09:48
Yeah good point. I changed this to always call an
|
| + } |
| + |
| io_thread_.task_runner()->PostTask( |
| FROM_HERE, |
| base::Bind(&ClientNetworkComponents::ConnectWithAssignment, |