Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: runtime/bin/resources.h

Issue 19231005: Initial NOOP VM Service (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef BIN_RESOURCES_H_ 5 #ifndef BIN_RESOURCES_H_
6 #define BIN_RESOURCES_H_ 6 #define BIN_RESOURCES_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <string.h> 9 #include <string.h>
10 10
(...skipping 12 matching lines...) Expand all
23 resource_map_entry* entry = get_resource(i); 23 resource_map_entry* entry = get_resource(i);
24 if (strcmp(path, entry->path_) == 0) { 24 if (strcmp(path, entry->path_) == 0) {
25 *resource = entry->resource_; 25 *resource = entry->resource_;
26 ASSERT(entry->length_ > 0); 26 ASSERT(entry->length_ > 0);
27 return entry->length_; 27 return entry->length_;
28 } 28 }
29 } 29 }
30 return kNoSuchInstance; 30 return kNoSuchInstance;
31 } 31 }
32 32
33 static intptr_t get_resource_count() {
34 return builtin_resources_count_;
35 }
36
37 static const char* get_resource_path(intptr_t i) {
38 return get_resource(i)->path_;
39 }
40
33 private: 41 private:
34 struct resource_map_entry { 42 struct resource_map_entry {
35 const char* path_; 43 const char* path_;
36 const char* resource_; 44 const char* resource_;
37 intptr_t length_; 45 intptr_t length_;
38 }; 46 };
39 47
40 // These fields are generated by resources_gen.cc. 48 // These fields are generated by resources_gen.cc.
41 static resource_map_entry builtin_resources_[]; 49 static resource_map_entry builtin_resources_[];
42 static const intptr_t builtin_resources_count_; 50 static const intptr_t builtin_resources_count_;
43 51
44 static resource_map_entry* get_resource(int i) { 52 static resource_map_entry* get_resource(int i) {
45 ASSERT(i >= 0 && i < builtin_resources_count_); 53 ASSERT(i >= 0 && i < builtin_resources_count_);
46 return &builtin_resources_[i]; 54 return &builtin_resources_[i];
47 } 55 }
48 56
49 static intptr_t get_resource_count() {
50 return builtin_resources_count_; }
51
52 DISALLOW_ALLOCATION(); 57 DISALLOW_ALLOCATION();
53 DISALLOW_IMPLICIT_CONSTRUCTORS(Resources); 58 DISALLOW_IMPLICIT_CONSTRUCTORS(Resources);
54 }; 59 };
55 60
56 } // namespace bin 61 } // namespace bin
57 } // namespace dart 62 } // namespace dart
58 63
59 #endif // BIN_RESOURCES_H_ 64 #endif // BIN_RESOURCES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698