diff options
Diffstat (limited to 'mojo/services/network')
27 files changed, 77 insertions, 73 deletions
diff --git a/mojo/services/network/cookie_store_impl.cc b/mojo/services/network/cookie_store_impl.cc index acee535..ebd0c92 100644 --- a/mojo/services/network/cookie_store_impl.cc +++ b/mojo/services/network/cookie_store_impl.cc @@ -28,7 +28,7 @@ void AdaptSetCookieCallback(const Callback<void(bool)>& callback, CookieStoreImpl::CookieStoreImpl(NetworkContext* context, const GURL& origin, - scoped_ptr<mojo::AppRefCount> app_refcount, + scoped_ptr<mojo::MessageLoopRef> app_refcount, InterfaceRequest<CookieStore> request) : context_(context), origin_(origin), diff --git a/mojo/services/network/cookie_store_impl.h b/mojo/services/network/cookie_store_impl.h index a4dfb09..224490c 100644 --- a/mojo/services/network/cookie_store_impl.h +++ b/mojo/services/network/cookie_store_impl.h @@ -8,7 +8,7 @@ #include "base/macros.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/services/network/public/interfaces/cookie_store.mojom.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/message_loop_ref.h" #include "url/gurl.h" namespace mojo { @@ -18,7 +18,7 @@ class CookieStoreImpl : public CookieStore { public: CookieStoreImpl(NetworkContext* context, const GURL& origin, - scoped_ptr<mojo::AppRefCount> app_refcount, + scoped_ptr<mojo::MessageLoopRef> app_refcount, InterfaceRequest<CookieStore> request); ~CookieStoreImpl() override; @@ -31,7 +31,7 @@ class CookieStoreImpl : public CookieStore { NetworkContext* context_; GURL origin_; - scoped_ptr<mojo::AppRefCount> app_refcount_; + scoped_ptr<mojo::MessageLoopRef> app_refcount_; StrongBinding<CookieStore> binding_; DISALLOW_COPY_AND_ASSIGN(CookieStoreImpl); diff --git a/mojo/services/network/http_server_apptest.cc b/mojo/services/network/http_server_apptest.cc index b7e47dd..24b070a 100644 --- a/mojo/services/network/http_server_apptest.cc +++ b/mojo/services/network/http_server_apptest.cc @@ -557,7 +557,7 @@ class HttpServerAppTest : public test::ApplicationTestBase { ApplicationTestBase::SetUp(); scoped_ptr<Connection> connection = - shell()->Connect("mojo:network_service"); + connector()->Connect("mojo:network_service"); connection->GetInterface(&network_service_); connection->GetInterface(&web_socket_factory_); } diff --git a/mojo/services/network/http_server_impl.cc b/mojo/services/network/http_server_impl.cc index cc14221..b7e080a 100644 --- a/mojo/services/network/http_server_impl.cc +++ b/mojo/services/network/http_server_impl.cc @@ -27,7 +27,7 @@ const int kBackLog = 10; void HttpServerImpl::Create( NetAddressPtr local_address, HttpServerDelegatePtr delegate, - scoped_ptr<mojo::AppRefCount> app_refcount, + scoped_ptr<mojo::MessageLoopRef> app_refcount, const Callback<void(NetworkErrorPtr, NetAddressPtr)>& callback) { HttpServerImpl* http_server = new HttpServerImpl(std::move(delegate), std::move(app_refcount)); @@ -42,7 +42,7 @@ void HttpServerImpl::Create( } HttpServerImpl::HttpServerImpl(HttpServerDelegatePtr delegate, - scoped_ptr<mojo::AppRefCount> app_refcount) + scoped_ptr<mojo::MessageLoopRef> app_refcount) : delegate_(std::move(delegate)), app_refcount_(std::move(app_refcount)) { DCHECK(delegate_); delegate_.set_connection_error_handler([this]() { delete this; }); diff --git a/mojo/services/network/http_server_impl.h b/mojo/services/network/http_server_impl.h index a631146..f79b7a8 100644 --- a/mojo/services/network/http_server_impl.h +++ b/mojo/services/network/http_server_impl.h @@ -12,7 +12,7 @@ #include "base/memory/scoped_ptr.h" #include "mojo/services/network/public/interfaces/http_server.mojom.h" #include "mojo/services/network/public/interfaces/net_address.mojom.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/message_loop_ref.h" #include "net/server/http_server.h" namespace net { @@ -28,7 +28,7 @@ class HttpServerImpl : public net::HttpServer::Delegate { static void Create( NetAddressPtr local_address, HttpServerDelegatePtr delegate, - scoped_ptr<mojo::AppRefCount> app_refcount, + scoped_ptr<mojo::MessageLoopRef> app_refcount, const Callback<void(NetworkErrorPtr, NetAddressPtr)>& callback); net::HttpServer* server() { return server_.get(); } @@ -39,7 +39,7 @@ class HttpServerImpl : public net::HttpServer::Delegate { // notified that |delegate|'s pipe is closed. Deleting the object directly // before that is okay, too. HttpServerImpl(HttpServerDelegatePtr delegate, - scoped_ptr<mojo::AppRefCount> app_refcount); + scoped_ptr<mojo::MessageLoopRef> app_refcount); ~HttpServerImpl() override; int Start(NetAddressPtr local_address); @@ -55,7 +55,7 @@ class HttpServerImpl : public net::HttpServer::Delegate { void OnClose(int connection_id) override; HttpServerDelegatePtr delegate_; - scoped_ptr<mojo::AppRefCount> app_refcount_; + scoped_ptr<mojo::MessageLoopRef> app_refcount_; scoped_ptr<net::HttpServer> server_; std::map<int, linked_ptr<HttpConnectionImpl>> connections_; diff --git a/mojo/services/network/network_service_delegate.cc b/mojo/services/network/network_service_delegate.cc index a3a0ea3..9f54082 100644 --- a/mojo/services/network/network_service_delegate.cc +++ b/mojo/services/network/network_service_delegate.cc @@ -31,12 +31,11 @@ const char kUserDataDir[] = "user-data-dir"; namespace mojo { -NetworkServiceDelegate::NetworkServiceDelegate() - : shell_(nullptr) { -} - -NetworkServiceDelegate::~NetworkServiceDelegate() { +NetworkServiceDelegate::NetworkServiceDelegate() { + ref_factory_.set_quit_closure( + base::Bind(&NetworkServiceDelegate::Quit, base::Unretained(this))); } +NetworkServiceDelegate::~NetworkServiceDelegate() {} void NetworkServiceDelegate::AddObserver( NetworkServiceDelegateObserver* observer) { @@ -48,10 +47,9 @@ void NetworkServiceDelegate::RemoveObserver( observers_.RemoveObserver(observer); } -void NetworkServiceDelegate::Initialize(Shell* shell, const std::string& url, +void NetworkServiceDelegate::Initialize(Connector* connector, + const std::string& url, uint32_t id, uint32_t user_id) { - shell_ = shell; - // TODO(erg): Find everything else that writes to the filesystem and // transition it to proxying mojo:filesystem. We shouldn't have any path // calculation code here, but sadly need it until the transition is done. In @@ -68,7 +66,7 @@ void NetworkServiceDelegate::Initialize(Shell* shell, const std::string& url, } context_.reset(new NetworkContext(base_path, this)); - tracing_.Initialize(shell_, url); + tracing_.Initialize(connector, url); } bool NetworkServiceDelegate::AcceptConnection(Connection* connection) { @@ -84,37 +82,37 @@ bool NetworkServiceDelegate::ShellConnectionLost() { return true; } -void NetworkServiceDelegate::Quit() { - // Destroy the NetworkContext now as it requires MessageLoop::current() upon - // destruction and it is the last moment we know for sure that it is - // running. - context_.reset(); -} - void NetworkServiceDelegate::Create(Connection* connection, InterfaceRequest<NetworkService> request) { - new NetworkServiceImpl(shell_->CreateAppRefCount(), std::move(request)); + new NetworkServiceImpl(ref_factory_.CreateRef(), std::move(request)); } void NetworkServiceDelegate::Create(Connection* connection, InterfaceRequest<CookieStore> request) { new CookieStoreImpl( context_.get(), GURL(connection->GetRemoteApplicationURL()).GetOrigin(), - shell_->CreateAppRefCount(), std::move(request)); + ref_factory_.CreateRef(), std::move(request)); } void NetworkServiceDelegate::Create( Connection* connection, InterfaceRequest<WebSocketFactory> request) { - new WebSocketFactoryImpl(context_.get(), shell_->CreateAppRefCount(), + new WebSocketFactoryImpl(context_.get(), ref_factory_.CreateRef(), std::move(request)); } void NetworkServiceDelegate::Create( Connection* connection, InterfaceRequest<URLLoaderFactory> request) { - new URLLoaderFactoryImpl(context_.get(), shell_->CreateAppRefCount(), + new URLLoaderFactoryImpl(context_.get(), ref_factory_.CreateRef(), std::move(request)); } +void NetworkServiceDelegate::Quit() { + // Destroy the NetworkContext now as it requires MessageLoop::current() upon + // destruction and it is the last moment we know for sure that it is + // running. + context_.reset(); +} + } // namespace mojo diff --git a/mojo/services/network/network_service_delegate.h b/mojo/services/network/network_service_delegate.h index 678db5a..4159f2a 100644 --- a/mojo/services/network/network_service_delegate.h +++ b/mojo/services/network/network_service_delegate.h @@ -5,6 +5,7 @@ #ifndef MOJO_SERVICES_NETWORK_NETWORK_SERVICE_DELEGATE_H_ #define MOJO_SERVICES_NETWORK_NETWORK_SERVICE_DELEGATE_H_ +#include "base/macros.h" #include "base/observer_list.h" #include "base/threading/thread.h" #include "mojo/services/network/network_context.h" @@ -14,7 +15,7 @@ #include "mojo/services/network/public/interfaces/web_socket_factory.mojom.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" #include "mojo/shell/public/cpp/interface_factory.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/message_loop_ref.h" #include "mojo/shell/public/cpp/shell_client.h" namespace mojo { @@ -34,11 +35,10 @@ class NetworkServiceDelegate : public ShellClient, private: // mojo::ShellClient implementation. - void Initialize(Shell* shell, const std::string& url, + void Initialize(Connector* connector, const std::string& url, uint32_t id, uint32_t user_id) override; bool AcceptConnection(Connection* connection) override; bool ShellConnectionLost() override; - void Quit() override; // InterfaceFactory<NetworkService> implementation. void Create(Connection* connection, @@ -57,13 +57,18 @@ class NetworkServiceDelegate : public ShellClient, InterfaceRequest<URLLoaderFactory> request) override; private: - Shell* shell_; + void Quit(); + mojo::TracingImpl tracing_; // Observers that want notifications that our worker thread is going away. base::ObserverList<NetworkServiceDelegateObserver> observers_; scoped_ptr<NetworkContext> context_; + + mojo::MessageLoopRefFactory ref_factory_; + + DISALLOW_COPY_AND_ASSIGN(NetworkServiceDelegate); }; } // namespace mojo diff --git a/mojo/services/network/network_service_impl.cc b/mojo/services/network/network_service_impl.cc index cacaf83..1557da8 100644 --- a/mojo/services/network/network_service_impl.cc +++ b/mojo/services/network/network_service_impl.cc @@ -16,7 +16,7 @@ namespace mojo { NetworkServiceImpl::NetworkServiceImpl( - scoped_ptr<mojo::AppRefCount> app_refcount, + scoped_ptr<mojo::MessageLoopRef> app_refcount, InterfaceRequest<NetworkService> request) : app_refcount_(std::move(app_refcount)), binding_(this, std::move(request)) {} diff --git a/mojo/services/network/network_service_impl.h b/mojo/services/network/network_service_impl.h index fa5ffe02..014ca0f 100644 --- a/mojo/services/network/network_service_impl.h +++ b/mojo/services/network/network_service_impl.h @@ -8,14 +8,14 @@ #include "base/compiler_specific.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/services/network/public/interfaces/network_service.mojom.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/message_loop_ref.h" #include "url/gurl.h" namespace mojo { class NetworkServiceImpl : public NetworkService { public: - NetworkServiceImpl(scoped_ptr<mojo::AppRefCount> app_refcount, + NetworkServiceImpl(scoped_ptr<mojo::MessageLoopRef> app_refcount, InterfaceRequest<NetworkService> request); ~NetworkServiceImpl() override; @@ -39,7 +39,7 @@ class NetworkServiceImpl : public NetworkService { const GetMimeTypeFromFileCallback& callback) override; private: - scoped_ptr<mojo::AppRefCount> app_refcount_; + scoped_ptr<mojo::MessageLoopRef> app_refcount_; StrongBinding<NetworkService> binding_; }; diff --git a/mojo/services/network/tcp_bound_socket_impl.cc b/mojo/services/network/tcp_bound_socket_impl.cc index d8a60b7..1d8669f 100644 --- a/mojo/services/network/tcp_bound_socket_impl.cc +++ b/mojo/services/network/tcp_bound_socket_impl.cc @@ -15,7 +15,7 @@ namespace mojo { TCPBoundSocketImpl::TCPBoundSocketImpl( - scoped_ptr<mojo::AppRefCount> app_refcount, + scoped_ptr<mojo::MessageLoopRef> app_refcount, InterfaceRequest<TCPBoundSocket> request) : app_refcount_(std::move(app_refcount)), binding_(this, std::move(request)) {} diff --git a/mojo/services/network/tcp_bound_socket_impl.h b/mojo/services/network/tcp_bound_socket_impl.h index 5cb256e..8e4b2e8 100644 --- a/mojo/services/network/tcp_bound_socket_impl.h +++ b/mojo/services/network/tcp_bound_socket_impl.h @@ -8,14 +8,14 @@ #include "base/memory/scoped_ptr.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/services/network/public/interfaces/tcp_bound_socket.mojom.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/message_loop_ref.h" #include "net/socket/tcp_socket.h" namespace mojo { class TCPBoundSocketImpl : public TCPBoundSocket { public: - TCPBoundSocketImpl(scoped_ptr<mojo::AppRefCount> app_refcount, + TCPBoundSocketImpl(scoped_ptr<mojo::MessageLoopRef> app_refcount, InterfaceRequest<TCPBoundSocket> request); ~TCPBoundSocketImpl() override; @@ -47,7 +47,7 @@ class TCPBoundSocketImpl : public TCPBoundSocket { ScopedDataPipeProducerHandle pending_connect_receive_stream_; InterfaceRequest<TCPConnectedSocket> pending_connect_socket_; Callback<void(NetworkErrorPtr)> pending_connect_callback_; - scoped_ptr<mojo::AppRefCount> app_refcount_; + scoped_ptr<mojo::MessageLoopRef> app_refcount_; StrongBinding<TCPBoundSocket> binding_; }; diff --git a/mojo/services/network/tcp_connected_socket_impl.cc b/mojo/services/network/tcp_connected_socket_impl.cc index 8a6d0a0..8da9484 100644 --- a/mojo/services/network/tcp_connected_socket_impl.cc +++ b/mojo/services/network/tcp_connected_socket_impl.cc @@ -19,7 +19,7 @@ TCPConnectedSocketImpl::TCPConnectedSocketImpl( ScopedDataPipeConsumerHandle send_stream, ScopedDataPipeProducerHandle receive_stream, InterfaceRequest<TCPConnectedSocket> request, - scoped_ptr<mojo::AppRefCount> app_refcount) + scoped_ptr<mojo::MessageLoopRef> app_refcount) : socket_(std::move(socket)), send_stream_(std::move(send_stream)), receive_stream_(std::move(receive_stream)), diff --git a/mojo/services/network/tcp_connected_socket_impl.h b/mojo/services/network/tcp_connected_socket_impl.h index 4611189..1131bf6 100644 --- a/mojo/services/network/tcp_connected_socket_impl.h +++ b/mojo/services/network/tcp_connected_socket_impl.h @@ -10,7 +10,7 @@ #include "mojo/message_pump/handle_watcher.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/services/network/public/interfaces/tcp_connected_socket.mojom.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/message_loop_ref.h" #include "net/socket/tcp_socket.h" namespace mojo { @@ -24,7 +24,7 @@ class TCPConnectedSocketImpl : public TCPConnectedSocket { ScopedDataPipeConsumerHandle send_stream, ScopedDataPipeProducerHandle receive_stream, InterfaceRequest<TCPConnectedSocket> request, - scoped_ptr<mojo::AppRefCount> app_refcount); + scoped_ptr<mojo::MessageLoopRef> app_refcount); ~TCPConnectedSocketImpl() override; private: @@ -69,7 +69,7 @@ class TCPConnectedSocketImpl : public TCPConnectedSocket { // To bind to the message pipe. Binding<TCPConnectedSocket> binding_; - scoped_ptr<mojo::AppRefCount> app_refcount_; + scoped_ptr<mojo::MessageLoopRef> app_refcount_; base::WeakPtrFactory<TCPConnectedSocketImpl> weak_ptr_factory_; }; diff --git a/mojo/services/network/tcp_server_socket_impl.cc b/mojo/services/network/tcp_server_socket_impl.cc index 2762964..a01feff 100644 --- a/mojo/services/network/tcp_server_socket_impl.cc +++ b/mojo/services/network/tcp_server_socket_impl.cc @@ -15,7 +15,7 @@ namespace mojo { TCPServerSocketImpl::TCPServerSocketImpl( scoped_ptr<net::TCPSocket> socket, - scoped_ptr<mojo::AppRefCount> app_refcount, + scoped_ptr<mojo::MessageLoopRef> app_refcount, InterfaceRequest<TCPServerSocket> request) : socket_(std::move(socket)), app_refcount_(std::move(app_refcount)), diff --git a/mojo/services/network/tcp_server_socket_impl.h b/mojo/services/network/tcp_server_socket_impl.h index 5149cb1..2078cec 100644 --- a/mojo/services/network/tcp_server_socket_impl.h +++ b/mojo/services/network/tcp_server_socket_impl.h @@ -8,7 +8,7 @@ #include "base/memory/scoped_ptr.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/services/network/public/interfaces/tcp_server_socket.mojom.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/message_loop_ref.h" #include "net/base/ip_endpoint.h" #include "net/socket/tcp_socket.h" @@ -20,7 +20,7 @@ class TCPServerSocketImpl : public TCPServerSocket { // Passed ownership of a socket already in listening mode. TCPServerSocketImpl(scoped_ptr<net::TCPSocket> socket, - scoped_ptr<mojo::AppRefCount> app_refcount, + scoped_ptr<mojo::MessageLoopRef> app_refcount, InterfaceRequest<TCPServerSocket> request); ~TCPServerSocketImpl() override; @@ -47,7 +47,7 @@ class TCPServerSocketImpl : public TCPServerSocket { scoped_ptr<net::TCPSocket> accepted_socket_; net::IPEndPoint accepted_address_; - scoped_ptr<mojo::AppRefCount> app_refcount_; + scoped_ptr<mojo::MessageLoopRef> app_refcount_; StrongBinding<TCPServerSocket> binding_; }; diff --git a/mojo/services/network/udp_socket_apptest.cc b/mojo/services/network/udp_socket_apptest.cc index ac800e0..075a29c 100644 --- a/mojo/services/network/udp_socket_apptest.cc +++ b/mojo/services/network/udp_socket_apptest.cc @@ -324,7 +324,7 @@ class UDPSocketAppTest : public test::ApplicationTestBase { void SetUp() override { ApplicationTestBase::SetUp(); - shell()->ConnectToInterface("mojo:network_service", &network_service_); + connector()->ConnectToInterface("mojo:network_service", &network_service_); network_service_->CreateUDPSocket(GetProxy(&socket_)); } diff --git a/mojo/services/network/udp_socket_impl.cc b/mojo/services/network/udp_socket_impl.cc index f87dcb0..c99f66f 100644 --- a/mojo/services/network/udp_socket_impl.cc +++ b/mojo/services/network/udp_socket_impl.cc @@ -37,7 +37,7 @@ UDPSocketImpl::PendingSendRequest::PendingSendRequest() {} UDPSocketImpl::PendingSendRequest::~PendingSendRequest() {} UDPSocketImpl::UDPSocketImpl(InterfaceRequest<UDPSocket> request, - scoped_ptr<mojo::AppRefCount> app_refcount) + scoped_ptr<mojo::MessageLoopRef> app_refcount) : binding_(this, std::move(request)), socket_(net::DatagramSocket::DEFAULT_BIND, net::RandIntCallback(), diff --git a/mojo/services/network/udp_socket_impl.h b/mojo/services/network/udp_socket_impl.h index 459ba9d..6ea5770 100644 --- a/mojo/services/network/udp_socket_impl.h +++ b/mojo/services/network/udp_socket_impl.h @@ -14,7 +14,7 @@ #include "base/memory/ref_counted.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/services/network/public/interfaces/udp_socket.mojom.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/message_loop_ref.h" #include "net/base/ip_endpoint.h" #include "net/udp/udp_socket.h" @@ -30,7 +30,7 @@ class UDPSocketImpl : public UDPSocket { // The lifetime of a new UDPSocketImpl is bound to the connection associated // with |request|. UDPSocketImpl(InterfaceRequest<UDPSocket> request, - scoped_ptr<mojo::AppRefCount> app_refcount); + scoped_ptr<mojo::MessageLoopRef> app_refcount); ~UDPSocketImpl() override; // UDPSocket implementation. @@ -123,7 +123,7 @@ class UDPSocketImpl : public UDPSocket { // The maximum size of the |pending_send_requests_| queue. size_t max_pending_send_requests_; - scoped_ptr<mojo::AppRefCount> app_refcount_; + scoped_ptr<mojo::MessageLoopRef> app_refcount_; DISALLOW_COPY_AND_ASSIGN(UDPSocketImpl); }; diff --git a/mojo/services/network/url_loader_factory_impl.cc b/mojo/services/network/url_loader_factory_impl.cc index b14183c..2e19d5b 100644 --- a/mojo/services/network/url_loader_factory_impl.cc +++ b/mojo/services/network/url_loader_factory_impl.cc @@ -12,7 +12,7 @@ namespace mojo { URLLoaderFactoryImpl::URLLoaderFactoryImpl( NetworkContext* context, - scoped_ptr<mojo::AppRefCount> app_refcount, + scoped_ptr<mojo::MessageLoopRef> app_refcount, InterfaceRequest<URLLoaderFactory> request) : context_(context), app_refcount_(std::move(app_refcount)), diff --git a/mojo/services/network/url_loader_factory_impl.h b/mojo/services/network/url_loader_factory_impl.h index 7b12556..0b59208 100644 --- a/mojo/services/network/url_loader_factory_impl.h +++ b/mojo/services/network/url_loader_factory_impl.h @@ -9,7 +9,7 @@ #include "base/macros.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/message_loop_ref.h" namespace mojo { class NetworkContext; @@ -17,7 +17,7 @@ class NetworkContext; class URLLoaderFactoryImpl : public URLLoaderFactory { public: URLLoaderFactoryImpl(NetworkContext* context, - scoped_ptr<mojo::AppRefCount> app_refcount, + scoped_ptr<mojo::MessageLoopRef> app_refcount, InterfaceRequest<URLLoaderFactory> request); ~URLLoaderFactoryImpl() override; @@ -26,7 +26,7 @@ class URLLoaderFactoryImpl : public URLLoaderFactory { private: NetworkContext* context_; - scoped_ptr<mojo::AppRefCount> app_refcount_; + scoped_ptr<mojo::MessageLoopRef> app_refcount_; StrongBinding<URLLoaderFactory> binding_; DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryImpl); diff --git a/mojo/services/network/url_loader_impl.cc b/mojo/services/network/url_loader_impl.cc index e8727ca..b6db54e 100644 --- a/mojo/services/network/url_loader_impl.cc +++ b/mojo/services/network/url_loader_impl.cc @@ -141,7 +141,7 @@ class UploadDataPipeElementReader : public net::UploadElementReader { URLLoaderImpl::URLLoaderImpl(NetworkContext* context, InterfaceRequest<URLLoader> request, - scoped_ptr<mojo::AppRefCount> app_refcount) + scoped_ptr<mojo::MessageLoopRef> app_refcount) : context_(context), response_body_buffer_size_(0), response_body_bytes_read_(0), diff --git a/mojo/services/network/url_loader_impl.h b/mojo/services/network/url_loader_impl.h index b8e6905..833eb86 100644 --- a/mojo/services/network/url_loader_impl.h +++ b/mojo/services/network/url_loader_impl.h @@ -12,7 +12,7 @@ #include "mojo/message_pump/handle_watcher.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/services/network/public/interfaces/url_loader.mojom.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/message_loop_ref.h" #include "net/base/net_errors.h" #include "net/url_request/url_request.h" @@ -26,7 +26,7 @@ class URLLoaderImpl : public URLLoader, public: URLLoaderImpl(NetworkContext* context, InterfaceRequest<URLLoader> request, - scoped_ptr<mojo::AppRefCount> app_refcount); + scoped_ptr<mojo::MessageLoopRef> app_refcount); ~URLLoaderImpl() override; // Called when the associated NetworkContext is going away. @@ -70,7 +70,7 @@ class URLLoaderImpl : public URLLoader, bool auto_follow_redirects_; bool connected_; Binding<URLLoader> binding_; - scoped_ptr<mojo::AppRefCount> app_refcount_; + scoped_ptr<mojo::MessageLoopRef> app_refcount_; base::WeakPtrFactory<URLLoaderImpl> weak_ptr_factory_; }; diff --git a/mojo/services/network/url_loader_impl_apptest.cc b/mojo/services/network/url_loader_impl_apptest.cc index 90e7c96..fe7bd06 100644 --- a/mojo/services/network/url_loader_impl_apptest.cc +++ b/mojo/services/network/url_loader_impl_apptest.cc @@ -14,6 +14,7 @@ #include "mojo/services/network/network_context.h" #include "mojo/services/network/url_loader_impl.h" #include "mojo/shell/public/cpp/application_test_base.h" +#include "mojo/shell/public/cpp/message_loop_ref.h" #include "net/base/net_errors.h" #include "net/url_request/url_request_job.h" #include "net/url_request/url_request_job_factory_impl.h" @@ -129,7 +130,7 @@ class UrlLoaderImplTest : public test::ApplicationTestBase { MessagePipe pipe; new URLLoaderImpl(network_context_.get(), GetProxy(&url_loader_proxy_), - make_scoped_ptr<mojo::AppRefCount>(nullptr)); + make_scoped_ptr<mojo::MessageLoopRef>(nullptr)); EXPECT_TRUE(IsUrlLoaderValid()); } diff --git a/mojo/services/network/web_socket_factory_impl.cc b/mojo/services/network/web_socket_factory_impl.cc index ecd7272..6adde55 100644 --- a/mojo/services/network/web_socket_factory_impl.cc +++ b/mojo/services/network/web_socket_factory_impl.cc @@ -12,7 +12,7 @@ namespace mojo { WebSocketFactoryImpl::WebSocketFactoryImpl( NetworkContext* context, - scoped_ptr<AppRefCount> app_refcount, + scoped_ptr<MessageLoopRef> app_refcount, InterfaceRequest<WebSocketFactory> request) : context_(context), app_refcount_(std::move(app_refcount)), diff --git a/mojo/services/network/web_socket_factory_impl.h b/mojo/services/network/web_socket_factory_impl.h index 2763e7f4..ca254ca 100644 --- a/mojo/services/network/web_socket_factory_impl.h +++ b/mojo/services/network/web_socket_factory_impl.h @@ -9,7 +9,7 @@ #include "base/macros.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/services/network/public/interfaces/web_socket_factory.mojom.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/message_loop_ref.h" namespace mojo { class NetworkContext; @@ -17,7 +17,7 @@ class NetworkContext; class WebSocketFactoryImpl : public WebSocketFactory { public: WebSocketFactoryImpl(NetworkContext* context, - scoped_ptr<AppRefCount> app_refcount, + scoped_ptr<MessageLoopRef> app_refcount, InterfaceRequest<WebSocketFactory> request); ~WebSocketFactoryImpl() override; @@ -26,7 +26,7 @@ class WebSocketFactoryImpl : public WebSocketFactory { private: NetworkContext* context_; - scoped_ptr<AppRefCount> app_refcount_; + scoped_ptr<MessageLoopRef> app_refcount_; StrongBinding<WebSocketFactory> binding_; DISALLOW_COPY_AND_ASSIGN(WebSocketFactoryImpl); diff --git a/mojo/services/network/web_socket_impl.cc b/mojo/services/network/web_socket_impl.cc index 459b531..2d89149 100644 --- a/mojo/services/network/web_socket_impl.cc +++ b/mojo/services/network/web_socket_impl.cc @@ -182,7 +182,7 @@ void WebSocketEventHandler::DidWriteToReceiveStream( } // namespace mojo WebSocketImpl::WebSocketImpl(NetworkContext* context, - scoped_ptr<mojo::AppRefCount> app_refcount, + scoped_ptr<mojo::MessageLoopRef> app_refcount, InterfaceRequest<WebSocket> request) : context_(context), app_refcount_(std::move(app_refcount)), diff --git a/mojo/services/network/web_socket_impl.h b/mojo/services/network/web_socket_impl.h index 30b7cc2..06fd3ca 100644 --- a/mojo/services/network/web_socket_impl.h +++ b/mojo/services/network/web_socket_impl.h @@ -10,7 +10,7 @@ #include "base/memory/scoped_ptr.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/services/network/public/interfaces/web_socket.mojom.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/message_loop_ref.h" namespace net { class WebSocketChannel; @@ -25,7 +25,7 @@ class WebSocketReadQueue; class WebSocketImpl : public WebSocket { public: WebSocketImpl(NetworkContext* context, - scoped_ptr<mojo::AppRefCount> app_refcount, + scoped_ptr<mojo::MessageLoopRef> app_refcount, InterfaceRequest<WebSocket> request); ~WebSocketImpl() override; @@ -51,7 +51,7 @@ class WebSocketImpl : public WebSocket { ScopedDataPipeConsumerHandle send_stream_; scoped_ptr<WebSocketReadQueue> read_queue_; NetworkContext* context_; - scoped_ptr<mojo::AppRefCount> app_refcount_; + scoped_ptr<mojo::MessageLoopRef> app_refcount_; StrongBinding<WebSocket> binding_; }; |