Chromium Code Reviews| Index: mojo/services/network/main.cc |
| diff --git a/mojo/services/network/main.cc b/mojo/services/network/main.cc |
| index bdfbda2412b26282a3fb39aec210ebdf2b35ff6b..ed9059384583b360ab4cb9a0447e561d9721ccf9 100644 |
| --- a/mojo/services/network/main.cc |
| +++ b/mojo/services/network/main.cc |
| @@ -10,7 +10,9 @@ |
| #include "base/path_service.h" |
| #include "mojo/public/cpp/application/application_connection.h" |
| #include "mojo/public/cpp/application/application_delegate.h" |
| +#include "mojo/public/cpp/application/application_export.h" |
| #include "mojo/public/cpp/application/application_impl.h" |
| +#include "mojo/public/cpp/application/application_runner_chromium.h" |
| #include "mojo/public/cpp/application/interface_factory.h" |
| #include "mojo/public/cpp/bindings/interface_ptr.h" |
| #include "mojo/services/network/network_context.h" |
| @@ -50,27 +52,7 @@ class Delegate : public mojo::ApplicationDelegate, |
| extern "C" APPLICATION_EXPORT MojoResult CDECL MojoMain( |
| MojoHandle shell_handle) { |
| - base::CommandLine::Init(0, NULL); |
| -#if !defined(COMPONENT_BUILD) |
| - base::AtExitManager at_exit; |
| -#endif |
| - |
| - // 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; |
| - { |
| - // 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(); |
| - } |
| - return MOJO_RESULT_OK; |
| + mojo::ApplicationRunnerChromium runner(new Delegate); |
| + runner.set_loop_type(base::MessageLoop::TYPE_IO); |
|
darin (slow to review)
2014/08/18 23:38:18
nit: spell it out: set_message_loop_type
tim (not reviewing)
2014/08/19 00:06:30
Done.
|
| + return runner.Run(shell_handle); |
| } |