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

Side by Side Diff: trunk/src/mojo/service_manager/background_shell_service_loader.cc

Issue 443063003: Revert 287680 "mojo: terminate apps if the shell goes away" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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/service_manager/background_shell_service_loader.h" 5 #include "mojo/service_manager/background_shell_service_loader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "mojo/service_manager/service_manager.h" 9 #include "mojo/service_manager/service_manager.h"
10 10
(...skipping 17 matching lines...) Expand all
28 private: 28 private:
29 ServiceLoader* loader_; // Owned by BackgroundShellServiceLoader 29 ServiceLoader* loader_; // Owned by BackgroundShellServiceLoader
30 30
31 DISALLOW_COPY_AND_ASSIGN(BackgroundLoader); 31 DISALLOW_COPY_AND_ASSIGN(BackgroundLoader);
32 }; 32 };
33 33
34 BackgroundShellServiceLoader::BackgroundShellServiceLoader( 34 BackgroundShellServiceLoader::BackgroundShellServiceLoader(
35 scoped_ptr<ServiceLoader> real_loader, 35 scoped_ptr<ServiceLoader> real_loader,
36 const std::string& thread_name, 36 const std::string& thread_name,
37 base::MessageLoop::Type message_loop_type) 37 base::MessageLoop::Type message_loop_type)
38 : loader_(real_loader.Pass()), 38 : quit_on_shutdown_(false),
39 loader_(real_loader.Pass()),
39 message_loop_type_(message_loop_type), 40 message_loop_type_(message_loop_type),
40 thread_name_(thread_name), 41 thread_name_(thread_name),
41 message_loop_created_(true, false), 42 message_loop_created_(true, false),
42 background_loader_(NULL) { 43 background_loader_(NULL) {
43 } 44 }
44 45
45 BackgroundShellServiceLoader::~BackgroundShellServiceLoader() { 46 BackgroundShellServiceLoader::~BackgroundShellServiceLoader() {
46 if (thread_) 47 if (thread_) {
48 if (quit_on_shutdown_)
49 task_runner_->PostTask(FROM_HERE, quit_closure_);
47 thread_->Join(); 50 thread_->Join();
51 }
48 } 52 }
49 53
50 void BackgroundShellServiceLoader::LoadService( 54 void BackgroundShellServiceLoader::LoadService(
51 ServiceManager* manager, 55 ServiceManager* manager,
52 const GURL& url, 56 const GURL& url,
53 ScopedMessagePipeHandle shell_handle) { 57 ScopedMessagePipeHandle shell_handle) {
54 if (!thread_) { 58 if (!thread_) {
55 // TODO(tim): It'd be nice if we could just have each LoadService call 59 // TODO(tim): It'd be nice if we could just have each LoadService call
56 // result in a new thread like DynamicService{Loader, Runner}. But some 60 // result in a new thread like DynamicService{Loader, Runner}. But some
57 // loaders are creating multiple ApplicationImpls (NetworkServiceLoader) 61 // loaders are creating multiple ApplicationImpls (NetworkServiceLoader)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 109
106 void BackgroundShellServiceLoader::OnServiceErrorOnBackgroundThread( 110 void BackgroundShellServiceLoader::OnServiceErrorOnBackgroundThread(
107 ServiceManager* manager, const GURL& url) { 111 ServiceManager* manager, const GURL& url) {
108 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 112 DCHECK(task_runner_->RunsTasksOnCurrentThread());
109 if (!background_loader_) 113 if (!background_loader_)
110 background_loader_ = new BackgroundLoader(loader_.get()); 114 background_loader_ = new BackgroundLoader(loader_.get());
111 background_loader_->OnServiceError(manager, url); 115 background_loader_->OnServiceError(manager, url);
112 } 116 }
113 117
114 } // namespace mojo 118 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698