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

Unified Diff: mojo/services/network/network_service_impl.cc

Issue 1139673003: Make Mandoline shut down cleanly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 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
« no previous file with comments | « mojo/services/network/network_service_impl.h ('k') | mojo/services/network/tcp_bound_socket_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/network/network_service_impl.cc
diff --git a/mojo/services/network/network_service_impl.cc b/mojo/services/network/network_service_impl.cc
index 20c255876d65ec4af632ffea2f274879c39fe7bf..a0d6706269e13183298facdd24a0071b3ea24b75 100644
--- a/mojo/services/network/network_service_impl.cc
+++ b/mojo/services/network/network_service_impl.cc
@@ -15,9 +15,12 @@
namespace mojo {
-NetworkServiceImpl::NetworkServiceImpl(ApplicationConnection* connection,
- NetworkContext* context)
+NetworkServiceImpl::NetworkServiceImpl(
+ ApplicationConnection* connection,
+ NetworkContext* context,
+ scoped_ptr<mojo::AppRefCount> app_refcount)
: context_(context),
+ app_refcount_(app_refcount.Pass()),
origin_(GURL(connection->GetRemoteApplicationURL()).GetOrigin()) {
}
@@ -29,22 +32,24 @@ void NetworkServiceImpl::CreateURLLoader(InterfaceRequest<URLLoader> loader) {
// The loader will delete itself when the pipe is closed, unless a request is
// in progress. In which case, the loader will delete itself when the request
// is finished.
- new URLLoaderImpl(context_, loader.Pass());
+ new URLLoaderImpl(context_, loader.Pass(), app_refcount_->Clone());
}
void NetworkServiceImpl::GetCookieStore(InterfaceRequest<CookieStore> store) {
- BindToRequest(new CookieStoreImpl(context_, origin_), &store);
+ BindToRequest(new CookieStoreImpl(context_, origin_, app_refcount_->Clone()),
+ &store);
}
void NetworkServiceImpl::CreateWebSocket(InterfaceRequest<WebSocket> socket) {
- BindToRequest(new WebSocketImpl(context_), &socket);
+ BindToRequest(new WebSocketImpl(context_, app_refcount_->Clone()), &socket);
}
void NetworkServiceImpl::CreateTCPBoundSocket(
NetAddressPtr local_address,
InterfaceRequest<TCPBoundSocket> bound_socket,
const CreateTCPBoundSocketCallback& callback) {
- scoped_ptr<TCPBoundSocketImpl> bound(new TCPBoundSocketImpl);
+ scoped_ptr<TCPBoundSocketImpl> bound(new TCPBoundSocketImpl(
+ app_refcount_->Clone()));
int net_error = bound->Bind(local_address.Pass());
if (net_error != net::OK) {
callback.Run(MakeNetworkError(net_error), NetAddressPtr());
@@ -69,14 +74,15 @@ void NetworkServiceImpl::CreateTCPConnectedSocket(
void NetworkServiceImpl::CreateUDPSocket(InterfaceRequest<UDPSocket> request) {
// The lifetime of this UDPSocketImpl is bound to that of the underlying pipe.
- new UDPSocketImpl(request.Pass());
+ new UDPSocketImpl(request.Pass(), app_refcount_->Clone());
}
void NetworkServiceImpl::CreateHttpServer(
NetAddressPtr local_address,
HttpServerDelegatePtr delegate,
const CreateHttpServerCallback& callback) {
- HttpServerImpl::Create(local_address.Pass(), delegate.Pass(), callback);
+ HttpServerImpl::Create(local_address.Pass(), delegate.Pass(),
+ app_refcount_->Clone(), callback);
}
} // namespace mojo
« no previous file with comments | « mojo/services/network/network_service_impl.h ('k') | mojo/services/network/tcp_bound_socket_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698