diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-24 03:26:37 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-24 03:26:37 +0000 |
commit | ffdb373a3e3fd523e78890fa8ab4ac1e8b49090f (patch) | |
tree | eca69245cafdb225f7ee2cf62ce88c7308b1d022 /device | |
parent | 633c60c341bb4c430c60b54492b74d1bdcff22f4 (diff) | |
download | chromium_src-ffdb373a3e3fd523e78890fa8ab4ac1e8b49090f.zip chromium_src-ffdb373a3e3fd523e78890fa8ab4ac1e8b49090f.tar.gz chromium_src-ffdb373a3e3fd523e78890fa8ab4ac1e8b49090f.tar.bz2 |
Mojo: Use InterfaceFactory<Interface> for service registration
This adds an InterfaceFactory<Interface> type and allows registering a
service through its provider. Using an InterfaceFactory allows the app
to be in control of the lifetime of the implementation of the interface
and hides all of the implementation details of the interface from the
application library code (i.e. no subclassing impl classes or anything
like that). The default binding behavior is to bind the lifetime of
the impl to the lifetime of the pipe, but the application
can also weakly bind to a service in cases where it needs to manage
the lifetime explicitly.
Review URL: https://codereview.chromium.org/380413003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285139 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'device')
-rw-r--r-- | device/serial/serial_connection.cc | 4 | ||||
-rw-r--r-- | device/serial/serial_connection.h | 1 | ||||
-rw-r--r-- | device/serial/serial_service_impl.cc | 4 | ||||
-rw-r--r-- | device/serial/serial_service_impl.h | 1 |
4 files changed, 0 insertions, 10 deletions
diff --git a/device/serial/serial_connection.cc b/device/serial/serial_connection.cc index 0845b88..0f6dc85 100644 --- a/device/serial/serial_connection.cc +++ b/device/serial/serial_connection.cc @@ -42,8 +42,4 @@ void SerialConnection::Flush(const mojo::Callback<void(bool)>& callback) { callback.Run(io_handler_->Flush()); } -void SerialConnection::OnConnectionError() { - delete this; -} - } // namespace device diff --git a/device/serial/serial_connection.h b/device/serial/serial_connection.h index e6909d2..31d5fc3 100644 --- a/device/serial/serial_connection.h +++ b/device/serial/serial_connection.h @@ -29,7 +29,6 @@ class SerialConnection : public mojo::InterfaceImpl<serial::Connection> { virtual void GetControlSignals(const mojo::Callback< void(serial::DeviceControlSignalsPtr)>& callback) OVERRIDE; virtual void Flush(const mojo::Callback<void(bool)>& callback) OVERRIDE; - virtual void OnConnectionError() OVERRIDE; private: scoped_refptr<SerialIoHandler> io_handler_; diff --git a/device/serial/serial_service_impl.cc b/device/serial/serial_service_impl.cc index 14a8033..093096d 100644 --- a/device/serial/serial_service_impl.cc +++ b/device/serial/serial_service_impl.cc @@ -62,10 +62,6 @@ void SerialServiceImpl::Connect( path, options.Pass(), connection_request.Pass()); } -void SerialServiceImpl::OnConnectionError() { - delete this; -} - SerialDeviceEnumerator* SerialServiceImpl::GetDeviceEnumerator() { if (!device_enumerator_) device_enumerator_ = SerialDeviceEnumerator::Create(); diff --git a/device/serial/serial_service_impl.h b/device/serial/serial_service_impl.h index 9e705a8..17d93c2 100644 --- a/device/serial/serial_service_impl.h +++ b/device/serial/serial_service_impl.h @@ -36,7 +36,6 @@ class SerialServiceImpl : public mojo::InterfaceImpl<serial::SerialService> { const mojo::String& path, serial::ConnectionOptionsPtr options, mojo::InterfaceRequest<serial::Connection> connection_request) OVERRIDE; - virtual void OnConnectionError() OVERRIDE; private: SerialDeviceEnumerator* GetDeviceEnumerator(); |