OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """ | 6 """ |
7 Creates a library loader (a header and implementation file), | 7 Creates a library loader (a header and implementation file), |
8 which is a wrapper for dlopen or direct linking with given library. | 8 which is a wrapper for dlopen or direct linking with given library. |
9 | 9 |
10 The loader makes it possible to have the same client code for both cases, | 10 The loader makes it possible to have the same client code for both cases, |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "base/native_library.h" | 37 #include "base/native_library.h" |
38 #endif | 38 #endif |
39 | 39 |
40 class %(class_name)s { | 40 class %(class_name)s { |
41 public: | 41 public: |
42 %(class_name)s(); | 42 %(class_name)s(); |
43 ~%(class_name)s(); | 43 ~%(class_name)s(); |
44 | 44 |
45 bool Load(const std::string& library_name) WARN_UNUSED_RESULT; | 45 bool Load(const std::string& library_name) WARN_UNUSED_RESULT; |
46 | 46 |
| 47 bool loaded() const { return loaded_; } |
| 48 |
47 %(member_decls)s | 49 %(member_decls)s |
48 | 50 |
49 private: | 51 private: |
50 void CleanUp(bool unload); | 52 void CleanUp(bool unload); |
51 | 53 |
52 #if defined(%(unique_prefix)s_DLOPEN) | 54 #if defined(%(unique_prefix)s_DLOPEN) |
53 base::NativeLibrary library_; | 55 base::NativeLibrary library_; |
54 #endif | 56 #endif |
55 | 57 |
56 bool loaded_; | 58 bool loaded_; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 impl_file = open(os.path.join(source_tree_root, options.output_cc), 'w') | 247 impl_file = open(os.path.join(source_tree_root, options.output_cc), 'w') |
246 try: | 248 try: |
247 impl_file.write(impl_contents) | 249 impl_file.write(impl_contents) |
248 finally: | 250 finally: |
249 impl_file.close() | 251 impl_file.close() |
250 | 252 |
251 return 0 | 253 return 0 |
252 | 254 |
253 if __name__ == '__main__': | 255 if __name__ == '__main__': |
254 sys.exit(main()) | 256 sys.exit(main()) |
OLD | NEW |