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

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

Issue 2733283002: Require explicit selection of traits for LazyInstance (Closed)
Patch Set: l10n again Created 3 years, 9 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/mime_util/mime_util.cc ('k') | components/os_crypt/key_storage_linux.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ppb_nacl_private.h" 5 #include "components/nacl/renderer/ppb_nacl_private.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 namespace nacl { 78 namespace nacl {
79 namespace { 79 namespace {
80 80
81 // The pseudo-architecture used to indicate portable native client. 81 // The pseudo-architecture used to indicate portable native client.
82 const char* const kPortableArch = "portable"; 82 const char* const kPortableArch = "portable";
83 83
84 // The base URL for resources used by the PNaCl translator processes. 84 // The base URL for resources used by the PNaCl translator processes.
85 const char* kPNaClTranslatorBaseUrl = "chrome://pnacl-translator/"; 85 const char* kPNaClTranslatorBaseUrl = "chrome://pnacl-translator/";
86 86
87 base::LazyInstance<scoped_refptr<PnaclTranslationResourceHost> > 87 base::LazyInstance<scoped_refptr<PnaclTranslationResourceHost>>::
88 g_pnacl_resource_host = LAZY_INSTANCE_INITIALIZER; 88 DestructorAtExit g_pnacl_resource_host = LAZY_INSTANCE_INITIALIZER;
89 89
90 bool InitializePnaclResourceHost() { 90 bool InitializePnaclResourceHost() {
91 // Must run on the main thread. 91 // Must run on the main thread.
92 content::RenderThread* render_thread = content::RenderThread::Get(); 92 content::RenderThread* render_thread = content::RenderThread::Get();
93 if (!render_thread) 93 if (!render_thread)
94 return false; 94 return false;
95 if (!g_pnacl_resource_host.Get().get()) { 95 if (!g_pnacl_resource_host.Get().get()) {
96 g_pnacl_resource_host.Get() = 96 g_pnacl_resource_host.Get() =
97 new PnaclTranslationResourceHost(render_thread->GetIOTaskRunner()); 97 new PnaclTranslationResourceHost(render_thread->GetIOTaskRunner());
98 render_thread->AddFilter(g_pnacl_resource_host.Get().get()); 98 render_thread->AddFilter(g_pnacl_resource_host.Get().get());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 std::unique_ptr<JsonManifest> json_manifest; 143 std::unique_ptr<JsonManifest> json_manifest;
144 std::unique_ptr<InstanceInfo> instance_info; 144 std::unique_ptr<InstanceInfo> instance_info;
145 145
146 // When translation is complete, this records the size of the pexe in 146 // When translation is complete, this records the size of the pexe in
147 // bytes so that it can be reported in a later load event. 147 // bytes so that it can be reported in a later load event.
148 uint64_t pexe_size; 148 uint64_t pexe_size;
149 }; 149 };
150 150
151 typedef std::unordered_map<PP_Instance, std::unique_ptr<NaClPluginInstance>> 151 typedef std::unordered_map<PP_Instance, std::unique_ptr<NaClPluginInstance>>
152 InstanceMap; 152 InstanceMap;
153 base::LazyInstance<InstanceMap> g_instance_map = LAZY_INSTANCE_INITIALIZER; 153 base::LazyInstance<InstanceMap>::DestructorAtExit g_instance_map =
154 LAZY_INSTANCE_INITIALIZER;
154 155
155 NaClPluginInstance* GetNaClPluginInstance(PP_Instance instance) { 156 NaClPluginInstance* GetNaClPluginInstance(PP_Instance instance) {
156 InstanceMap& map = g_instance_map.Get(); 157 InstanceMap& map = g_instance_map.Get();
157 auto iter = map.find(instance); 158 auto iter = map.find(instance);
158 if (iter == map.end()) 159 if (iter == map.end())
159 return NULL; 160 return NULL;
160 return iter->second.get(); 161 return iter->second.get();
161 } 162 }
162 163
163 NexeLoadManager* GetNexeLoadManager(PP_Instance instance) { 164 NexeLoadManager* GetNexeLoadManager(PP_Instance instance) {
(...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after
1743 // Mark the request as requesting a PNaCl bitcode file, 1744 // Mark the request as requesting a PNaCl bitcode file,
1744 // so that component updater can detect this user action. 1745 // so that component updater can detect this user action.
1745 url_request.addHTTPHeaderField( 1746 url_request.addHTTPHeaderField(
1746 blink::WebString::fromUTF8("Accept"), 1747 blink::WebString::fromUTF8("Accept"),
1747 blink::WebString::fromUTF8("application/x-pnacl, */*")); 1748 blink::WebString::fromUTF8("application/x-pnacl, */*"));
1748 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject); 1749 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject);
1749 downloader->Load(url_request); 1750 downloader->Load(url_request);
1750 } 1751 }
1751 1752
1752 } // namespace nacl 1753 } // namespace nacl
OLDNEW
« no previous file with comments | « components/mime_util/mime_util.cc ('k') | components/os_crypt/key_storage_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698