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

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

Issue 1646903002: Revert of NaCl cleanup: Remove now-unneeded initialisation of NaCl libraries (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 4 years, 10 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/ppb_nacl_private.h ('k') | no next file » | 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_impl.h" 5 #include "components/nacl/renderer/ppb_nacl_private_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <numeric> 9 #include <numeric>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/bind_helpers.h" 15 #include "base/bind_helpers.h"
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #include "base/containers/scoped_ptr_hash_map.h" 17 #include "base/containers/scoped_ptr_hash_map.h"
18 #include "base/cpu.h" 18 #include "base/cpu.h"
19 #include "base/files/file.h" 19 #include "base/files/file.h"
20 #include "base/json/json_reader.h" 20 #include "base/json/json_reader.h"
21 #include "base/lazy_instance.h" 21 #include "base/lazy_instance.h"
22 #include "base/location.h" 22 #include "base/location.h"
23 #include "base/logging.h" 23 #include "base/logging.h"
24 #include "base/macros.h" 24 #include "base/macros.h"
25 #include "base/rand_util.h"
25 #include "base/single_thread_task_runner.h" 26 #include "base/single_thread_task_runner.h"
26 #include "base/strings/string_split.h" 27 #include "base/strings/string_split.h"
27 #include "base/strings/string_util.h" 28 #include "base/strings/string_util.h"
28 #include "base/thread_task_runner_handle.h" 29 #include "base/thread_task_runner_handle.h"
29 #include "build/build_config.h" 30 #include "build/build_config.h"
30 #include "components/nacl/common/nacl_host_messages.h" 31 #include "components/nacl/common/nacl_host_messages.h"
31 #include "components/nacl/common/nacl_messages.h" 32 #include "components/nacl/common/nacl_messages.h"
32 #include "components/nacl/common/nacl_nonsfi_util.h" 33 #include "components/nacl/common/nacl_nonsfi_util.h"
33 #include "components/nacl/common/nacl_switches.h" 34 #include "components/nacl/common/nacl_switches.h"
34 #include "components/nacl/common/nacl_types.h" 35 #include "components/nacl/common/nacl_types.h"
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 } else if (result == PP_EXTERNAL_PLUGIN_ERROR_MODULE) { 613 } else if (result == PP_EXTERNAL_PLUGIN_ERROR_MODULE) {
613 load_manager->ReportLoadError(PP_NACL_ERROR_START_PROXY_MODULE, 614 load_manager->ReportLoadError(PP_NACL_ERROR_START_PROXY_MODULE,
614 "could not initialize module."); 615 "could not initialize module.");
615 } else if (result == PP_EXTERNAL_PLUGIN_ERROR_INSTANCE) { 616 } else if (result == PP_EXTERNAL_PLUGIN_ERROR_INSTANCE) {
616 load_manager->ReportLoadError(PP_NACL_ERROR_START_PROXY_MODULE, 617 load_manager->ReportLoadError(PP_NACL_ERROR_START_PROXY_MODULE,
617 "could not create instance."); 618 "could not create instance.");
618 } 619 }
619 return PP_FALSE; 620 return PP_FALSE;
620 } 621 }
621 622
623 int UrandomFD(void) {
624 #if defined(OS_POSIX)
625 return base::GetUrandomFD();
626 #else
627 return -1;
628 #endif
629 }
630
622 // Convert a URL to a filename for GetReadonlyPnaclFd. 631 // Convert a URL to a filename for GetReadonlyPnaclFd.
623 // Must be kept in sync with PnaclCanOpenFile() in 632 // Must be kept in sync with PnaclCanOpenFile() in
624 // components/nacl/browser/nacl_file_host.cc. 633 // components/nacl/browser/nacl_file_host.cc.
625 std::string PnaclComponentURLToFilename(const std::string& url) { 634 std::string PnaclComponentURLToFilename(const std::string& url) {
626 // PNaCl component URLs aren't arbitrary URLs; they are always either 635 // PNaCl component URLs aren't arbitrary URLs; they are always either
627 // generated from ManifestResolveKey or PnaclResources::ReadResourceInfo. 636 // generated from ManifestResolveKey or PnaclResources::ReadResourceInfo.
628 // So, it's safe to just use string parsing operations here instead of 637 // So, it's safe to just use string parsing operations here instead of
629 // URL-parsing ones. 638 // URL-parsing ones.
630 DCHECK(base::StartsWith(url, kPNaClTranslatorBaseUrl, 639 DCHECK(base::StartsWith(url, kPNaClTranslatorBaseUrl,
631 base::CompareCase::SENSITIVE)); 640 base::CompareCase::SENSITIVE));
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 // so that component updater can detect this user action. 1693 // so that component updater can detect this user action.
1685 url_request.addHTTPHeaderField( 1694 url_request.addHTTPHeaderField(
1686 blink::WebString::fromUTF8("Accept"), 1695 blink::WebString::fromUTF8("Accept"),
1687 blink::WebString::fromUTF8("application/x-pnacl, */*")); 1696 blink::WebString::fromUTF8("application/x-pnacl, */*"));
1688 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject); 1697 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject);
1689 downloader->Load(url_request); 1698 downloader->Load(url_request);
1690 } 1699 }
1691 1700
1692 const PPB_NaCl_Private nacl_interface = { 1701 const PPB_NaCl_Private nacl_interface = {
1693 &LaunchSelLdr, 1702 &LaunchSelLdr,
1703 &UrandomFD,
1694 &GetReadExecPnaclFd, 1704 &GetReadExecPnaclFd,
1695 &CreateTemporaryFile, 1705 &CreateTemporaryFile,
1696 &GetNumberOfProcessors, 1706 &GetNumberOfProcessors,
1697 &ReportTranslationFinished, 1707 &ReportTranslationFinished,
1698 &DispatchEvent, 1708 &DispatchEvent,
1699 &ReportLoadError, 1709 &ReportLoadError,
1700 &InstanceCreated, 1710 &InstanceCreated,
1701 &InstanceDestroyed, 1711 &InstanceDestroyed,
1702 &GetSandboxArch, 1712 &GetSandboxArch,
1703 &InitializePlugin, 1713 &InitializePlugin,
(...skipping 10 matching lines...) Expand all
1714 &StreamPexe 1724 &StreamPexe
1715 }; 1725 };
1716 1726
1717 } // namespace 1727 } // namespace
1718 1728
1719 const PPB_NaCl_Private* GetNaClPrivateInterface() { 1729 const PPB_NaCl_Private* GetNaClPrivateInterface() {
1720 return &nacl_interface; 1730 return &nacl_interface;
1721 } 1731 }
1722 1732
1723 } // namespace nacl 1733 } // namespace nacl
OLDNEW
« no previous file with comments | « components/nacl/renderer/ppb_nacl_private.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698