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

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

Issue 310113002: Pepper: Move JsonManifestMap to json_manifest.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 6 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 | Annotate | Revision Log
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"
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "base/macros.h" 12 #include "base/macros.h"
11 #include "components/nacl/renderer/nexe_load_manager.h" 13 #include "components/nacl/renderer/nexe_load_manager.h"
12 #include "third_party/jsoncpp/source/include/json/reader.h" 14 #include "third_party/jsoncpp/source/include/json/reader.h"
13 #include "third_party/jsoncpp/source/include/json/value.h" 15 #include "third_party/jsoncpp/source/include/json/value.h"
14 #include "url/gurl.h" 16 #include "url/gurl.h"
15 17
16 namespace nacl { 18 namespace nacl {
17 19
18 namespace { 20 namespace {
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 // Currently only allow 0 or 2, since that is what we test. 373 // Currently only allow 0 or 2, since that is what we test.
372 if (opt_raw <= 0) 374 if (opt_raw <= 0)
373 pnacl_options->opt_level = 0; 375 pnacl_options->opt_level = 0;
374 else 376 else
375 pnacl_options->opt_level = 2; 377 pnacl_options->opt_level = 2;
376 } 378 }
377 } 379 }
378 380
379 } // namespace 381 } // namespace
380 382
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
381 JsonManifest::JsonManifest(const std::string& manifest_base_url, 398 JsonManifest::JsonManifest(const std::string& manifest_base_url,
382 const std::string& sandbox_isa, 399 const std::string& sandbox_isa,
383 bool nonsfi_enabled, 400 bool nonsfi_enabled,
384 bool pnacl_debug) 401 bool pnacl_debug)
385 : manifest_base_url_(manifest_base_url), 402 : manifest_base_url_(manifest_base_url),
386 sandbox_isa_(sandbox_isa), 403 sandbox_isa_(sandbox_isa),
387 nonsfi_enabled_(nonsfi_enabled), 404 nonsfi_enabled_(nonsfi_enabled),
388 pnacl_debug_(pnacl_debug) { } 405 pnacl_debug_(pnacl_debug) { }
389 406
390 bool JsonManifest::Init(const std::string& manifest_json, 407 bool JsonManifest::Init(const std::string& manifest_json,
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 } else { 662 } else {
646 // NaCl 663 // NaCl
647 *url = isa_spec[kUrlKey].asString(); 664 *url = isa_spec[kUrlKey].asString();
648 pnacl_options->translate = PP_FALSE; 665 pnacl_options->translate = PP_FALSE;
649 } 666 }
650 667
651 return true; 668 return true;
652 } 669 }
653 670
654 } // namespace nacl 671 } // namespace nacl
OLDNEW
« no previous file with comments | « components/nacl/renderer/json_manifest.h ('k') | components/nacl/renderer/ppb_nacl_private_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698