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

Side by Side Diff: content/child/process_control_impl.cc

Issue 1889253002: Remove uses of shell::Loader from content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « content/child/process_control_impl.h ('k') | content/common/mojo/embedded_application_runner.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/child/process_control_impl.h" 5 #include "content/child/process_control_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/stl_util.h" 9 #include "base/bind.h"
10 #include "content/common/mojo/static_loader.h" 10 #include "base/memory/ptr_util.h"
11 #include "content/public/common/content_client.h" 11 #include "content/public/common/content_client.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 ProcessControlImpl::ProcessControlImpl() { 15 ProcessControlImpl::ProcessControlImpl() {
16 } 16 }
17 17
18 ProcessControlImpl::~ProcessControlImpl() { 18 ProcessControlImpl::~ProcessControlImpl() {
19 STLDeleteValues(&name_to_loader_map_);
20 } 19 }
21 20
22 void ProcessControlImpl::LoadApplication( 21 void ProcessControlImpl::LoadApplication(
23 const mojo::String& name, 22 const mojo::String& name,
24 mojo::InterfaceRequest<shell::mojom::ShellClient> request, 23 shell::mojom::ShellClientRequest request,
25 const LoadApplicationCallback& callback) { 24 const LoadApplicationCallback& callback) {
26 // Only register loaders when we need it. 25 // Only register apps on first run.
27 if (!has_registered_loaders_) { 26 if (!has_registered_apps_) {
28 DCHECK(name_to_loader_map_.empty()); 27 DCHECK(apps_.empty());
29 RegisterLoaders(&name_to_loader_map_); 28 ApplicationFactoryMap app_factories;
30 has_registered_loaders_ = true; 29 RegisterApplicationFactories(&app_factories);
30 for (const auto& factory : app_factories) {
31 std::unique_ptr<EmbeddedApplicationRunner> runner(
32 new EmbeddedApplicationRunner(factory.second, nullptr));
33 runner->SetQuitClosure(base::Bind(&ProcessControlImpl::OnApplicationQuit,
34 base::Unretained(this)));
35 apps_.insert(std::make_pair(factory.first, std::move(runner)));
36 }
37 has_registered_apps_ = true;
31 } 38 }
32 39
33 auto it = name_to_loader_map_.find(name); 40 auto it = apps_.find(name);
34 if (it == name_to_loader_map_.end()) { 41 if (it == apps_.end()) {
35 callback.Run(false); 42 callback.Run(false);
36 OnLoadFailed(); 43 OnLoadFailed();
37 return; 44 return;
38 } 45 }
39 46
40 callback.Run(true); 47 callback.Run(true);
41 it->second->Load(name, std::move(request)); 48 it->second->BindShellClientRequest(std::move(request));
42 } 49 }
43 50
44 } // namespace content 51 } // namespace content
OLDNEW
« no previous file with comments | « content/child/process_control_impl.h ('k') | content/common/mojo/embedded_application_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698