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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 static SnapshotObjectId GetSnapshotObjectId(Handle<Value> value); | 400 static SnapshotObjectId GetSnapshotObjectId(Handle<Value> value); |
401 | 401 |
402 /** | 402 /** |
403 * A constant for invalid SnapshotObjectId. GetSnapshotObjectId will return | 403 * A constant for invalid SnapshotObjectId. GetSnapshotObjectId will return |
404 * it in case heap profiler cannot find id for the object passed as | 404 * it in case heap profiler cannot find id for the object passed as |
405 * parameter. HeapSnapshot::GetNodeById will always return NULL for such id. | 405 * parameter. HeapSnapshot::GetNodeById will always return NULL for such id. |
406 */ | 406 */ |
407 static const SnapshotObjectId kUnknownObjectId = 0; | 407 static const SnapshotObjectId kUnknownObjectId = 0; |
408 | 408 |
409 /** | 409 /** |
| 410 * Callback interface for retrieving user friendly names of global objects. |
| 411 */ |
| 412 class ObjectNameResolver { |
| 413 public: |
| 414 /** |
| 415 * Returns name to be used in the heap snapshot for given node. Returned |
| 416 * string must stay alive until snapshot collection is completed. |
| 417 */ |
| 418 virtual const char* GetName(Handle<Object> object) = 0; |
| 419 protected: |
| 420 virtual ~ObjectNameResolver() {} |
| 421 }; |
| 422 |
| 423 /** |
410 * Takes a heap snapshot and returns it. Title may be an empty string. | 424 * Takes a heap snapshot and returns it. Title may be an empty string. |
411 * See HeapSnapshot::Type for types description. | 425 * See HeapSnapshot::Type for types description. |
412 */ | 426 */ |
413 static const HeapSnapshot* TakeSnapshot( | 427 static const HeapSnapshot* TakeSnapshot( |
414 Handle<String> title, | 428 Handle<String> title, |
415 HeapSnapshot::Type type = HeapSnapshot::kFull, | 429 HeapSnapshot::Type type = HeapSnapshot::kFull, |
416 ActivityControl* control = NULL); | 430 ActivityControl* control = NULL, |
| 431 ObjectNameResolver* global_object_name_resolver = NULL); |
417 | 432 |
418 /** | 433 /** |
419 * Starts tracking of heap objects population statistics. After calling | 434 * Starts tracking of heap objects population statistics. After calling |
420 * this method, all heap objects relocations done by the garbage collector | 435 * this method, all heap objects relocations done by the garbage collector |
421 * are being registered. | 436 * are being registered. |
422 */ | 437 */ |
423 static void StartHeapObjectsTracking(); | 438 static void StartHeapObjectsTracking(); |
424 | 439 |
425 /** | 440 /** |
426 * Adds a new time interval entry to the aggregated statistics array. The | 441 * Adds a new time interval entry to the aggregated statistics array. The |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 }; | 571 }; |
557 | 572 |
558 | 573 |
559 } // namespace v8 | 574 } // namespace v8 |
560 | 575 |
561 | 576 |
562 #undef V8EXPORT | 577 #undef V8EXPORT |
563 | 578 |
564 | 579 |
565 #endif // V8_V8_PROFILER_H_ | 580 #endif // V8_V8_PROFILER_H_ |
OLD | NEW |