Changeset 124334 in webkit
- Timestamp:
- Aug 1, 2012 7:38:01 AM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r124333 r124334 1 2012-08-01 Ilya Tikhonovsky <loislo@chromium.org> 2 3 Web Inspector: test native memory instrumentation code with help of unittests 4 https://bugs.webkit.org/show_bug.cgi?id=92743 5 6 Reviewed by Yury Semikhatsky. 7 8 Test a part of existing Native Memory Instrumentation code with help of unit tests. 9 6 tests were added and two bugs were fixed. 10 a drive-by improvement: the method MemoryInstrumentation::addInstrumentedObject 11 was marked as private and addRootObject was introduced instead of it. 12 The new function also calls processDeferedPointers. 13 14 * bindings/v8/ScriptProfiler.cpp: 15 (WebCore::ScriptProfiler::collectBindingMemoryInfo): 16 * dom/MemoryInstrumentation.h: 17 (WebCore::MemoryInstrumentation::addRootObject): 18 (MemoryInstrumentation): 19 (WebCore::MemoryInstrumentation::addInstrumentedObject): 20 (WebCore::MemoryInstrumentation::addInstrumentedObjectImpl): 21 (WebCore): 22 (WebCore::MemoryInstrumentation::addObjectImpl): 23 * inspector/InspectorMemoryAgent.cpp: 24 (WebCore): 25 * inspector/MemoryInstrumentationImpl.h: 26 (MemoryInstrumentationImpl): 27 1 28 2012-08-01 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> 2 29 -
trunk/Source/WebCore/bindings/v8/ScriptProfiler.cpp
r124017 r124334 224 224 { 225 225 V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); 226 instrumentation->add InstrumentedObject(data);226 instrumentation->addRootObject(data); 227 227 } 228 228 -
trunk/Source/WebCore/dom/MemoryInstrumentation.h
r124330 r124334 55 55 }; 56 56 57 template <typename T> void addInstrumentedObject(const T& t) 58 { 59 OwningTraits<T>::addInstrumentedObject(this, t); 57 template <typename T> void addRootObject(const T& t) 58 { 59 addInstrumentedObject(t); 60 processDeferredInstrumentedPointers(); 60 61 } 61 62 … … 69 70 }; 70 71 72 private: 71 73 virtual void countObjectSize(ObjectType, size_t) = 0; 72 74 virtual void deferInstrumentedPointer(PassOwnPtr<InstrumentedPointerBase>) = 0; 73 75 virtual bool visited(const void*) = 0; 74 75 private: 76 virtual void processDeferredInstrumentedPointers() = 0; 77 76 78 template <typename T> friend class MemoryClassInfo; 77 79 template <typename T> class InstrumentedPointer : public InstrumentedPointerBase { … … 89 91 } 90 92 void addString(const String&, ObjectType); 93 template <typename T> void addInstrumentedObject(const T& t) { OwningTraits<T>::addInstrumentedObject(this, t); } 91 94 template <typename HashMapType> void addHashMap(const HashMapType&, ObjectType, bool contentOnly = false); 92 95 template <typename HashSetType> void addHashSet(const HashSetType&, ObjectType, bool contentOnly = false); … … 123 126 124 127 template <typename T> void addObjectImpl(const T* const&, ObjectType, OwningType); 128 template <typename T> void addObjectImpl(const OwnPtr<T>* const&, ObjectType, OwningType); 129 template <typename T> void addObjectImpl(const RefPtr<T>* const&, ObjectType, OwningType); 125 130 }; 126 131 … … 203 208 204 209 template <typename T> 205 void MemoryInstrumentation::addInstrumentedObjectImpl(const OwnPtr<T>* const& object, OwningType owningType) 206 { 207 addInstrumentedObjectImpl(object->get(), owningType); 208 } 209 210 template <typename T> 211 void MemoryInstrumentation::addInstrumentedObjectImpl(const RefPtr<T>* const& object, OwningType owningType) 212 { 213 addInstrumentedObjectImpl(object->get(), owningType); 210 void MemoryInstrumentation::addInstrumentedObjectImpl(const OwnPtr<T>* const& object, OwningType) 211 { 212 addInstrumentedObjectImpl(object->get(), byPointer); 213 } 214 215 template <typename T> 216 void MemoryInstrumentation::addInstrumentedObjectImpl(const RefPtr<T>* const& object, OwningType) 217 { 218 addInstrumentedObjectImpl(object->get(), byPointer); 219 } 220 221 template <typename T> 222 void MemoryInstrumentation::addObjectImpl(const OwnPtr<T>* const& object, ObjectType objectType, OwningType) 223 { 224 addObjectImpl(object->get(), objectType, byPointer); 225 } 226 227 template <typename T> 228 void MemoryInstrumentation::addObjectImpl(const RefPtr<T>* const& object, ObjectType objectType, OwningType) 229 { 230 addObjectImpl(object->get(), objectType, byPointer); 214 231 } 215 232 -
trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp
r124332 r124334 444 444 namespace { 445 445 446 447 446 class DOMTreesIterator : public NodeWrapperVisitor { 448 447 public: … … 458 457 return; 459 458 460 m_domMemoryUsage.addInstrumentedObject(node); 461 m_domMemoryUsage.processDeferredInstrumentedPointers(); 459 m_domMemoryUsage.addRootObject(node); 462 460 } 463 461 464 462 void visitFrame(Frame* frame) 465 463 { 466 m_domMemoryUsage.addInstrumentedObject(frame); 467 m_domMemoryUsage.processDeferredInstrumentedPointers(); 464 m_domMemoryUsage.addRootObject(frame); 468 465 } 469 466 … … 471 468 { 472 469 ScriptProfiler::collectBindingMemoryInfo(&m_domMemoryUsage); 473 m_domMemoryUsage.processDeferredInstrumentedPointers();474 470 } 475 471 … … 480 476 size_t totalSize = 0; 481 477 for (int i = MemoryInstrumentation::Other; i < MemoryInstrumentation::LastTypeEntry; ++i) 482 totalSize += m_domMemoryUsage.total TypeSize(static_cast<MemoryInstrumentation::ObjectType>(i));478 totalSize += m_domMemoryUsage.totalSize(static_cast<MemoryInstrumentation::ObjectType>(i)); 483 479 484 480 RefPtr<TypeBuilder::Array<InspectorMemoryBlock> > domChildren = TypeBuilder::Array<InspectorMemoryBlock>::create(); 485 addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.total TypeSize(MemoryInstrumentation::Other), MemoryBlockName::domTreeOther);486 addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.total TypeSize(MemoryInstrumentation::DOM), MemoryBlockName::domTreeDOM);487 addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.total TypeSize(MemoryInstrumentation::CSS), MemoryBlockName::domTreeCSS);488 addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.total TypeSize(MemoryInstrumentation::Binding), MemoryBlockName::domTreeBinding);489 addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.total TypeSize(MemoryInstrumentation::Loader), MemoryBlockName::domTreeLoader);481 addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.totalSize(MemoryInstrumentation::Other), MemoryBlockName::domTreeOther); 482 addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.totalSize(MemoryInstrumentation::DOM), MemoryBlockName::domTreeDOM); 483 addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.totalSize(MemoryInstrumentation::CSS), MemoryBlockName::domTreeCSS); 484 addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.totalSize(MemoryInstrumentation::Binding), MemoryBlockName::domTreeBinding); 485 addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.totalSize(MemoryInstrumentation::Loader), MemoryBlockName::domTreeLoader); 490 486 491 487 RefPtr<InspectorMemoryBlock> dom = InspectorMemoryBlock::create().setName(MemoryBlockName::dom); -
trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.h
r124306 r124334 45 45 explicit MemoryInstrumentationImpl(VisitedObjects&); 46 46 47 void processDeferredInstrumentedPointers();48 47 size_t selfSize() const; 49 size_t total TypeSize(ObjectType objectType)48 size_t totalSize(ObjectType objectType) const 50 49 { 51 50 ASSERT(objectType >= 0 && objectType < LastTypeEntry); 52 51 return m_totalSizes[objectType]; 52 } 53 54 size_t reportedSizeForAllTypes() const 55 { 56 size_t size = 0; 57 for (int i = 0; i < LastTypeEntry; ++i) 58 size += m_totalSizes[i]; 59 return size; 53 60 } 54 61 … … 57 64 virtual void deferInstrumentedPointer(PassOwnPtr<InstrumentedPointerBase>) OVERRIDE; 58 65 virtual bool visited(const void*) OVERRIDE; 66 virtual void processDeferredInstrumentedPointers() OVERRIDE; 59 67 60 68 size_t m_totalSizes[LastTypeEntry]; -
trunk/Source/WebKit/chromium/ChangeLog
r124332 r124334 1 2012-08-01 Ilya Tikhonovsky <loislo@chromium.org> 2 3 Web Inspector: test native memory instrumentation code with help of unittests 4 https://bugs.webkit.org/show_bug.cgi?id=92743 5 6 Reviewed by Yury Semikhatsky. 7 8 Test a part of existing Native Memory Instrumentation code with help of unit tests. 9 6 tests were added and two bugs were fixed. 10 11 * WebKit.gypi: 12 * tests/MemoryInstrumentationTest.cpp: Added. 13 (WebCore): 14 (MemoryInstrumentationImpl): 15 (WebCore::MemoryInstrumentationImpl::MemoryInstrumentationImpl): 16 (WebCore::MemoryInstrumentationImpl::reportedSize): 17 (WebCore::MemoryInstrumentationImpl::countObjectSize): 18 (WebCore::MemoryInstrumentationImpl::processDeferredInstrumentedPointers): 19 (NotInstrumented): 20 (Instrumented): 21 (WebCore::Instrumented::Instrumented): 22 (WebCore::Instrumented::~Instrumented): 23 (WebCore::Instrumented::reportMemoryUsage): 24 (WebCore::TEST): 25 (InstrumentedWithOwnPtr): 26 (WebCore::InstrumentedWithOwnPtr::InstrumentedWithOwnPtr): 27 (WebCore::InstrumentedWithOwnPtr::reportMemoryUsage): 28 1 29 2012-08-01 Alexei Filippov <alexeif@chromium.org> 2 30 -
trunk/Source/WebKit/chromium/WebKit.gypi
r123856 r124334 127 127 'tests/LocalizedNumberICUTest.cpp', 128 128 'tests/MemoryInfo.cpp', 129 'tests/MemoryInstrumentationTest.cpp', 129 130 'tests/MockCCQuadCuller.h', 130 131 'tests/OpaqueRectTrackingContentLayerDelegateTest.cpp',
Note: See TracChangeset
for help on using the changeset viewer.