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

Side by Side Diff: mojo/application/public/cpp/lib/application_runner.cc

Issue 1195003002: Mandoline: Introduce ApplicationConnection::CloseConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed typo Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/application/public/cpp/application_runner.h" 5 #include "mojo/application/public/cpp/application_runner.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/stack_trace.h" 9 #include "base/debug/stack_trace.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 MakeRequest<Application>(MakeScopedHandle( 61 MakeRequest<Application>(MakeScopedHandle(
62 MessagePipeHandle(application_request_handle)))); 62 MessagePipeHandle(application_request_handle))));
63 loop->Run(); 63 loop->Run();
64 // It's very common for the delegate to cache the app and terminate on 64 // It's very common for the delegate to cache the app and terminate on
65 // errors. If we don't delete the delegate before the app we run the risk 65 // errors. If we don't delete the delegate before the app we run the risk
66 // of the delegate having a stale reference to the app and trying to use it. 66 // of the delegate having a stale reference to the app and trying to use it.
67 // Note that we destruct the message loop first because that might trigger 67 // Note that we destruct the message loop first because that might trigger
68 // connection error handlers and they might access objects created by the 68 // connection error handlers and they might access objects created by the
69 // delegate. 69 // delegate.
70 loop.reset(); 70 loop.reset();
71 // Give |impl| an opportunity to perform some cleanup prior to destruction
72 // of the delegate.
73 impl.WillDestroySoon();
71 delegate_.reset(); 74 delegate_.reset();
72 } 75 }
73 return MOJO_RESULT_OK; 76 return MOJO_RESULT_OK;
74 } 77 }
75 78
76 MojoResult ApplicationRunner::Run(MojoHandle application_request_handle) { 79 MojoResult ApplicationRunner::Run(MojoHandle application_request_handle) {
77 return Run(application_request_handle, true); 80 return Run(application_request_handle, true);
78 } 81 }
79 82
80 } // namespace mojo 83 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698