Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / v8 / src / natives.h
1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef V8_NATIVES_H_
6 #define V8_NATIVES_H_
7
8 namespace v8 {
9 namespace internal {
10
11 typedef bool (*NativeSourceCallback)(Vector<const char> name,
12                                      Vector<const char> source,
13                                      int index);
14
15 enum NativeType {
16   CORE, EXPERIMENTAL, D8, TEST
17 };
18
19 template <NativeType type>
20 class NativesCollection {
21  public:
22   // Number of built-in scripts.
23   static int GetBuiltinsCount();
24   // Number of debugger implementation scripts.
25   static int GetDebuggerCount();
26
27   // These are used to access built-in scripts.  The debugger implementation
28   // scripts have an index in the interval [0, GetDebuggerCount()).  The
29   // non-debugger scripts have an index in the interval [GetDebuggerCount(),
30   // GetNativesCount()).
31   static int GetIndex(const char* name);
32   static int GetRawScriptsSize();
33   static Vector<const char> GetRawScriptSource(int index);
34   static Vector<const char> GetScriptName(int index);
35   static Vector<const byte> GetScriptsSource();
36   static void SetRawScriptsSource(Vector<const char> raw_source);
37 };
38
39 typedef NativesCollection<CORE> Natives;
40 typedef NativesCollection<EXPERIMENTAL> ExperimentalNatives;
41
42 } }  // namespace v8::internal
43
44 #endif  // V8_NATIVES_H_