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