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

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

Issue 407593002: mojo: make NetworkServiceImpl clean up after itself (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: scoping Created 6 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698