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

Side by Side Diff: components/nacl/renderer/plugin/pnacl_resources.h

Issue 1005173006: Add a switch for using PNaCl Subzero and use it for -O0 translation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: separate subzero / llc cache keys Created 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_RESOURCES_H_ 5 #ifndef COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_RESOURCES_H_
6 #define COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_RESOURCES_H_ 6 #define COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_RESOURCES_H_
7 7
8 #include <map>
9 #include <vector>
10
11 #include "components/nacl/renderer/plugin/plugin_error.h"
12 #include "components/nacl/renderer/ppb_nacl_private.h" 8 #include "components/nacl/renderer/ppb_nacl_private.h"
13 #include "native_client/src/include/nacl_macros.h" 9 #include "native_client/src/include/nacl_macros.h"
14 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" 10 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
15 #include "ppapi/cpp/completion_callback.h" 11 #include "ppapi/cpp/completion_callback.h"
16 12
17 namespace plugin { 13 namespace plugin {
18 14
19 class Plugin; 15 class Plugin;
20 16
17 // PNaCl tool files / resources, which are opened by the browser.
18 struct PnaclResourceEntries {
19 // The name of the tool that corresponds to the opened file.
20 std::string tool_name;
21
22 // File info for the executables, after they've been opened.
23 // Only valid after StartLoad() has been called, and until
24 // TakeFileInfo(ResourceType) is called.
25 PP_NaClFileInfo file_info;
26 };
27
21 // Loads a list of resources, providing a way to get file descriptors for 28 // Loads a list of resources, providing a way to get file descriptors for
22 // these resources. URLs for resources are resolved by the manifest 29 // these resources. URLs for resources are resolved by the manifest
23 // and point to pnacl component filesystem resources. 30 // and point to PNaCl component filesystem resources.
24 class PnaclResources { 31 class PnaclResources {
25 public: 32 public:
26 explicit PnaclResources(Plugin* plugin); 33 PnaclResources(Plugin* plugin, bool use_subzero);
27 virtual ~PnaclResources(); 34 virtual ~PnaclResources();
28 35
29 // Read the resource info JSON file. This is the first step after 36 // Read the resource info JSON file. This is the first step after
30 // construction; it has to be completed before StartLoad is called. 37 // construction; it has to be completed before StartLoad is called.
31 bool ReadResourceInfo(); 38 bool ReadResourceInfo();
32 39
33 // Start loading the resources. 40 // Start loading the resources.
34 bool StartLoad(); 41 bool StartLoad();
35 42
36 const std::string& GetLlcUrl() { return llc_tool_name_; } 43 enum ResourceType { kLLC, kLD, kSubzero, kNumTypes };
Derek Schuff 2015/03/30 16:39:47 it looks like chromium style is all-caps for enums
jvoung (off chromium) 2015/03/30 20:26:40 DONE
37 const std::string& GetLdUrl() { return ld_tool_name_; }
38 44
39 PP_NaClFileInfo TakeLlcFileInfo(); 45 const std::string& GetUrl(ResourceType type) const;
40 PP_NaClFileInfo TakeLdFileInfo(); 46
47 PP_NaClFileInfo TakeFileInfo(ResourceType type);
41 48
42 private: 49 private:
43 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclResources); 50 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclResources);
44 51
45 // The plugin requesting the resource loading. 52 // The plugin requesting the resource loading.
46 Plugin* plugin_; 53 Plugin* plugin_;
54 bool use_subzero_;
47 55
48 // Tool names for llc and ld; read from the resource info file. 56 PnaclResourceEntries resources_[kNumTypes + 1];
Derek Schuff 2015/03/30 16:39:47 you could make this a std::vector, which would sim
jvoung (off chromium) 2015/03/30 20:26:40 I think plain arrays also support range-for, but c
49 std::string llc_tool_name_;
50 std::string ld_tool_name_;
51 57
52 // File info for llc and ld executables, after they've been opened.
53 // Only valid after the callback for StartLoad() has been called, and until
54 // TakeLlcFileInfo()/TakeLdFileInfo() is called.
55 PP_NaClFileInfo llc_file_info_; 58 PP_NaClFileInfo llc_file_info_;
56 PP_NaClFileInfo ld_file_info_; 59 PP_NaClFileInfo ld_file_info_;
60 PP_NaClFileInfo subzero_file_info_;
57 }; 61 };
58 62
59 } // namespace plugin 63 } // namespace plugin
60 #endif // COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_RESOURCES_H_ 64 #endif // COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_RESOURCES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698