| Index: mojo/services/network/main.cc
|
| diff --git a/mojo/services/network/main.cc b/mojo/services/network/main.cc
|
| index 718a4310e912811c75ce6f2966e164782e1ab579..e7455a43b3a76fa99bed1a4d5b53c0f5929637be 100644
|
| --- a/mojo/services/network/main.cc
|
| +++ b/mojo/services/network/main.cc
|
| @@ -43,13 +43,22 @@ extern "C" APPLICATION_EXPORT MojoResult CDECL MojoMain(
|
| base::AtExitManager at_exit;
|
| #endif
|
|
|
| - // The IO message loop allows us to use net::URLRequest on this thread.
|
| - base::MessageLoopForIO loop;
|
| -
|
| + // The Delegate owns the NetworkContext, which needs to outlive
|
| + // MessageLoopForIO. Destruction of the message loop will serve to
|
| + // invalidate connections made to network services (URLLoader) and cause
|
| + // the service instances to be cleaned up as a result of observing pipe
|
| + // errors. This is important as ~URLRequestContext asserts that no out-
|
| + // standing URLRequests exist.
|
| Delegate delegate;
|
| - mojo::ApplicationImpl app(
|
| - &delegate, mojo::MakeScopedHandle(mojo::MessagePipeHandle(shell_handle)));
|
| + {
|
| + // The IO message loop allows us to use net::URLRequest on this thread.
|
| + base::MessageLoopForIO loop;
|
| +
|
| + mojo::ApplicationImpl app(
|
| + &delegate,
|
| + mojo::MakeScopedHandle(mojo::MessagePipeHandle(shell_handle)));
|
|
|
| - loop.Run();
|
| + loop.Run();
|
| + }
|
| return MOJO_RESULT_OK;
|
| }
|
|
|