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

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

Issue 1947313002: Enable content embedders to specify mojo application task runner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: restores mojo:media in browser Created 4 years, 7 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/content_common.gypi » ('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/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "content/common/mojo/embedded_application_runner.h"
11 #include "content/public/common/content_client.h" 12 #include "content/public/common/content_client.h"
12 13
13 namespace content { 14 namespace content {
14 15
15 ProcessControlImpl::ProcessControlImpl() { 16 ProcessControlImpl::ProcessControlImpl() {
16 } 17 }
17 18
18 ProcessControlImpl::~ProcessControlImpl() { 19 ProcessControlImpl::~ProcessControlImpl() {
19 } 20 }
20 21
21 void ProcessControlImpl::LoadApplication( 22 void ProcessControlImpl::LoadApplication(
22 const mojo::String& name, 23 const mojo::String& name,
23 shell::mojom::ShellClientRequest request, 24 shell::mojom::ShellClientRequest request,
24 const LoadApplicationCallback& callback) { 25 const LoadApplicationCallback& callback) {
25 // Only register apps on first run. 26 // Only register apps on first run.
26 if (!has_registered_apps_) { 27 if (!has_registered_apps_) {
27 DCHECK(apps_.empty()); 28 DCHECK(apps_.empty());
28 ApplicationFactoryMap app_factories; 29 ApplicationMap apps;
29 RegisterApplicationFactories(&app_factories); 30 RegisterApplications(&apps);
30 for (const auto& factory : app_factories) { 31 for (const auto& app : apps) {
31 std::unique_ptr<EmbeddedApplicationRunner> runner( 32 std::unique_ptr<EmbeddedApplicationRunner> runner(
32 new EmbeddedApplicationRunner(factory.second, nullptr)); 33 new EmbeddedApplicationRunner(app.second.application_factory,
34 app.second.application_task_runner));
33 runner->SetQuitClosure(base::Bind(&ProcessControlImpl::OnApplicationQuit, 35 runner->SetQuitClosure(base::Bind(&ProcessControlImpl::OnApplicationQuit,
34 base::Unretained(this))); 36 base::Unretained(this)));
35 apps_.insert(std::make_pair(factory.first, std::move(runner))); 37 apps_.insert(std::make_pair(app.first, std::move(runner)));
36 } 38 }
37 has_registered_apps_ = true; 39 has_registered_apps_ = true;
38 } 40 }
39 41
40 auto it = apps_.find(name); 42 auto it = apps_.find(name);
41 if (it == apps_.end()) { 43 if (it == apps_.end()) {
42 callback.Run(false); 44 callback.Run(false);
43 OnLoadFailed(); 45 OnLoadFailed();
44 return; 46 return;
45 } 47 }
46 48
47 callback.Run(true); 49 callback.Run(true);
48 it->second->BindShellClientRequest(std::move(request)); 50 it->second->BindShellClientRequest(std::move(request));
49 } 51 }
50 52
51 } // namespace content 53 } // namespace content
OLDNEW
« no previous file with comments | « content/child/process_control_impl.h ('k') | content/content_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698