308 // Diagnostic commands are not directly instantiated but created with a factory. |
308 // Diagnostic commands are not directly instantiated but created with a factory. |
309 // Each diagnostic command class has its own factory. The DCmdFactory class also |
309 // Each diagnostic command class has its own factory. The DCmdFactory class also |
310 // manages the status of the diagnostic command (hidden, enabled). A DCmdFactory |
310 // manages the status of the diagnostic command (hidden, enabled). A DCmdFactory |
311 // has to be registered to make the diagnostic command available (see |
311 // has to be registered to make the diagnostic command available (see |
312 // management.cpp) |
312 // management.cpp) |
313 class DCmdFactory: public CHeapObj { |
313 class DCmdFactory: public CHeapObj<mtInternal> { |
314 private: |
314 private: |
315 static Mutex* _dcmdFactory_lock; |
315 static Mutex* _dcmdFactory_lock; |
316 // Pointer to the next factory in the singly-linked list of registered |
316 // Pointer to the next factory in the singly-linked list of registered |
317 // diagnostic commands |
317 // diagnostic commands |
318 DCmdFactory* _next; |
318 DCmdFactory* _next; |
366 public: |
366 public: |
367 DCmdFactoryImpl(bool enabled, bool hidden) : |
367 DCmdFactoryImpl(bool enabled, bool hidden) : |
368 DCmdFactory(DCmdClass::num_arguments(), enabled, hidden) { } |
368 DCmdFactory(DCmdClass::num_arguments(), enabled, hidden) { } |
369 // Returns a C-heap allocated instance |
369 // Returns a C-heap allocated instance |
370 virtual DCmd* create_Cheap_instance(outputStream* output) { |
370 virtual DCmd* create_Cheap_instance(outputStream* output) { |
371 return new (ResourceObj::C_HEAP) DCmdClass(output, true); |
371 return new (ResourceObj::C_HEAP, mtInternal) DCmdClass(output, true); |
372 } |
372 } |
373 // Returns a resourceArea allocated instance |
373 // Returns a resourceArea allocated instance |
374 virtual DCmd* create_resource_instance(outputStream* output) { |
374 virtual DCmd* create_resource_instance(outputStream* output) { |
375 return new DCmdClass(output, false); |
375 return new DCmdClass(output, false); |
376 } |
376 } |