summaryrefslogtreecommitdiffstats
path: root/mojo
diff options
context:
space:
mode:
authoramistry <amistry@chromium.org>2015-12-16 19:23:18 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-17 03:24:06 +0000
commitd8ee03d1531318ede1c06ce7b2d3bff129eb8863 (patch)
treee38a3bb29cbb8774565ebf522292102dd6aa2748 /mojo
parent39e3c00516e2ed79089c9596754bfbab0c827b8c (diff)
downloadchromium_src-d8ee03d1531318ede1c06ce7b2d3bff129eb8863.zip
chromium_src-d8ee03d1531318ede1c06ce7b2d3bff129eb8863.tar.gz
chromium_src-d8ee03d1531318ede1c06ce7b2d3bff129eb8863.tar.bz2
Always set the error handler closure of Binding<> after binding to a message pipe.
This change only modifies users of Binding<>, and not the bindings code itself. The intention is to bring the behaviour of Binding<> closer to that of InterfacePtr<>, which already has this restriction. BUG=569694 Review URL: https://codereview.chromium.org/1525033004 Cr-Commit-Position: refs/heads/master@{#365710}
Diffstat (limited to 'mojo')
-rw-r--r--mojo/runner/child/runner_connection.cc9
-rw-r--r--mojo/runner/host/child_process.cc9
-rw-r--r--mojo/shell/application_instance.cc2
3 files changed, 11 insertions, 9 deletions
diff --git a/mojo/runner/child/runner_connection.cc b/mojo/runner/child/runner_connection.cc
index 1326ada..1fdcdb8 100644
--- a/mojo/runner/child/runner_connection.cc
+++ b/mojo/runner/child/runner_connection.cc
@@ -151,7 +151,10 @@ class ChildControllerImpl : public ChildController {
connection->set_controller(impl.Pass());
}
- void Bind(ScopedMessagePipeHandle handle) { binding_.Bind(handle.Pass()); }
+ void Bind(ScopedMessagePipeHandle handle) {
+ binding_.Bind(handle.Pass());
+ binding_.set_connection_error_handler([this]() { OnConnectionError(); });
+ }
void OnConnectionError() {
// A connection error means the connection to the shell is lost. This is not
@@ -184,9 +187,7 @@ class ChildControllerImpl : public ChildController {
callback_(callback),
unblocker_(unblocker),
channel_info_(nullptr),
- binding_(this) {
- binding_.set_connection_error_handler([this]() { OnConnectionError(); });
- }
+ binding_(this) {}
static void ReturnApplicationRequestOnMainThread(
const GotApplicationRequestCallback& callback,
diff --git a/mojo/runner/host/child_process.cc b/mojo/runner/host/child_process.cc
index 25b8aa3..1cac6f3 100644
--- a/mojo/runner/host/child_process.cc
+++ b/mojo/runner/host/child_process.cc
@@ -218,7 +218,10 @@ class ChildControllerImpl : public ChildController {
app_context->set_controller(impl.Pass());
}
- void Bind(ScopedMessagePipeHandle handle) { binding_.Bind(handle.Pass()); }
+ void Bind(ScopedMessagePipeHandle handle) {
+ binding_.Bind(handle.Pass());
+ binding_.set_connection_error_handler([this]() { OnConnectionError(); });
+ }
void OnConnectionError() {
// A connection error means the connection to the shell is lost. This is not
@@ -251,9 +254,7 @@ class ChildControllerImpl : public ChildController {
app_library_(app_library),
unblocker_(unblocker),
channel_info_(nullptr),
- binding_(this) {
- binding_.set_connection_error_handler([this]() { OnConnectionError(); });
- }
+ binding_(this) {}
static void StartAppOnMainThread(
base::NativeLibrary app_library,
diff --git a/mojo/shell/application_instance.cc b/mojo/shell/application_instance.cc
index 8bd8138..63851af 100644
--- a/mojo/shell/application_instance.cc
+++ b/mojo/shell/application_instance.cc
@@ -31,7 +31,6 @@ ApplicationInstance::ApplicationInstance(
queue_requests_(false),
native_runner_(nullptr),
pid_(base::kNullProcessId) {
- binding_.set_connection_error_handler([this]() { OnConnectionError(); });
}
ApplicationInstance::~ApplicationInstance() {
@@ -43,6 +42,7 @@ ApplicationInstance::~ApplicationInstance() {
void ApplicationInstance::InitializeApplication() {
ShellPtr shell;
binding_.Bind(GetProxy(&shell));
+ binding_.set_connection_error_handler([this]() { OnConnectionError(); });
application_->Initialize(shell.Pass(), identity_.url().spec());
}