OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_OPTIONS_H_ | 5 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_OPTIONS_H_ |
6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_OPTIONS_H_ | 6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_OPTIONS_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "native_client/src/include/nacl_string.h" | 10 #include "native_client/src/include/nacl_string.h" |
11 #include "native_client/src/include/portability.h" | 11 #include "native_client/src/include/portability.h" |
12 | 12 |
13 namespace plugin { | 13 namespace plugin { |
14 | 14 |
15 // Options for PNaCl translation. | 15 // Options for PNaCl translation. |
16 class PnaclOptions { | 16 class PnaclOptions { |
17 | 17 |
18 public: | 18 public: |
19 PnaclOptions(); | 19 PnaclOptions(); |
20 ~PnaclOptions(); | 20 ~PnaclOptions(); |
21 | 21 |
22 // Return true if we know the hash of the bitcode, for caching. | 22 // Return true if we know the hash of the bitcode, for caching. |
23 bool HasCacheKey() { return bitcode_hash_ != ""; } | 23 bool HasCacheKey() { return bitcode_hash_ != ""; } |
24 | 24 |
25 // Return the cache key (which takes into account the bitcode hash, | 25 // Return the cache key (which takes into account the bitcode hash, |
26 // as well as the commandline options). | 26 // as well as the commandline options). |
27 nacl::string GetCacheKey(); | 27 nacl::string GetCacheKey(); |
28 | 28 |
| 29 // Return just the bitcode hash. |
| 30 nacl::string GetBitcodeHash() { return bitcode_hash_; } |
| 31 |
29 // Return true if the manifest did not specify any special options | 32 // Return true if the manifest did not specify any special options |
30 // (just using the default). | 33 // (just using the default). |
31 bool HasDefaultOpts() { | 34 bool HasDefaultOpts() { |
32 return opt_level_ == -1 && experimental_flags_ == ""; | 35 return opt_level_ == -1 && experimental_flags_ == ""; |
33 } | 36 } |
34 | 37 |
35 // Return a character array of \x00 delimited commandline options. | 38 // Return a character array of \x00 delimited commandline options. |
36 std::vector<char> GetOptCommandline(); | 39 std::vector<char> GetOptCommandline(); |
37 | 40 |
38 bool translate() { return translate_; } | 41 bool translate() { return translate_; } |
(...skipping 18 matching lines...) Expand all Loading... |
57 // Currently the default copy constructor is good enough, but | 60 // Currently the default copy constructor is good enough, but |
58 // double-check that it is the case when more fields are added. | 61 // double-check that it is the case when more fields are added. |
59 bool translate_; | 62 bool translate_; |
60 int8_t opt_level_; | 63 int8_t opt_level_; |
61 nacl::string experimental_flags_; | 64 nacl::string experimental_flags_; |
62 nacl::string bitcode_hash_; | 65 nacl::string bitcode_hash_; |
63 }; | 66 }; |
64 | 67 |
65 } // namespace plugin; | 68 } // namespace plugin; |
66 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_OPTIONS_H_ | 69 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_OPTIONS_H_ |
OLD | NEW |