| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 #ifndef BIN_RESOURCES_H_ |
| 6 #define BIN_RESOURCES_H_ |
| 7 |
| 8 #include <stddef.h> |
| 9 #include <string.h> |
| 10 |
| 11 class Resources { |
| 12 public: |
| 13 static const int kNoSuchInstance = -1; |
| 14 |
| 15 static int ResourceLookup(const char* path, const char** resource) { |
| 16 for (unsigned i = 0; i < get_resource_count(); i++) { |
| 17 resource_map_entry* entry = get_resource(i); |
| 18 if (!strcmp(path, entry->path_)) { |
| 19 *resource = entry->resource_; |
| 20 return entry->length_; |
| 21 } |
| 22 } |
| 23 return kNoSuchInstance; |
| 24 } |
| 25 |
| 26 private: |
| 27 static const char bargraph_dart_[]; |
| 28 static const char chart_dart_[]; |
| 29 static const char favicon_ico_[]; |
| 30 static const char isolate_list_dart_[]; |
| 31 static const char models_dart_[]; |
| 32 static const char packages_browser_dart_js_[]; |
| 33 static const char server_access_dart_[]; |
| 34 static const char vmstats_css_[]; |
| 35 static const char vmstats_dart_[]; |
| 36 static const char vmstats_html_[]; |
| 37 |
| 38 typedef struct { |
| 39 const char* path_; |
| 40 const char* resource_; |
| 41 size_t length_; |
| 42 } resource_map_entry; |
| 43 |
| 44 // These fields are generated by resources_gen.cc. |
| 45 static resource_map_entry builtin_resources_[]; |
| 46 static const size_t builtin_resources_count_; |
| 47 |
| 48 static resource_map_entry* get_resource(int i) { |
| 49 return builtin_resources_ + i; |
| 50 } |
| 51 |
| 52 static size_t get_resource_count() { return builtin_resources_count_; } |
| 53 }; |
| 54 |
| 55 #endif // BIN_RESOURCES_H_ |
| OLD | NEW |