Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 const HeapGraphNode* GetToNode() const; | 238 const HeapGraphNode* GetToNode() const; |
| 239 }; | 239 }; |
| 240 | 240 |
| 241 | 241 |
| 242 /** | 242 /** |
| 243 * HeapGraphNode represents a node in a heap graph. | 243 * HeapGraphNode represents a node in a heap graph. |
| 244 */ | 244 */ |
| 245 class V8EXPORT HeapGraphNode { | 245 class V8EXPORT HeapGraphNode { |
| 246 public: | 246 public: |
| 247 enum Type { | 247 enum Type { |
| 248 kHidden = 0, // Hidden node, may be filtered when shown to user. | 248 kHidden = 0, // Hidden node, may be filtered when shown to user. |
| 249 kArray = 1, // An array of elements. | 249 kArray = 1, // An array of elements. |
| 250 kString = 2, // A string. | 250 kString = 2, // A string. |
| 251 kObject = 3, // A JS object (except for arrays and strings). | 251 kObject = 3, // A JS object (except for arrays and strings). |
| 252 kCode = 4, // Compiled code. | 252 kCode = 4, // Compiled code. |
| 253 kClosure = 5, // Function closure. | 253 kClosure = 5, // Function closure. |
| 254 kRegExp = 6, // RegExp. | 254 kRegExp = 6, // RegExp. |
| 255 kHeapNumber = 7 // Number stored in the heap. | 255 kHeapNumber = 7, // Number stored in the heap. |
| 256 kNative = 8 // Native object (not from V8 heap). | |
| 256 }; | 257 }; |
| 257 | 258 |
| 258 /** Returns node type (see HeapGraphNode::Type). */ | 259 /** Returns node type (see HeapGraphNode::Type). */ |
| 259 Type GetType() const; | 260 Type GetType() const; |
| 260 | 261 |
| 261 /** | 262 /** |
| 262 * Returns node name. Depending on node's type this can be the name | 263 * Returns node name. Depending on node's type this can be the name |
| 263 * of the constructor (for objects), the name of the function (for | 264 * of the constructor (for objects), the name of the function (for |
| 264 * closures), string value, or an empty string (for compiled code). | 265 * closures), string value, or an empty string (for compiled code). |
| 265 */ | 266 */ |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 390 */ | 391 */ |
| 391 void Serialize(OutputStream* stream, SerializationFormat format) const; | 392 void Serialize(OutputStream* stream, SerializationFormat format) const; |
| 392 }; | 393 }; |
| 393 | 394 |
| 394 | 395 |
| 395 /** | 396 /** |
| 396 * Interface for controlling heap profiling. | 397 * Interface for controlling heap profiling. |
| 397 */ | 398 */ |
| 398 class V8EXPORT HeapProfiler { | 399 class V8EXPORT HeapProfiler { |
| 399 public: | 400 public: |
| 401 /** | |
| 402 * Callback function invoked for obtaining RetainedObjectInfo for | |
| 403 * the given JavaScript wrapper object. | |
|
Vitaly Repeshko
2011/03/09 14:15:49
We should document that its prohibited to enter V8
mnaganov (inactive)
2011/03/09 15:26:32
Done.
| |
| 404 */ | |
| 405 typedef RetainedObjectInfo* (*WrapperInfoCallback) | |
| 406 (uint16_t class_id, Handle<Value> wrapper); | |
| 407 | |
| 400 /** Returns the number of snapshots taken. */ | 408 /** Returns the number of snapshots taken. */ |
| 401 static int GetSnapshotsCount(); | 409 static int GetSnapshotsCount(); |
| 402 | 410 |
| 403 /** Returns a snapshot by index. */ | 411 /** Returns a snapshot by index. */ |
| 404 static const HeapSnapshot* GetSnapshot(int index); | 412 static const HeapSnapshot* GetSnapshot(int index); |
| 405 | 413 |
| 406 /** Returns a profile by uid. */ | 414 /** Returns a profile by uid. */ |
| 407 static const HeapSnapshot* FindSnapshot(unsigned uid); | 415 static const HeapSnapshot* FindSnapshot(unsigned uid); |
| 408 | 416 |
| 409 /** | 417 /** |
| 410 * Takes a heap snapshot and returns it. Title may be an empty string. | 418 * Takes a heap snapshot and returns it. Title may be an empty string. |
| 411 * See HeapSnapshot::Type for types description. | 419 * See HeapSnapshot::Type for types description. |
| 412 */ | 420 */ |
| 413 static const HeapSnapshot* TakeSnapshot( | 421 static const HeapSnapshot* TakeSnapshot( |
| 414 Handle<String> title, | 422 Handle<String> title, |
| 415 HeapSnapshot::Type type = HeapSnapshot::kFull, | 423 HeapSnapshot::Type type = HeapSnapshot::kFull, |
| 416 ActivityControl* control = NULL); | 424 ActivityControl* control = NULL); |
| 425 | |
| 426 /** Binds a callback to embedder's class ID. */ | |
|
Vitaly Repeshko
2011/03/09 14:15:49
Move the "no class" constant here and document tha
mnaganov (inactive)
2011/03/09 15:26:32
Done.
| |
| 427 static void DefineWrapperClass( | |
| 428 uint16_t class_id, | |
| 429 WrapperInfoCallback callback); | |
| 417 }; | 430 }; |
| 418 | 431 |
| 419 | 432 |
| 420 } // namespace v8 | 433 } // namespace v8 |
| 421 | 434 |
| 422 | 435 |
| 423 #undef V8EXPORT | 436 #undef V8EXPORT |
| 424 | 437 |
| 425 | 438 |
| 426 #endif // V8_V8_PROFILER_H_ | 439 #endif // V8_V8_PROFILER_H_ |
| OLD | NEW |