OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 12 matching lines...) Expand all Loading... | |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_API_H_ | 28 #ifndef V8_API_H_ |
29 #define V8_API_H_ | 29 #define V8_API_H_ |
30 | 30 |
31 #include "apiutils.h" | 31 #include "apiutils.h" |
32 #include "factory.h" | 32 #include "factory.h" |
33 #include "hashmap.h" | |
33 | 34 |
34 #include "../include/v8-testing.h" | 35 #include "../include/v8-testing.h" |
35 | 36 |
36 namespace v8 { | 37 namespace v8 { |
37 | 38 |
38 // Constants used in the implementation of the API. The most natural thing | 39 // Constants used in the implementation of the API. The most natural thing |
39 // would usually be to place these with the classes that use them, but | 40 // would usually be to place these with the classes that use them, but |
40 // we want to keep them out of v8.h because it is an externally | 41 // we want to keep them out of v8.h because it is an externally |
41 // visible file. | 42 // visible file. |
42 class Consts { | 43 class Consts { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 | 131 |
131 class ApiFunction { | 132 class ApiFunction { |
132 public: | 133 public: |
133 explicit ApiFunction(v8::internal::Address addr) : addr_(addr) { } | 134 explicit ApiFunction(v8::internal::Address addr) : addr_(addr) { } |
134 v8::internal::Address address() { return addr_; } | 135 v8::internal::Address address() { return addr_; } |
135 private: | 136 private: |
136 v8::internal::Address addr_; | 137 v8::internal::Address addr_; |
137 }; | 138 }; |
138 | 139 |
139 | 140 |
140 enum ExtensionTraversalState { | |
141 UNVISITED, VISITED, INSTALLED | |
142 }; | |
143 | |
144 | 141 |
145 class RegisteredExtension { | 142 class RegisteredExtension { |
146 public: | 143 public: |
147 explicit RegisteredExtension(Extension* extension); | 144 explicit RegisteredExtension(Extension* extension); |
148 static void Register(RegisteredExtension* that); | 145 static void Register(RegisteredExtension* that); |
149 Extension* extension() { return extension_; } | 146 Extension* extension() { return extension_; } |
150 RegisteredExtension* next() { return next_; } | 147 RegisteredExtension* next() { return next_; } |
151 RegisteredExtension* next_auto() { return next_auto_; } | 148 RegisteredExtension* next_auto() { return next_auto_; } |
152 ExtensionTraversalState state() { return state_; } | |
153 void set_state(ExtensionTraversalState value) { state_ = value; } | |
154 static RegisteredExtension* first_extension() { return first_extension_; } | 149 static RegisteredExtension* first_extension() { return first_extension_; } |
155 private: | 150 private: |
156 Extension* extension_; | 151 Extension* extension_; |
157 RegisteredExtension* next_; | 152 RegisteredExtension* next_; |
158 RegisteredExtension* next_auto_; | 153 RegisteredExtension* next_auto_; |
159 ExtensionTraversalState state_; | |
160 static RegisteredExtension* first_extension_; | 154 static RegisteredExtension* first_extension_; |
161 }; | 155 }; |
162 | 156 |
163 | 157 |
158 namespace internal { | |
159 enum ExtensionTraversalState { | |
160 UNVISITED, VISITED, INSTALLED | |
161 }; | |
162 | |
163 | |
164 class ExtensionStates : private HashMap { | |
Vitaly Repeshko
2011/11/15 18:14:17
Use delegation instead of implementation inheritan
| |
165 public: | |
166 ExtensionStates(); | |
167 ExtensionTraversalState get_state(RegisteredExtension* extension); | |
168 void set_state(RegisteredExtension* extension, ExtensionTraversalState state); | |
169 }; | |
170 } | |
Vitaly Repeshko
2011/11/15 18:14:17
nit: // namespace internal
| |
171 | |
172 | |
164 class Utils { | 173 class Utils { |
165 public: | 174 public: |
166 static bool ReportApiFailure(const char* location, const char* message); | 175 static bool ReportApiFailure(const char* location, const char* message); |
167 | 176 |
168 static Local<FunctionTemplate> ToFunctionTemplate(NeanderObject obj); | 177 static Local<FunctionTemplate> ToFunctionTemplate(NeanderObject obj); |
169 static Local<ObjectTemplate> ToObjectTemplate(NeanderObject obj); | 178 static Local<ObjectTemplate> ToObjectTemplate(NeanderObject obj); |
170 | 179 |
171 static inline Local<Context> ToLocal( | 180 static inline Local<Context> ToLocal( |
172 v8::internal::Handle<v8::internal::Context> obj); | 181 v8::internal::Handle<v8::internal::Context> obj); |
173 static inline Local<Value> ToLocal( | 182 static inline Local<Value> ToLocal( |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
562 stress_type_ = stress_type; | 571 stress_type_ = stress_type; |
563 } | 572 } |
564 | 573 |
565 private: | 574 private: |
566 static v8::Testing::StressType stress_type_; | 575 static v8::Testing::StressType stress_type_; |
567 }; | 576 }; |
568 | 577 |
569 } } // namespace v8::internal | 578 } } // namespace v8::internal |
570 | 579 |
571 #endif // V8_API_H_ | 580 #endif // V8_API_H_ |
OLD | NEW |