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

Side by Side Diff: content/browser/service_manager/service_manager_context.cc

Issue 2684433003: Files required by a service now listed in manifest. (Closed)
Patch Set: Fix build. Created 3 years, 10 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/browser/child_process_launcher_helper_win.cc ('k') | content/gpu/gpu_main.cc » ('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/browser/service_manager/service_manager_context.h" 5 #include "content/browser/service_manager/service_manager_context.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/json/json_reader.h" 12 #include "base/json/json_reader.h"
13 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/process/process_handle.h" 16 #include "base/process/process_handle.h"
17 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
18 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
19 #include "content/browser/child_process_launcher.h"
19 #include "content/browser/gpu/gpu_process_host.h" 20 #include "content/browser/gpu/gpu_process_host.h"
20 #include "content/browser/service_manager/merge_dictionary.h" 21 #include "content/browser/service_manager/merge_dictionary.h"
21 #include "content/common/service_manager/service_manager_connection_impl.h" 22 #include "content/common/service_manager/service_manager_connection_impl.h"
22 #include "content/grit/content_resources.h" 23 #include "content/grit/content_resources.h"
23 #include "content/public/browser/browser_thread.h" 24 #include "content/public/browser/browser_thread.h"
24 #include "content/public/browser/content_browser_client.h" 25 #include "content/public/browser/content_browser_client.h"
25 #include "content/public/browser/utility_process_host.h" 26 #include "content/public/browser/utility_process_host.h"
26 #include "content/public/browser/utility_process_host_client.h" 27 #include "content/public/browser/utility_process_host_client.h"
27 #include "content/public/common/content_client.h" 28 #include "content/public/common/content_client.h"
28 #include "content/public/common/service_manager_connection.h" 29 #include "content/public/common/service_manager_connection.h"
29 #include "content/public/common/service_names.mojom.h" 30 #include "content/public/common/service_names.mojom.h"
30 #include "mojo/edk/embedder/embedder.h" 31 #include "mojo/edk/embedder/embedder.h"
31 #include "services/catalog/catalog.h" 32 #include "services/catalog/catalog.h"
32 #include "services/catalog/manifest_provider.h" 33 #include "services/catalog/manifest_provider.h"
34 #include "services/catalog/public/cpp/manifest_parsing_util.h"
33 #include "services/catalog/public/interfaces/constants.mojom.h" 35 #include "services/catalog/public/interfaces/constants.mojom.h"
34 #include "services/catalog/store.h" 36 #include "services/catalog/store.h"
35 #include "services/device/device_service.h" 37 #include "services/device/device_service.h"
36 #include "services/device/public/interfaces/constants.mojom.h" 38 #include "services/device/public/interfaces/constants.mojom.h"
37 #include "services/service_manager/connect_params.h" 39 #include "services/service_manager/connect_params.h"
38 #include "services/service_manager/public/cpp/connector.h" 40 #include "services/service_manager/public/cpp/connector.h"
39 #include "services/service_manager/public/cpp/service.h" 41 #include "services/service_manager/public/cpp/service.h"
40 #include "services/service_manager/public/interfaces/service.mojom.h" 42 #include "services/service_manager/public/interfaces/service.mojom.h"
41 #include "services/service_manager/runner/common/client_util.h" 43 #include "services/service_manager/runner/common/client_util.h"
42 #include "services/service_manager/service_manager.h" 44 #include "services/service_manager/service_manager.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 if (overlay_value) { 136 if (overlay_value) {
135 base::DictionaryValue* manifest_dictionary = nullptr; 137 base::DictionaryValue* manifest_dictionary = nullptr;
136 bool result = manifest_value->GetAsDictionary(&manifest_dictionary); 138 bool result = manifest_value->GetAsDictionary(&manifest_dictionary);
137 DCHECK(result); 139 DCHECK(result);
138 base::DictionaryValue* overlay_dictionary = nullptr; 140 base::DictionaryValue* overlay_dictionary = nullptr;
139 result = overlay_value->GetAsDictionary(&overlay_dictionary); 141 result = overlay_value->GetAsDictionary(&overlay_dictionary);
140 DCHECK(result); 142 DCHECK(result);
141 MergeDictionary(manifest_dictionary, overlay_dictionary); 143 MergeDictionary(manifest_dictionary, overlay_dictionary);
142 } 144 }
143 145
146 base::Optional<catalog::RequiredFileMap> required_files =
147 catalog::RetrieveRequiredFiles(*manifest_value);
148 if (required_files) {
149 ChildProcessLauncher::SetRegisteredFilesForService(
150 name.as_string(), std::move(*required_files));
151 }
152
144 auto result = manifests_.insert( 153 auto result = manifests_.insert(
145 std::make_pair(name.as_string(), std::move(manifest_value))); 154 std::make_pair(name.as_string(), std::move(manifest_value)));
146 DCHECK(result.second) << "Duplicate manifest entry: " << name; 155 DCHECK(result.second) << "Duplicate manifest entry: " << name;
147 } 156 }
148 157
149 private: 158 private:
150 // catalog::ManifestProvider: 159 // catalog::ManifestProvider:
151 std::unique_ptr<base::Value> GetManifest(const std::string& name) override { 160 std::unique_ptr<base::Value> GetManifest(const std::string& name) override {
152 auto it = manifests_.find(name); 161 auto it = manifests_.find(name);
153 return it != manifests_.end() ? it->second->CreateDeepCopy() : nullptr; 162 return it != manifests_.end() ? it->second->CreateDeepCopy() : nullptr;
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 base::Bind(&DestroyConnectorOnIOThread)); 366 base::Bind(&DestroyConnectorOnIOThread));
358 } 367 }
359 368
360 // static 369 // static
361 service_manager::Connector* ServiceManagerContext::GetConnectorForIOThread() { 370 service_manager::Connector* ServiceManagerContext::GetConnectorForIOThread() {
362 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 371 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
363 return g_io_thread_connector.Get().get(); 372 return g_io_thread_connector.Get().get();
364 } 373 }
365 374
366 } // namespace content 375 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/child_process_launcher_helper_win.cc ('k') | content/gpu/gpu_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698