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

Side by Side Diff: components/nacl/renderer/json_manifest.cc

Issue 856583003: NaCl: Merge three global PP_Instance mappings into one (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase properly Created 5 years, 11 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 | « components/nacl/renderer/json_manifest.h ('k') | components/nacl/renderer/nexe_load_manager.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 "components/nacl/renderer/json_manifest.h" 5 #include "components/nacl/renderer/json_manifest.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/containers/scoped_ptr_hash_map.h"
10 #include "base/lazy_instance.h"
11 #include "base/logging.h" 9 #include "base/logging.h"
12 #include "base/macros.h" 10 #include "base/macros.h"
13 #include "components/nacl/renderer/nexe_load_manager.h" 11 #include "components/nacl/renderer/nexe_load_manager.h"
14 #include "third_party/jsoncpp/source/include/json/reader.h" 12 #include "third_party/jsoncpp/source/include/json/reader.h"
15 #include "third_party/jsoncpp/source/include/json/value.h" 13 #include "third_party/jsoncpp/source/include/json/value.h"
16 #include "url/gurl.h" 14 #include "url/gurl.h"
17 15
18 namespace nacl { 16 namespace nacl {
19 17
20 namespace { 18 namespace {
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 // Currently only allow 0 or 2, since that is what we test. 371 // Currently only allow 0 or 2, since that is what we test.
374 if (opt_raw <= 0) 372 if (opt_raw <= 0)
375 pnacl_options->opt_level = 0; 373 pnacl_options->opt_level = 0;
376 else 374 else
377 pnacl_options->opt_level = 2; 375 pnacl_options->opt_level = 2;
378 } 376 }
379 } 377 }
380 378
381 } // namespace 379 } // namespace
382 380
383 typedef base::ScopedPtrHashMap<PP_Instance, nacl::JsonManifest> JsonManifestMap;
384 base::LazyInstance<JsonManifestMap> g_manifest_map = LAZY_INSTANCE_INITIALIZER;
385
386 void AddJsonManifest(PP_Instance instance, scoped_ptr<JsonManifest> manifest) {
387 g_manifest_map.Get().add(instance, manifest.Pass());
388 }
389
390 JsonManifest* GetJsonManifest(PP_Instance instance) {
391 return g_manifest_map.Get().get(instance);
392 }
393
394 void DeleteJsonManifest(PP_Instance instance) {
395 g_manifest_map.Get().erase(instance);
396 }
397
398 JsonManifest::JsonManifest(const std::string& manifest_base_url, 381 JsonManifest::JsonManifest(const std::string& manifest_base_url,
399 const std::string& sandbox_isa, 382 const std::string& sandbox_isa,
400 bool nonsfi_enabled, 383 bool nonsfi_enabled,
401 bool pnacl_debug) 384 bool pnacl_debug)
402 : manifest_base_url_(manifest_base_url), 385 : manifest_base_url_(manifest_base_url),
403 sandbox_isa_(sandbox_isa), 386 sandbox_isa_(sandbox_isa),
404 nonsfi_enabled_(nonsfi_enabled), 387 nonsfi_enabled_(nonsfi_enabled),
405 pnacl_debug_(pnacl_debug) { } 388 pnacl_debug_(pnacl_debug) { }
406 389
407 bool JsonManifest::Init(const std::string& manifest_json, 390 bool JsonManifest::Init(const std::string& manifest_json,
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 } else { 645 } else {
663 // NaCl 646 // NaCl
664 *url = isa_spec[kUrlKey].asString(); 647 *url = isa_spec[kUrlKey].asString();
665 pnacl_options->translate = PP_FALSE; 648 pnacl_options->translate = PP_FALSE;
666 } 649 }
667 650
668 return true; 651 return true;
669 } 652 }
670 653
671 } // namespace nacl 654 } // namespace nacl
OLDNEW
« no previous file with comments | « components/nacl/renderer/json_manifest.h ('k') | components/nacl/renderer/nexe_load_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698