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

Unified Diff: content/browser/service_manager/service_manager_context.cc

Issue 2501913002: Change the NaCl loader and broker processes to use the ServiceManager. (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/service_manager/service_manager_context.cc
diff --git a/content/browser/service_manager/service_manager_context.cc b/content/browser/service_manager/service_manager_context.cc
index 2b211b4511f52a523581e026e33ba0523c759a5f..d6643aa12860febfb2d23d92dcbacfc2aa67f7eb 100644
--- a/content/browser/service_manager/service_manager_context.cc
+++ b/content/browser/service_manager/service_manager_context.cc
@@ -115,10 +115,30 @@ class BuiltinManifestProvider : public catalog::ManifestProvider {
BuiltinManifestProvider() {}
~BuiltinManifestProvider() override {}
- void AddManifestValue(const std::string& name,
- std::unique_ptr<base::Value> manifest_contents) {
+ void AddServiceManifest(std::string name, int resource_id) {
+ std::string contents =
+ GetContentClient()
+ ->GetDataResource(resource_id, ui::ScaleFactor::SCALE_FACTOR_NONE)
+ .as_string();
+ CHECK(!contents.empty());
piman 2016/11/28 23:04:37 If these are to investigate a bug, please document
Sam McNally 2016/11/28 23:33:22 Ken: thoughts?
Ken Rockot(use gerrit already) 2016/11/28 23:47:22 I'd rather just leave the CHECKs in. They aren't n
Sam McNally 2016/11/29 03:30:14 Changed to DCHECKs.
+
+ std::unique_ptr<base::Value> manifest_value =
+ base::JSONReader::Read(contents);
+ base::debug::Alias(&contents);
+ CHECK(manifest_value);
+
+ std::unique_ptr<base::Value> overlay_value =
+ GetContentClient()->browser()->GetServiceManifestOverlay(name);
+ if (overlay_value) {
+ base::DictionaryValue* manifest_dictionary = nullptr;
+ CHECK(manifest_value->GetAsDictionary(&manifest_dictionary));
+ base::DictionaryValue* overlay_dictionary = nullptr;
+ CHECK(overlay_value->GetAsDictionary(&overlay_dictionary));
+ MergeDictionary(manifest_dictionary, overlay_dictionary);
+ }
+
auto result = manifests_.insert(
- std::make_pair(name, std::move(manifest_contents)));
+ std::make_pair(std::move(name), std::move(manifest_value)));
DCHECK(result.second) << "Duplicate manifest entry: " << name;
}
@@ -223,30 +243,14 @@ ServiceManagerContext::ServiceManagerContext() {
};
for (size_t i = 0; i < arraysize(kManifests); ++i) {
- std::string contents = GetContentClient()->GetDataResource(
- kManifests[i].resource_id,
- ui::ScaleFactor::SCALE_FACTOR_NONE).as_string();
base::debug::Alias(&i);
- CHECK(!contents.empty());
-
- std::unique_ptr<base::Value> manifest_value =
- base::JSONReader::Read(contents);
- base::debug::Alias(&contents);
- CHECK(manifest_value);
-
- std::unique_ptr<base::Value> overlay_value =
- GetContentClient()->browser()->GetServiceManifestOverlay(
- kManifests[i].name);
- if (overlay_value) {
- base::DictionaryValue* manifest_dictionary = nullptr;
- CHECK(manifest_value->GetAsDictionary(&manifest_dictionary));
- base::DictionaryValue* overlay_dictionary = nullptr;
- CHECK(overlay_value->GetAsDictionary(&overlay_dictionary));
- MergeDictionary(manifest_dictionary, overlay_dictionary);
- }
-
- manifest_provider->AddManifestValue(kManifests[i].name,
- std::move(manifest_value));
+ manifest_provider->AddServiceManifest(kManifests[i].name,
+ kManifests[i].resource_id);
+ }
+ for (const auto& manifest :
+ GetContentClient()->browser()->GetExtraServiceManifests()) {
+ manifest_provider->AddServiceManifest(std::move(manifest.name),
+ manifest.resource_id);
}
in_process_context_ = new InProcessServiceManagerContext;
request = in_process_context_->Start(std::move(manifest_provider));
« no previous file with comments | « content/browser/browser_child_process_host_impl.cc ('k') | content/public/browser/browser_child_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698