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

Unified Diff: blimp/client/session/blimp_client_session.cc

Issue 1962393004: Added a debug info UI for Blimp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Built debug UI Created 4 years, 7 months 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/session/blimp_client_session.cc
diff --git a/blimp/client/session/blimp_client_session.cc b/blimp/client/session/blimp_client_session.cc
index 760842abc72bb5cd32e63d9b1f4782aa071cb4d0..2cab1bbb2901ae918d5974290fb93a31c5f3cea3 100644
--- a/blimp/client/session/blimp_client_session.cc
+++ b/blimp/client/session/blimp_client_session.cc
@@ -73,7 +73,8 @@ class ClientNetworkComponents : public ConnectionHandler,
public:
// Can be created on any thread.
explicit ClientNetworkComponents(
- std::unique_ptr<NetworkEventObserver> observer);
+ std::unique_ptr<NetworkEventObserver> observer,
+ BlimpConnectionDetails* blimp_connection_details);
~ClientNetworkComponents() override;
// Sets up network components.
@@ -95,14 +96,17 @@ class ClientNetworkComponents : public ConnectionHandler,
std::unique_ptr<BrowserConnectionHandler> connection_handler_;
std::unique_ptr<ClientConnectionManager> connection_manager_;
std::unique_ptr<NetworkEventObserver> network_observer_;
+ BlimpConnectionDetails* connection_details_;
DISALLOW_COPY_AND_ASSIGN(ClientNetworkComponents);
};
ClientNetworkComponents::ClientNetworkComponents(
- std::unique_ptr<NetworkEventObserver> network_observer)
+ std::unique_ptr<NetworkEventObserver> network_observer,
+ BlimpConnectionDetails* details)
: connection_handler_(new BrowserConnectionHandler),
- network_observer_(std::move(network_observer)) {}
+ network_observer_(std::move(network_observer)),
+ connection_details_(details) {}
Khushal 2016/05/18 00:23:00 DCHECK |connection_details_| here.
shaktisahu 2016/05/19 21:39:18 Not sure if this saves much, since we invoke the c
ClientNetworkComponents::~ClientNetworkComponents() {}
@@ -150,6 +154,7 @@ void ClientNetworkComponents::HandleConnection(
VLOG(1) << "Connection established.";
connection->AddConnectionErrorObserver(this);
network_observer_->OnConnected();
+ connection->SetBlimpConnectionDetails(connection_details_);
connection_handler_->HandleConnection(std::move(connection));
}
@@ -161,18 +166,22 @@ void ClientNetworkComponents::OnConnectionError(int result) {
BlimpClientSession::BlimpClientSession(const GURL& assigner_endpoint)
: io_thread_("BlimpIOThread"),
tab_control_feature_(new TabControlFeature),
- navigation_feature_(new NavigationFeature),
ime_feature_(new ImeFeature),
render_widget_feature_(new RenderWidgetFeature),
settings_feature_(new SettingsFeature),
weak_factory_(this) {
- net_components_.reset(new ClientNetworkComponents(
- base::WrapUnique(new CrossThreadNetworkEventObserver(
- weak_factory_.GetWeakPtr(),
- base::SequencedTaskRunnerHandle::Get()))));
base::Thread::Options options;
options.message_loop_type = base::MessageLoop::TYPE_IO;
io_thread_.StartWithOptions(options);
+ blimp_connection_details_ = base::WrapUnique(new BlimpConnectionDetails(
Khushal 2016/05/18 00:23:00 nit: Use x_.reset(new ...) for member variables of
shaktisahu 2016/05/19 21:39:18 Done.
+ base::SequencedTaskRunnerHandle::Get(), io_thread_.task_runner()));
+ blimp_connection_details_->SetObserver(weak_factory_.GetWeakPtr());
+ navigation_feature_ =
+ base::WrapUnique(new NavigationFeature(blimp_connection_details_.get()));
+ net_components_.reset(new ClientNetworkComponents(
+ base::WrapUnique(new CrossThreadNetworkEventObserver(
+ weak_factory_.GetWeakPtr(), base::SequencedTaskRunnerHandle::Get())),
+ blimp_connection_details_.get()));
assignment_source_.reset(new AssignmentSource(
assigner_endpoint, io_thread_.task_runner(), io_thread_.task_runner()));
@@ -188,6 +197,8 @@ BlimpClientSession::BlimpClientSession(const GURL& assigner_endpoint)
BlimpClientSession::~BlimpClientSession() {
io_thread_.task_runner()->DeleteSoon(FROM_HERE, net_components_.release());
+ io_thread_.task_runner()->DeleteSoon(FROM_HERE,
+ blimp_connection_details_.release());
}
void BlimpClientSession::Connect(const std::string& client_auth_token) {
@@ -251,6 +262,12 @@ void BlimpClientSession::RegisterFeatures() {
ime_feature_.get()));
}
+void BlimpClientSession::EnableDebugInfo(bool enable) {
+ blimp_connection_details_->EnableDebugInfo(enable);
+}
+
+void BlimpClientSession::UpdateDebugInfo(int received, int sent, int commits) {}
+
void BlimpClientSession::OnConnected() {}
void BlimpClientSession::OnDisconnected(int result) {}
@@ -275,5 +292,9 @@ SettingsFeature* BlimpClientSession::GetSettingsFeature() const {
return settings_feature_.get();
}
+BlimpConnectionDetails* BlimpClientSession::GetBlimpConnectionDetails() const {
+ return blimp_connection_details_.get();
+}
+
} // namespace client
} // namespace blimp

Powered by Google App Engine
This is Rietveld 408576698