OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project 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 V8_VERSION_H_ | 5 #ifndef V8_VERSION_H_ |
6 #define V8_VERSION_H_ | 6 #define V8_VERSION_H_ |
7 | 7 |
8 #include "src/base/functional.h" | 8 #include "src/base/functional.h" |
9 #include "src/vector.h" | 9 #include "src/vector.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 class Version { | 14 class Version { |
15 public: | 15 public: |
16 // Return the various version components. | 16 // Return the various version components. |
17 static int GetMajor() { return major_; } | 17 static int GetMajor() { return major_; } |
18 static int GetMinor() { return minor_; } | 18 static int GetMinor() { return minor_; } |
19 static int GetBuild() { return build_; } | 19 static int GetBuild() { return build_; } |
20 static int GetPatch() { return patch_; } | 20 static int GetPatch() { return patch_; } |
21 static const char* GetEmbedder() { return embedder_; } | |
22 static bool IsCandidate() { return candidate_; } | 21 static bool IsCandidate() { return candidate_; } |
23 static uint32_t Hash() { | 22 static uint32_t Hash() { |
24 return static_cast<uint32_t>( | 23 return static_cast<uint32_t>( |
25 base::hash_combine(major_, minor_, build_, patch_)); | 24 base::hash_combine(major_, minor_, build_, patch_)); |
26 } | 25 } |
27 | 26 |
28 // Calculate the V8 version string. | 27 // Calculate the V8 version string. |
29 static void GetString(Vector<char> str); | 28 static void GetString(Vector<char> str); |
30 | 29 |
31 // Calculate the SONAME for the V8 shared library. | 30 // Calculate the SONAME for the V8 shared library. |
32 static void GetSONAME(Vector<char> str); | 31 static void GetSONAME(Vector<char> str); |
33 | 32 |
34 static const char* GetVersion() { return version_string_; } | 33 static const char* GetVersion() { return version_string_; } |
35 | 34 |
36 private: | 35 private: |
37 // NOTE: can't make these really const because of test-version.cc. | 36 // NOTE: can't make these really const because of test-version.cc. |
38 static int major_; | 37 static int major_; |
39 static int minor_; | 38 static int minor_; |
40 static int build_; | 39 static int build_; |
41 static int patch_; | 40 static int patch_; |
42 static const char* embedder_; | |
43 static bool candidate_; | 41 static bool candidate_; |
44 static const char* soname_; | 42 static const char* soname_; |
45 static const char* version_string_; | 43 static const char* version_string_; |
46 | 44 |
47 // In test-version.cc. | 45 // In test-version.cc. |
48 friend void SetVersion(int major, int minor, int build, int patch, | 46 friend void SetVersion(int major, int minor, int build, int patch, |
49 const char* embedder, bool candidate, | 47 bool candidate, const char* soname); |
50 const char* soname); | |
51 }; | 48 }; |
52 | 49 |
53 } // namespace internal | 50 } // namespace internal |
54 } // namespace v8 | 51 } // namespace v8 |
55 | 52 |
56 #endif // V8_VERSION_H_ | 53 #endif // V8_VERSION_H_ |
OLD | NEW |