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

Side by Side Diff: mojo/service_manager/background_service_loader.cc

Issue 298003008: Shell / ShellClient -> ServiceProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
« no previous file with comments | « mojo/service_manager/background_service_loader.h ('k') | mojo/service_manager/service_loader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_service_loader.h" 5 #include "mojo/service_manager/background_service_loader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "mojo/service_manager/service_manager.h" 8 #include "mojo/service_manager/service_manager.h"
9 9
10 namespace mojo { 10 namespace mojo {
11 11
12 class BackgroundServiceLoader::BackgroundLoader { 12 class BackgroundServiceLoader::BackgroundLoader {
13 public: 13 public:
14 explicit BackgroundLoader(ServiceLoader* loader) : loader_(loader) {} 14 explicit BackgroundLoader(ServiceLoader* loader) : loader_(loader) {}
15 ~BackgroundLoader() {} 15 ~BackgroundLoader() {}
16 16
17 void LoadService(ServiceManager* manager, 17 void LoadService(ServiceManager* manager,
18 const GURL& url, 18 const GURL& url,
19 ScopedMessagePipeHandle shell_handle) { 19 ScopedMessagePipeHandle service_provider_handle) {
20 loader_->LoadService(manager, url, shell_handle.Pass()); 20 loader_->LoadService(manager, url, service_provider_handle.Pass());
21 } 21 }
22 22
23 void OnServiceError(ServiceManager* manager, const GURL& url) { 23 void OnServiceError(ServiceManager* manager, const GURL& url) {
24 loader_->OnServiceError(manager, url); 24 loader_->OnServiceError(manager, url);
25 } 25 }
26 26
27 private: 27 private:
28 base::MessageLoop::Type message_loop_type_; 28 base::MessageLoop::Type message_loop_type_;
29 ServiceLoader* loader_; // Owned by BackgroundServiceLoader 29 ServiceLoader* loader_; // Owned by BackgroundServiceLoader
30 30
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 thread_.Start(); 73 thread_.Start();
74 thread_.message_loop()->PostTask( 74 thread_.message_loop()->PostTask(
75 FROM_HERE, 75 FROM_HERE,
76 base::Bind(&BackgroundServiceLoader::OnServiceErrorOnBackgroundThread, 76 base::Bind(&BackgroundServiceLoader::OnServiceErrorOnBackgroundThread,
77 base::Unretained(this), manager, url)); 77 base::Unretained(this), manager, url));
78 } 78 }
79 79
80 void BackgroundServiceLoader::LoadServiceOnBackgroundThread( 80 void BackgroundServiceLoader::LoadServiceOnBackgroundThread(
81 ServiceManager* manager, 81 ServiceManager* manager,
82 const GURL& url, 82 const GURL& url,
83 ScopedMessagePipeHandle* shell_handle) { 83 ScopedMessagePipeHandle* service_provider_handle) {
84 if (!background_loader_) 84 if (!background_loader_)
85 background_loader_ = new BackgroundLoader(loader_.get()); 85 background_loader_ = new BackgroundLoader(loader_.get());
86 background_loader_->LoadService(manager, url, shell_handle->Pass()); 86 background_loader_->LoadService(
87 manager, url, service_provider_handle->Pass());
87 } 88 }
88 89
89 void BackgroundServiceLoader::OnServiceErrorOnBackgroundThread( 90 void BackgroundServiceLoader::OnServiceErrorOnBackgroundThread(
90 ServiceManager* manager, 91 ServiceManager* manager,
91 const GURL& url) { 92 const GURL& url) {
92 if (!background_loader_) 93 if (!background_loader_)
93 background_loader_ = new BackgroundLoader(loader_.get()); 94 background_loader_ = new BackgroundLoader(loader_.get());
94 background_loader_->OnServiceError(manager, url); 95 background_loader_->OnServiceError(manager, url);
95 } 96 }
96 97
97 void BackgroundServiceLoader::ShutdownOnBackgroundThread() { 98 void BackgroundServiceLoader::ShutdownOnBackgroundThread() {
98 delete background_loader_; 99 delete background_loader_;
99 // Destroy |loader_| on the thread it's actually used on. 100 // Destroy |loader_| on the thread it's actually used on.
100 loader_.reset(); 101 loader_.reset();
101 } 102 }
102 103
103 } // namespace mojo 104 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/service_manager/background_service_loader.h ('k') | mojo/service_manager/service_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698