OLD | NEW |
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 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 CHECK(iter != map.end()); | 875 CHECK(iter != map.end()); |
876 // The erase may call NexeLoadManager's destructor prior to removing it from | 876 // The erase may call NexeLoadManager's destructor prior to removing it from |
877 // the map. In that case, it is possible for the trusted Plugin to re-enter | 877 // the map. In that case, it is possible for the trusted Plugin to re-enter |
878 // the NexeLoadManager (e.g., by calling ReportLoadError). Passing out the | 878 // the NexeLoadManager (e.g., by calling ReportLoadError). Passing out the |
879 // NexeLoadManager to a local scoped_ptr just ensures that its entry is gone | 879 // NexeLoadManager to a local scoped_ptr just ensures that its entry is gone |
880 // from the map prior to the destructor being invoked. | 880 // from the map prior to the destructor being invoked. |
881 std::unique_ptr<NaClPluginInstance> temp(map.take(instance)); | 881 std::unique_ptr<NaClPluginInstance> temp(map.take(instance)); |
882 map.erase(iter); | 882 map.erase(iter); |
883 } | 883 } |
884 | 884 |
| 885 // static |
| 886 void PPBNaClPrivate::TerminateNaClLoader(PP_Instance instance) { |
| 887 auto* load_mgr = GetNexeLoadManager(instance); |
| 888 if (load_mgr) |
| 889 load_mgr->CloseTrustedPluginChannel(); |
| 890 } |
| 891 |
885 namespace { | 892 namespace { |
886 | 893 |
887 PP_Bool NaClDebugEnabledForURL(const char* alleged_nmf_url) { | 894 PP_Bool NaClDebugEnabledForURL(const char* alleged_nmf_url) { |
888 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 895 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
889 switches::kEnableNaClDebug)) | 896 switches::kEnableNaClDebug)) |
890 return PP_FALSE; | 897 return PP_FALSE; |
891 IPC::Sender* sender = content::RenderThread::Get(); | 898 IPC::Sender* sender = content::RenderThread::Get(); |
892 DCHECK(sender); | 899 DCHECK(sender); |
893 bool should_debug = false; | 900 bool should_debug = false; |
894 return PP_FromBool( | 901 return PP_FromBool( |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1725 // Mark the request as requesting a PNaCl bitcode file, | 1732 // Mark the request as requesting a PNaCl bitcode file, |
1726 // so that component updater can detect this user action. | 1733 // so that component updater can detect this user action. |
1727 url_request.addHTTPHeaderField( | 1734 url_request.addHTTPHeaderField( |
1728 blink::WebString::fromUTF8("Accept"), | 1735 blink::WebString::fromUTF8("Accept"), |
1729 blink::WebString::fromUTF8("application/x-pnacl, */*")); | 1736 blink::WebString::fromUTF8("application/x-pnacl, */*")); |
1730 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject); | 1737 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject); |
1731 downloader->Load(url_request); | 1738 downloader->Load(url_request); |
1732 } | 1739 } |
1733 | 1740 |
1734 } // namespace nacl | 1741 } // namespace nacl |
OLD | NEW |