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

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

Issue 2344893009: Blimp: relocate thread-unsafe member getter in DropConnection code. (Closed)
Patch Set: wez feedback Created 4 years, 3 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
« no previous file with comments | « blimp/client/session/blimp_client_session.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 854c6270725b4ca3233651fe7fc63884a0087c10..8dcfd91828bffe3d550ee003c119d019b126cfaa 100644
--- a/blimp/client/session/blimp_client_session.cc
+++ b/blimp/client/session/blimp_client_session.cc
@@ -13,6 +13,7 @@
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/sequenced_task_runner.h"
+#include "base/task_runner_util.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "base/threading/thread.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -37,6 +38,13 @@
namespace blimp {
namespace client {
+namespace {
+
+void DropConnectionOnIOThread(ClientNetworkComponents* net_components) {
+ net_components->GetBrowserConnectionHandler()->DropCurrentConnection();
+}
+
+} // namespace
BlimpClientSession::BlimpClientSession(const GURL& assigner_endpoint)
: io_thread_("BlimpIOThread"),
@@ -149,16 +157,17 @@ void BlimpClientSession::RegisterFeatures() {
settings_feature_->SetRecordWholeDocument(true);
}
+void BlimpClientSession::DropConnection() {
+ io_thread_.task_runner()->PostTask(
+ FROM_HERE, base::Bind(&DropConnectionOnIOThread, net_components_.get()));
+}
+
void BlimpClientSession::OnConnected() {}
void BlimpClientSession::OnDisconnected(int result) {}
void BlimpClientSession::OnImageDecodeError() {
- io_thread_.task_runner()->PostTask(
- FROM_HERE,
- base::Bind(
- &BrowserConnectionHandler::DropCurrentConnection,
- base::Unretained(net_components_->GetBrowserConnectionHandler())));
+ DropConnection();
}
TabControlFeature* BlimpClientSession::GetTabControlFeature() const {
« no previous file with comments | « blimp/client/session/blimp_client_session.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698