OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 2085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2096 enum ProfilerModules { | 2096 enum ProfilerModules { |
2097 PROFILER_MODULE_NONE = 0, | 2097 PROFILER_MODULE_NONE = 0, |
2098 PROFILER_MODULE_CPU = 1, | 2098 PROFILER_MODULE_CPU = 1, |
2099 PROFILER_MODULE_HEAP_STATS = 1 << 1, | 2099 PROFILER_MODULE_HEAP_STATS = 1 << 1, |
2100 PROFILER_MODULE_JS_CONSTRUCTORS = 1 << 2, | 2100 PROFILER_MODULE_JS_CONSTRUCTORS = 1 << 2, |
2101 PROFILER_MODULE_HEAP_SNAPSHOT = 1 << 16 | 2101 PROFILER_MODULE_HEAP_SNAPSHOT = 1 << 16 |
2102 }; | 2102 }; |
2103 | 2103 |
2104 | 2104 |
2105 /** | 2105 /** |
| 2106 * Collection of V8 heap information. |
| 2107 * |
| 2108 * Instances of this class can be passed to v8::V8::HeapStatistics to |
| 2109 * get heap statistics from V8. |
| 2110 */ |
| 2111 class V8EXPORT HeapStatistics { |
| 2112 public: |
| 2113 HeapStatistics(); |
| 2114 size_t total_heap_size() { return total_heap_size_; } |
| 2115 size_t used_heap_size() { return used_heap_size_; } |
| 2116 |
| 2117 private: |
| 2118 void set_total_heap_size(size_t size) { total_heap_size_ = size; } |
| 2119 void set_used_heap_size(size_t size) { used_heap_size_ = size; } |
| 2120 |
| 2121 size_t total_heap_size_; |
| 2122 size_t used_heap_size_; |
| 2123 |
| 2124 friend class V8; |
| 2125 }; |
| 2126 |
| 2127 |
| 2128 /** |
2106 * Container class for static utility functions. | 2129 * Container class for static utility functions. |
2107 */ | 2130 */ |
2108 class V8EXPORT V8 { | 2131 class V8EXPORT V8 { |
2109 public: | 2132 public: |
2110 /** Set the callback to invoke in case of fatal errors. */ | 2133 /** Set the callback to invoke in case of fatal errors. */ |
2111 static void SetFatalErrorHandler(FatalErrorCallback that); | 2134 static void SetFatalErrorHandler(FatalErrorCallback that); |
2112 | 2135 |
2113 /** | 2136 /** |
2114 * Ignore out-of-memory exceptions. | 2137 * Ignore out-of-memory exceptions. |
2115 * | 2138 * |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2345 * Releases any resources used by v8 and stops any utility threads | 2368 * Releases any resources used by v8 and stops any utility threads |
2346 * that may be running. Note that disposing v8 is permanent, it | 2369 * that may be running. Note that disposing v8 is permanent, it |
2347 * cannot be reinitialized. | 2370 * cannot be reinitialized. |
2348 * | 2371 * |
2349 * It should generally not be necessary to dispose v8 before exiting | 2372 * It should generally not be necessary to dispose v8 before exiting |
2350 * a process, this should happen automatically. It is only necessary | 2373 * a process, this should happen automatically. It is only necessary |
2351 * to use if the process needs the resources taken up by v8. | 2374 * to use if the process needs the resources taken up by v8. |
2352 */ | 2375 */ |
2353 static bool Dispose(); | 2376 static bool Dispose(); |
2354 | 2377 |
| 2378 /** |
| 2379 * Get statistics about the heap memory usage. |
| 2380 */ |
| 2381 static void GetHeapStatistics(HeapStatistics* heap_statistics); |
2355 | 2382 |
2356 /** | 2383 /** |
2357 * Optional notification that the embedder is idle. | 2384 * Optional notification that the embedder is idle. |
2358 * V8 uses the notification to reduce memory footprint. | 2385 * V8 uses the notification to reduce memory footprint. |
2359 * This call can be used repeatedly if the embedder remains idle. | 2386 * This call can be used repeatedly if the embedder remains idle. |
2360 * Returns true if the embedder should stop calling IdleNotification | 2387 * Returns true if the embedder should stop calling IdleNotification |
2361 * until real work has been done. This indicates that V8 has done | 2388 * until real work has been done. This indicates that V8 has done |
2362 * as much cleanup as it will be able to do. | 2389 * as much cleanup as it will be able to do. |
2363 */ | 2390 */ |
2364 static bool IdleNotification(); | 2391 static bool IdleNotification(); |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3146 | 3173 |
3147 } // namespace v8 | 3174 } // namespace v8 |
3148 | 3175 |
3149 | 3176 |
3150 #undef V8EXPORT | 3177 #undef V8EXPORT |
3151 #undef V8EXPORT_INLINE | 3178 #undef V8EXPORT_INLINE |
3152 #undef TYPE_CHECK | 3179 #undef TYPE_CHECK |
3153 | 3180 |
3154 | 3181 |
3155 #endif // V8_H_ | 3182 #endif // V8_H_ |
OLD | NEW |