OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_OPTIONS_H_ |
| 6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_OPTIONS_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "native_client/src/include/nacl_string.h" |
| 11 #include "native_client/src/include/portability.h" |
| 12 |
| 13 namespace plugin { |
| 14 |
| 15 // Options for PNaCl translation. |
| 16 class PnaclOptions { |
| 17 |
| 18 public: |
| 19 PnaclOptions(); |
| 20 ~PnaclOptions(); |
| 21 |
| 22 // Return true if we know the hash of the bitcode, for caching. |
| 23 bool HasCacheKey() { return bitcode_hash_ != ""; } |
| 24 |
| 25 // Return the cache key (which takes into account the bitcode hash, |
| 26 // as well as the commandline options). |
| 27 nacl::string GetCacheKey(); |
| 28 |
| 29 // Return true if the manifest did not specify any special options |
| 30 // (just using the default). |
| 31 bool HasDefaultOpts() { |
| 32 return opt_level_ == -1 && experimental_flags_ == ""; |
| 33 } |
| 34 |
| 35 // Return a character array of \x00 delimited commandline options. |
| 36 std::vector<char> GetOptCommandline(); |
| 37 |
| 38 bool translate() { return translate_; } |
| 39 void set_translate(bool t) { translate_ = t; } |
| 40 |
| 41 uint8_t opt_level() { return opt_level_; } |
| 42 void set_opt_level(int8_t l); |
| 43 |
| 44 nacl::string experimental_flags() { |
| 45 return experimental_flags_; |
| 46 } |
| 47 void set_experimental_flags(const nacl::string& f) { |
| 48 experimental_flags_ = f; |
| 49 } |
| 50 |
| 51 void set_bitcode_hash(const nacl::string& c) { |
| 52 bitcode_hash_ = c; |
| 53 } |
| 54 |
| 55 private: |
| 56 // NOTE: There are users of this class that use the copy constructor. |
| 57 // Currently the default copy constructor is good enough, but |
| 58 // double-check that it is the case when more fields are added. |
| 59 bool translate_; |
| 60 int8_t opt_level_; |
| 61 nacl::string experimental_flags_; |
| 62 nacl::string bitcode_hash_; |
| 63 }; |
| 64 |
| 65 } // namespace plugin; |
| 66 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_OPTIONS_H_ |
OLD | NEW |