diff options
author | jam <jam@chromium.org> | 2015-05-26 12:24:28 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-26 19:25:07 +0000 |
commit | 1a13c5df8a68389ec4ca117ae430e028b0d29b66 (patch) | |
tree | d8439bf987aecd89b58fcdcea28ef902a1dd5e67 /mojo/services | |
parent | e47161e40995ae6edc1fe9277d81a0878a59bdd1 (diff) | |
download | chromium_src-1a13c5df8a68389ec4ca117ae430e028b0d29b66.zip chromium_src-1a13c5df8a68389ec4ca117ae430e028b0d29b66.tar.gz chromium_src-1a13c5df8a68389ec4ca117ae430e028b0d29b66.tar.bz2 |
Make AppLifetimeHelper a member of ApplicationImpl.
This simplifies plumbing, but more so is so that ApplicationImpl can tell it when the application is gone. Otherwise AppLifetimeHelper might access a deleted ApplicationImpl after it's deleted when the app's message loop is being destructed (since an OnConnectionError might cause the last object holding a reference to end up calling ApplicationImpl::Terminate).
BUG=484234
Review URL: https://codereview.chromium.org/1158633002
Cr-Commit-Position: refs/heads/master@{#331403}
Diffstat (limited to 'mojo/services')
-rw-r--r-- | mojo/services/network/network_service_delegate.cc | 5 | ||||
-rw-r--r-- | mojo/services/network/network_service_delegate.h | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/mojo/services/network/network_service_delegate.cc b/mojo/services/network/network_service_delegate.cc index c6f4af5..70cf9e8 100644 --- a/mojo/services/network/network_service_delegate.cc +++ b/mojo/services/network/network_service_delegate.cc @@ -11,11 +11,12 @@ #include "base/path_service.h" #include "mojo/application/public/cpp/application_connection.h" -NetworkServiceDelegate::NetworkServiceDelegate() {} +NetworkServiceDelegate::NetworkServiceDelegate() : app_(nullptr) {} NetworkServiceDelegate::~NetworkServiceDelegate() {} void NetworkServiceDelegate::Initialize(mojo::ApplicationImpl* app) { + app_ = app; base::FilePath base_path; CHECK(PathService::Get(base::DIR_TEMP, &base_path)); base_path = base_path.Append(FILE_PATH_LITERAL("network_service")); @@ -43,6 +44,6 @@ void NetworkServiceDelegate::Create( new mojo::NetworkServiceImpl( connection, context_.get(), - app_lifetime_helper_.CreateAppRefCount()), + app_->app_lifetime_helper()->CreateAppRefCount()), &request); } diff --git a/mojo/services/network/network_service_delegate.h b/mojo/services/network/network_service_delegate.h index 4deb421..2e98300 100644 --- a/mojo/services/network/network_service_delegate.h +++ b/mojo/services/network/network_service_delegate.h @@ -31,8 +31,8 @@ class NetworkServiceDelegate mojo::InterfaceRequest<mojo::NetworkService> request) override; private: + mojo::ApplicationImpl* app_; scoped_ptr<mojo::NetworkContext> context_; - mojo::AppLifetimeHelper app_lifetime_helper_; }; #endif // MOJO_SERVICES_NETWORK_NETWORK_SERVICE_DELEGATE_H_ |