| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 CleanUp(loaded_); | 92 CleanUp(loaded_); |
| 93 } | 93 } |
| 94 | 94 |
| 95 bool %(class_name)s::Load(const std::string& library_name) { | 95 bool %(class_name)s::Load(const std::string& library_name) { |
| 96 if (loaded_) { | 96 if (loaded_) { |
| 97 NOTREACHED(); | 97 NOTREACHED(); |
| 98 return false; | 98 return false; |
| 99 } | 99 } |
| 100 | 100 |
| 101 #if defined(%(unique_prefix)s_DLOPEN) | 101 #if defined(%(unique_prefix)s_DLOPEN) |
| 102 library_ = base::LoadNativeLibrary(FilePath(library_name), NULL); | 102 library_ = base::LoadNativeLibrary(base::FilePath(library_name), NULL); |
| 103 if (!library_) | 103 if (!library_) |
| 104 return false; | 104 return false; |
| 105 #endif | 105 #endif |
| 106 | 106 |
| 107 %(member_init)s | 107 %(member_init)s |
| 108 | 108 |
| 109 loaded_ = true; | 109 loaded_ = true; |
| 110 return true; | 110 return true; |
| 111 } | 111 } |
| 112 | 112 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 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') |
| 248 try: | 248 try: |
| 249 impl_file.write(impl_contents) | 249 impl_file.write(impl_contents) |
| 250 finally: | 250 finally: |
| 251 impl_file.close() | 251 impl_file.close() |
| 252 | 252 |
| 253 return 0 | 253 return 0 |
| 254 | 254 |
| 255 if __name__ == '__main__': | 255 if __name__ == '__main__': |
| 256 sys.exit(main()) | 256 sys.exit(main()) |
| OLD | NEW |