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

Side by Side Diff: mojo/shell/in_process_dynamic_service_runner.cc

Issue 491443005: Get rid of KeepAlive. Quit shell when all urls run directly by Context are closed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bring back ConnectToServiceViaNetwork Created 6 years, 4 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 | Annotate | Revision Log
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/shell/in_process_dynamic_service_runner.h" 5 #include "mojo/shell/in_process_dynamic_service_runner.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 23 matching lines...) Expand all
34 if (expected_size > sizeof(Thunks)) { 34 if (expected_size > sizeof(Thunks)) {
35 LOG(ERROR) << "Invalid app library: expected " << function_name 35 LOG(ERROR) << "Invalid app library: expected " << function_name
36 << " to return thunks of size: " << expected_size; 36 << " to return thunks of size: " << expected_size;
37 return false; 37 return false;
38 } 38 }
39 return true; 39 return true;
40 } 40 }
41 } 41 }
42 42
43 InProcessDynamicServiceRunner::InProcessDynamicServiceRunner( 43 InProcessDynamicServiceRunner::InProcessDynamicServiceRunner(
44 Context* context) 44 Context* context) {
45 : keep_alive_(context) {
46 } 45 }
47 46
48 InProcessDynamicServiceRunner::~InProcessDynamicServiceRunner() { 47 InProcessDynamicServiceRunner::~InProcessDynamicServiceRunner() {
49 if (thread_) { 48 if (thread_) {
50 DCHECK(thread_->HasBeenStarted()); 49 DCHECK(thread_->HasBeenStarted());
51 DCHECK(!thread_->HasBeenJoined()); 50 DCHECK(!thread_->HasBeenJoined());
52 thread_->Join(); 51 thread_->Join();
53 } 52 }
54 53
55 // It is important to let the thread exit before unloading the DSO because 54 // It is important to let the thread exit before unloading the DSO because
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 LOG(ERROR) << "MojoMain returned an error: " << result; 144 LOG(ERROR) << "MojoMain returned an error: " << result;
146 } while (false); 145 } while (false);
147 146
148 bool success = app_completed_callback_runner_.Run(); 147 bool success = app_completed_callback_runner_.Run();
149 app_completed_callback_runner_.Reset(); 148 app_completed_callback_runner_.Reset();
150 LOG_IF(ERROR, !success) << "Failed post run app_completed_callback"; 149 LOG_IF(ERROR, !success) << "Failed post run app_completed_callback";
151 } 150 }
152 151
153 } // namespace shell 152 } // namespace shell
154 } // namespace mojo 153 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698