| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_INDEX_H__ | 5 #ifndef V8_INDEX_H__ |
| 6 #define V8_INDEX_H__ | 6 #define V8_INDEX_H__ |
| 7 | 7 |
| 8 #include <v8.h> | 8 #include <v8.h> |
| 9 #include "PlatformString.h" // for WebCore::String | 9 #include "PlatformString.h" // for WebCore::String |
| 10 | 10 |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 | 436 |
| 437 class V8ClassIndex { | 437 class V8ClassIndex { |
| 438 public: | 438 public: |
| 439 // Type must start at non-negative numbers. See ToInt, FromInt. | 439 // Type must start at non-negative numbers. See ToInt, FromInt. |
| 440 enum V8WrapperType { | 440 enum V8WrapperType { |
| 441 INVALID_CLASS_INDEX = 0, | 441 INVALID_CLASS_INDEX = 0, |
| 442 #define DEFINE_ENUM(name, type) name, | 442 #define DEFINE_ENUM(name, type) name, |
| 443 ALL_WRAPPER_TYPES(DEFINE_ENUM) | 443 ALL_WRAPPER_TYPES(DEFINE_ENUM) |
| 444 #undef DEFINE_ENUM | 444 #undef DEFINE_ENUM |
| 445 CLASSINDEX_END, | 445 CLASSINDEX_END, |
| 446 WRAPPER_TYPE_COUNT = CLASSINDEX_END |
| 446 }; | 447 }; |
| 447 | 448 |
| 448 static int ToInt(V8WrapperType type) { return static_cast<int>(type); } | 449 static int ToInt(V8WrapperType type) { return static_cast<int>(type); } |
| 449 | 450 |
| 450 static V8WrapperType FromInt(int v) { | 451 static V8WrapperType FromInt(int v) { |
| 451 ASSERT(INVALID_CLASS_INDEX <= v && v < CLASSINDEX_END); | 452 ASSERT(INVALID_CLASS_INDEX <= v && v < CLASSINDEX_END); |
| 452 return static_cast<V8WrapperType>(v); | 453 return static_cast<V8WrapperType>(v); |
| 453 } | 454 } |
| 454 | 455 |
| 455 static FunctionTemplateFactory GetFactory(V8WrapperType type); | 456 static FunctionTemplateFactory GetFactory(V8WrapperType type); |
| 456 // Returns a field to be used as cache for the template for the given type | 457 // Returns a field to be used as cache for the template for the given type |
| 457 static v8::Persistent<v8::FunctionTemplate>* GetCache(V8WrapperType type); | 458 static v8::Persistent<v8::FunctionTemplate>* GetCache(V8WrapperType type); |
| 458 }; | 459 }; |
| 459 | 460 |
| 460 } | 461 } |
| 461 | 462 |
| 462 #endif // V8_INDEX_H__ | 463 #endif // V8_INDEX_H__ |
| 463 | 464 |
| OLD | NEW |