Changeset 191849 in webkit
- Timestamp:
- Oct 31, 2015 7:29:47 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r191846 r191849 1 2015-10-31 Andreas Kling <akling@apple.com> 2 3 Add a debug overlay with information about web process resource usage. 4 <https://webkit.org/b/150599> 5 6 Reviewed by Darin Adler. 7 8 Have Heap track the exact number of bytes allocated in CopiedBlock, MarkedBlock and 9 WeakBlock objects, keeping them in a single location that can be sampled by the 10 resource usage overlay thread. 11 12 The bulk of these changes is threading a Heap& through from sites where blocks are 13 allocated or freed. 14 15 * heap/CopiedBlock.cpp: 16 (JSC::CopiedBlock::createNoZeroFill): 17 (JSC::CopiedBlock::destroy): 18 (JSC::CopiedBlock::create): 19 * heap/CopiedBlock.h: 20 * heap/CopiedSpace.cpp: 21 (JSC::CopiedSpace::~CopiedSpace): 22 (JSC::CopiedSpace::tryAllocateOversize): 23 (JSC::CopiedSpace::tryReallocateOversize): 24 * heap/CopiedSpaceInlines.h: 25 (JSC::CopiedSpace::recycleEvacuatedBlock): 26 (JSC::CopiedSpace::recycleBorrowedBlock): 27 (JSC::CopiedSpace::allocateBlockForCopyingPhase): 28 (JSC::CopiedSpace::allocateBlock): 29 (JSC::CopiedSpace::startedCopying): 30 * heap/Heap.cpp: 31 (JSC::Heap::~Heap): 32 (JSC::Heap::sweepNextLogicallyEmptyWeakBlock): 33 * heap/Heap.h: 34 (JSC::Heap::blockBytesAllocated): 35 * heap/HeapInlines.h: 36 (JSC::Heap::didAllocateBlock): 37 (JSC::Heap::didFreeBlock): 38 * heap/MarkedAllocator.cpp: 39 (JSC::MarkedAllocator::allocateBlock): 40 * heap/MarkedBlock.cpp: 41 (JSC::MarkedBlock::create): 42 (JSC::MarkedBlock::destroy): 43 * heap/MarkedBlock.h: 44 * heap/MarkedSpace.cpp: 45 (JSC::MarkedSpace::freeBlock): 46 * heap/WeakBlock.cpp: 47 (JSC::WeakBlock::create): 48 (JSC::WeakBlock::destroy): 49 * heap/WeakBlock.h: 50 * heap/WeakSet.cpp: 51 (JSC::WeakSet::~WeakSet): 52 (JSC::WeakSet::addAllocator): 53 (JSC::WeakSet::removeAllocator): 54 1 55 2015-10-30 Filip Pizlo <fpizlo@apple.com> 2 56 -
trunk/Source/JavaScriptCore/heap/CopiedBlock.cpp
r191248 r191849 34 34 static size_t balance; 35 35 36 CopiedBlock* CopiedBlock::createNoZeroFill( size_t capacity)36 CopiedBlock* CopiedBlock::createNoZeroFill(Heap& heap, size_t capacity) 37 37 { 38 38 if (computeBalance) { … … 41 41 dataLog("CopiedBlock Balance: ", balance, "\n"); 42 42 } 43 return new(NotNull, fastAlignedMalloc(CopiedBlock::blockSize, capacity)) CopiedBlock(capacity); 43 CopiedBlock* block = new (NotNull, fastAlignedMalloc(CopiedBlock::blockSize, capacity)) CopiedBlock(capacity); 44 heap.didAllocateBlock(capacity); 45 return block; 44 46 } 45 47 46 void CopiedBlock::destroy( CopiedBlock* copiedBlock)48 void CopiedBlock::destroy(Heap& heap, CopiedBlock* copiedBlock) 47 49 { 48 50 if (computeBalance) { … … 51 53 dataLog("CopiedBlock Balance: ", balance, "\n"); 52 54 } 55 size_t capacity = copiedBlock->capacity(); 53 56 copiedBlock->~CopiedBlock(); 54 57 fastAlignedFree(copiedBlock); 58 heap.didFreeBlock(capacity); 55 59 } 56 60 57 CopiedBlock* CopiedBlock::create( size_t capacity)61 CopiedBlock* CopiedBlock::create(Heap& heap, size_t capacity) 58 62 { 59 CopiedBlock* newBlock = createNoZeroFill( capacity);63 CopiedBlock* newBlock = createNoZeroFill(heap, capacity); 60 64 newBlock->zeroFillWilderness(); 61 65 return newBlock; -
trunk/Source/JavaScriptCore/heap/CopiedBlock.h
r191248 r191849 42 42 friend class CopiedAllocator; 43 43 public: 44 static CopiedBlock* create( size_t = blockSize);45 static CopiedBlock* createNoZeroFill( size_t = blockSize);46 static void destroy( CopiedBlock*);44 static CopiedBlock* create(Heap&, size_t = blockSize); 45 static CopiedBlock* createNoZeroFill(Heap&, size_t = blockSize); 46 static void destroy(Heap&, CopiedBlock*); 47 47 48 48 void pin(); -
trunk/Source/JavaScriptCore/heap/CopiedSpace.cpp
r190705 r191849 45 45 { 46 46 while (!m_oldGen.toSpace->isEmpty()) 47 CopiedBlock::destroy( m_oldGen.toSpace->removeHead());47 CopiedBlock::destroy(*heap(), m_oldGen.toSpace->removeHead()); 48 48 49 49 while (!m_oldGen.fromSpace->isEmpty()) 50 CopiedBlock::destroy( m_oldGen.fromSpace->removeHead());50 CopiedBlock::destroy(*heap(), m_oldGen.fromSpace->removeHead()); 51 51 52 52 while (!m_oldGen.oversizeBlocks.isEmpty()) 53 CopiedBlock::destroy( m_oldGen.oversizeBlocks.removeHead());53 CopiedBlock::destroy(*heap(), m_oldGen.oversizeBlocks.removeHead()); 54 54 55 55 while (!m_newGen.toSpace->isEmpty()) 56 CopiedBlock::destroy( m_newGen.toSpace->removeHead());56 CopiedBlock::destroy(*heap(), m_newGen.toSpace->removeHead()); 57 57 58 58 while (!m_newGen.fromSpace->isEmpty()) 59 CopiedBlock::destroy( m_newGen.fromSpace->removeHead());59 CopiedBlock::destroy(*heap(), m_newGen.fromSpace->removeHead()); 60 60 61 61 while (!m_newGen.oversizeBlocks.isEmpty()) 62 CopiedBlock::destroy( m_newGen.oversizeBlocks.removeHead());62 CopiedBlock::destroy(*heap(), m_newGen.oversizeBlocks.removeHead()); 63 63 64 64 ASSERT(m_oldGen.toSpace->isEmpty()); … … 99 99 ASSERT(isOversize(bytes)); 100 100 101 CopiedBlock* block = CopiedBlock::create( WTF::roundUpToMultipleOf<sizeof(double)>(sizeof(CopiedBlock) + bytes));101 CopiedBlock* block = CopiedBlock::create(*m_heap, WTF::roundUpToMultipleOf<sizeof(double)>(sizeof(CopiedBlock) + bytes)); 102 102 m_newGen.oversizeBlocks.push(block); 103 103 m_newGen.blockFilter.add(reinterpret_cast<Bits>(block)); … … 165 165 m_newGen.oversizeBlocks.remove(oldBlock); 166 166 m_blockSet.remove(oldBlock); 167 CopiedBlock::destroy( oldBlock);167 CopiedBlock::destroy(*heap(), oldBlock); 168 168 } 169 169 -
trunk/Source/JavaScriptCore/heap/CopiedSpaceInlines.h
r191248 r191849 105 105 m_oldGen.fromSpace->remove(block); 106 106 } 107 CopiedBlock::destroy( block);107 CopiedBlock::destroy(*heap(), block); 108 108 } 109 109 110 110 inline void CopiedSpace::recycleBorrowedBlock(CopiedBlock* block) 111 111 { 112 CopiedBlock::destroy( block);112 CopiedBlock::destroy(*heap(), block); 113 113 114 114 { … … 123 123 { 124 124 ASSERT(m_inCopyingPhase); 125 CopiedBlock* block = CopiedBlock::createNoZeroFill( );125 CopiedBlock* block = CopiedBlock::createNoZeroFill(*m_heap); 126 126 127 127 { … … 140 140 m_allocator.resetCurrentBlock(); 141 141 142 CopiedBlock* block = CopiedBlock::create( );142 CopiedBlock* block = CopiedBlock::create(*m_heap); 143 143 144 144 m_newGen.toSpace->push(block); … … 232 232 oversizeBlocks->remove(block); 233 233 m_blockSet.remove(block); 234 CopiedBlock::destroy( block);234 CopiedBlock::destroy(*heap(), block); 235 235 } 236 236 block = next; -
trunk/Source/JavaScriptCore/heap/Heap.cpp
r191248 r191849 364 364 { 365 365 for (WeakBlock* block : m_logicallyEmptyWeakBlocks) 366 WeakBlock::destroy( block);366 WeakBlock::destroy(*this, block); 367 367 } 368 368 … … 1573 1573 std::swap(m_logicallyEmptyWeakBlocks[m_indexOfNextLogicallyEmptyWeakBlockToSweep], m_logicallyEmptyWeakBlocks.last()); 1574 1574 m_logicallyEmptyWeakBlocks.removeLast(); 1575 WeakBlock::destroy( block);1575 WeakBlock::destroy(*this, block); 1576 1576 } else 1577 1577 m_indexOfNextLogicallyEmptyWeakBlockToSweep++; -
trunk/Source/JavaScriptCore/heap/Heap.h
r191248 r191849 179 179 JS_EXPORT_PRIVATE bool unprotect(JSValue); // True when the protect count drops to 0. 180 180 181 size_t extraMemorySize(); // Non-GC memory referenced by GC objects.181 JS_EXPORT_PRIVATE size_t extraMemorySize(); // Non-GC memory referenced by GC objects. 182 182 JS_EXPORT_PRIVATE size_t size(); 183 183 JS_EXPORT_PRIVATE size_t capacity(); … … 236 236 237 237 void addLogicallyEmptyWeakBlock(WeakBlock*); 238 239 #if ENABLE(RESOURCE_USAGE_OVERLAY) 240 size_t blockBytesAllocated() const { return m_blockBytesAllocated; } 241 #endif 242 243 void didAllocateBlock(size_t capacity); 244 void didFreeBlock(size_t capacity); 238 245 239 246 private: … … 440 447 441 448 ParallelHelperClient m_helperClient; 449 450 #if ENABLE(RESOURCE_USAGE_OVERLAY) 451 size_t m_blockBytesAllocated { 0 }; 452 #endif 442 453 }; 443 454 -
trunk/Source/JavaScriptCore/heap/HeapInlines.h
r191248 r191849 308 308 m_weakGCMaps.remove(weakGCMap); 309 309 } 310 310 311 inline void Heap::didAllocateBlock(size_t capacity) 312 { 313 #if ENABLE(RESOURCE_USAGE_OVERLAY) 314 m_blockBytesAllocated += capacity; 315 #else 316 UNUSED_PARAM(capacity); 317 #endif 318 } 319 320 inline void Heap::didFreeBlock(size_t capacity) 321 { 322 #if ENABLE(RESOURCE_USAGE_OVERLAY) 323 m_blockBytesAllocated -= capacity; 324 #else 325 UNUSED_PARAM(capacity); 326 #endif 327 } 328 311 329 } // namespace JSC 312 330 -
trunk/Source/JavaScriptCore/heap/MarkedAllocator.cpp
r189012 r191849 182 182 size_t cellSize = m_cellSize ? m_cellSize : WTF::roundUpToMultipleOf<MarkedBlock::atomSize>(bytes); 183 183 184 return MarkedBlock::create( this, blockSize, cellSize, m_needsDestruction);184 return MarkedBlock::create(*m_heap, this, blockSize, cellSize, m_needsDestruction); 185 185 } 186 186 -
trunk/Source/JavaScriptCore/heap/MarkedBlock.cpp
r191248 r191849 36 36 static size_t balance; 37 37 38 MarkedBlock* MarkedBlock::create( MarkedAllocator* allocator, size_t capacity, size_t cellSize, bool needsDestruction)38 MarkedBlock* MarkedBlock::create(Heap& heap, MarkedAllocator* allocator, size_t capacity, size_t cellSize, bool needsDestruction) 39 39 { 40 40 if (computeBalance) { … … 43 43 dataLog("MarkedBlock Balance: ", balance, "\n"); 44 44 } 45 return new (NotNull, fastAlignedMalloc(blockSize, capacity)) MarkedBlock(allocator, capacity, cellSize, needsDestruction); 46 } 47 48 void MarkedBlock::destroy(MarkedBlock* block) 45 MarkedBlock* block = new (NotNull, fastAlignedMalloc(blockSize, capacity)) MarkedBlock(allocator, capacity, cellSize, needsDestruction); 46 heap.didAllocateBlock(capacity); 47 return block; 48 } 49 50 void MarkedBlock::destroy(Heap& heap, MarkedBlock* block) 49 51 { 50 52 if (computeBalance) { … … 53 55 dataLog("MarkedBlock Balance: ", balance, "\n"); 54 56 } 57 size_t capacity = block->capacity(); 55 58 block->~MarkedBlock(); 56 59 fastAlignedFree(block); 60 heap.didFreeBlock(capacity); 57 61 } 58 62 -
trunk/Source/JavaScriptCore/heap/MarkedBlock.h
r191015 r191849 107 107 }; 108 108 109 static MarkedBlock* create( MarkedAllocator*, size_t capacity, size_t cellSize, bool needsDestruction);110 static void destroy( MarkedBlock*);109 static MarkedBlock* create(Heap&, MarkedAllocator*, size_t capacity, size_t cellSize, bool needsDestruction); 110 static void destroy(Heap&, MarkedBlock*); 111 111 112 112 static bool isAtomAligned(const void*); -
trunk/Source/JavaScriptCore/heap/MarkedSpace.cpp
r190739 r191849 210 210 m_capacity -= block->capacity(); 211 211 m_blocks.remove(block); 212 MarkedBlock::destroy( block);212 MarkedBlock::destroy(*m_heap, block); 213 213 } 214 214 -
trunk/Source/JavaScriptCore/heap/WeakBlock.cpp
r191015 r191849 35 35 namespace JSC { 36 36 37 WeakBlock* WeakBlock::create( MarkedBlock& markedBlock)37 WeakBlock* WeakBlock::create(Heap& heap, MarkedBlock& markedBlock) 38 38 { 39 heap.didAllocateBlock(WeakBlock::blockSize); 39 40 return new (NotNull, fastMalloc(blockSize)) WeakBlock(markedBlock); 40 41 } 41 42 42 void WeakBlock::destroy( WeakBlock* block)43 void WeakBlock::destroy(Heap& heap, WeakBlock* block) 43 44 { 44 45 block->~WeakBlock(); 45 46 fastFree(block); 47 heap.didFreeBlock(WeakBlock::blockSize); 46 48 } 47 49 -
trunk/Source/JavaScriptCore/heap/WeakBlock.h
r191015 r191849 33 33 namespace JSC { 34 34 35 class Heap; 35 36 class HeapRootVisitor; 36 37 class MarkedBlock; … … 53 54 }; 54 55 55 static WeakBlock* create( MarkedBlock&);56 static void destroy( WeakBlock*);56 static WeakBlock* create(Heap&, MarkedBlock&); 57 static void destroy(Heap&, WeakBlock*); 57 58 58 59 static WeakImpl* asWeakImpl(FreeCell*); -
trunk/Source/JavaScriptCore/heap/WeakSet.cpp
r183769 r191849 35 35 WeakSet::~WeakSet() 36 36 { 37 Heap& heap = *this->heap(); 37 38 WeakBlock* next = 0; 38 39 for (WeakBlock* block = m_blocks.head(); block; block = next) { 39 40 next = block->next(); 40 WeakBlock::destroy( block);41 WeakBlock::destroy(heap, block); 41 42 } 42 43 m_blocks.clear(); … … 86 87 WeakBlock::FreeCell* WeakSet::addAllocator() 87 88 { 88 WeakBlock* block = WeakBlock::create( m_markedBlock);89 WeakBlock* block = WeakBlock::create(*heap(), m_markedBlock); 89 90 heap()->didAllocate(WeakBlock::blockSize); 90 91 m_blocks.append(block); … … 97 98 { 98 99 m_blocks.remove(block); 99 WeakBlock::destroy( block);100 WeakBlock::destroy(*heap(), block); 100 101 } 101 102 -
trunk/Source/WTF/ChangeLog
r191803 r191849 1 2015-10-31 Andreas Kling <akling@apple.com> 2 3 Add a debug overlay with information about web process resource usage. 4 <https://webkit.org/b/150599> 5 6 Reviewed by Darin Adler. 7 8 Add ENABLE(RESOURCE_USAGE_OVERLAY) flag, enabled on Mac by default. 9 10 * wtf/Platform.h: 11 1 12 2015-10-30 Chris Dumez <cdumez@apple.com> 2 13 -
trunk/Source/WTF/wtf/Platform.h
r191749 r191849 1082 1082 #endif 1083 1083 1084 #if PLATFORM(MAC) 1085 #define ENABLE_RESOURCE_USAGE_OVERLAY 1 1086 #endif 1087 1084 1088 #if PLATFORM(GTK) || PLATFORM(EFL) 1085 1089 #undef ENABLE_OPENTYPE_VERTICAL -
trunk/Source/WebCore/CMakeLists.txt
r191842 r191849 2046 2046 page/PointerLockController.cpp 2047 2047 page/PrintContext.cpp 2048 page/ResourceUsageOverlay.cpp 2048 2049 page/Screen.cpp 2049 2050 page/SecurityOrigin.cpp -
trunk/Source/WebCore/ChangeLog
r191847 r191849 1 2015-10-31 Andreas Kling <akling@apple.com> 2 3 Add a debug overlay with information about web process resource usage. 4 <https://webkit.org/b/150599> 5 6 Reviewed by Darin Adler. 7 8 A new kind of PageOverlay is added behind the ENABLE(RESOURCE_USAGE_OVERLAY) flag. 9 It's owned by Page, but not instantiated unless the Settings::resourceUsageOverlayVisible flag is set. 10 11 All ResourceUsageOverlay objects share a single sampler thread. The thread currently runs every 500ms 12 and samples CPU usage, dirty memory regions, and GC heap size/capacity. 13 14 Most things in here are currently quite Mac-specific, but I will be iterating on this towards a more 15 cross-platform friendly solution. 16 17 There are two small changes to PageOverlay in order to support dragging the resource usage overlay: 18 19 - A "should ignore mouse events outside bounds" state flag. This is on by default 20 but turned off during a drag. 21 - PageOverlay::bounds() will now return the override frame verbatim if one is set, 22 instead of returning it relocated to 0,0. 23 24 Note that this is intended as a tool for WebKit engine developers to better understand memory usage. 25 It's not a goal to expose this information to end users. 26 27 * WebCore.xcodeproj/project.pbxproj: 28 * page/Page.cpp: 29 (WebCore::Page::setResourceUsageOverlayVisible): 30 * page/Page.h: 31 * page/PageOverlay.cpp: 32 (WebCore::PageOverlay::bounds): 33 (WebCore::PageOverlay::mouseEvent): 34 * page/PageOverlay.h: 35 * page/ResourceUsageOverlay.cpp: Added. 36 (WebCore::ResourceUsageOverlay::ResourceUsageOverlay): 37 (WebCore::ResourceUsageOverlay::~ResourceUsageOverlay): 38 (WebCore::ResourceUsageOverlay::mouseEvent): 39 * page/ResourceUsageOverlay.h: Added. 40 * page/Settings.cpp: 41 (WebCore::Settings::setResourceUsageOverlayVisible): 42 * page/Settings.h: 43 (WebCore::Settings::resourceUsageOverlayVisible): 44 * page/cocoa/ResourceUsageOverlayCocoa.mm: Added. 45 (-[WebOverlayLayer initWithResourceUsageOverlay:]): 46 (-[WebOverlayLayer drawInContext:]): 47 (WebCore::RingBuffer::RingBuffer): 48 (WebCore::RingBuffer::append): 49 (WebCore::RingBuffer::last): 50 (WebCore::RingBuffer::forEach): 51 (WebCore::RingBuffer::incrementIndex): 52 (WebCore::RingBuffer::decrementIndex): 53 (WebCore::sharedData): 54 (WebCore::ResourceUsageOverlay::platformInitialize): 55 (WebCore::ResourceUsageOverlay::platformDestroy): 56 (WebCore::drawCpuHistory): 57 (WebCore::drawGCHistory): 58 (WebCore::drawSlice): 59 (WebCore::drawPlate): 60 (WebCore::drawMemoryPie): 61 (WebCore::formatByteNumber): 62 (WebCore::showText): 63 (WebCore::ResourceUsageOverlay::draw): 64 (WebCore::dirtyPagesPerVMTag): 65 (WebCore::cpuUsage): 66 (WebCore::runSamplerThread): 67 * platform/spi/cocoa/MachVMSPI.h: 68 1 69 2015-10-31 Brady Eidson <beidson@apple.com> 2 70 -
trunk/Source/WebCore/PlatformMac.cmake
r191789 r191849 270 270 271 271 page/cocoa/UserAgent.mm 272 page/cocoa/ResourceUsageOverlayCocoa.mm 272 273 273 274 page/mac/ChromeMac.mm -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r191842 r191849 4626 4626 AD9FF6E11908391D003B61E0 /* IOSurfacePoolCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = AD9FF6E01908391D003B61E0 /* IOSurfacePoolCocoa.mm */; }; 4627 4627 ADB6B29818FB90240081963E /* MemoryPressureHandlerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = ADB6B29718FB90240081963E /* MemoryPressureHandlerCocoa.mm */; }; 4628 ADBAD6EE1BCDD95500381325 /* ResourceUsageOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADBAD6EC1BCDD95000381325 /* ResourceUsageOverlay.cpp */; }; 4629 ADBAD6EF1BCDD95700381325 /* ResourceUsageOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = ADBAD6ED1BCDD95000381325 /* ResourceUsageOverlay.h */; }; 4628 4630 ADDA94C219687AA500453029 /* JSDocumentCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = ADDA94BF19686F8000453029 /* JSDocumentCustom.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4629 4631 ADDF1AD71257CD9A0003A759 /* RenderSVGPath.h in Headers */ = {isa = PBXBuildFile; fileRef = ADDF1AD51257CD9A0003A759 /* RenderSVGPath.h */; }; 4630 4632 ADEC78F818EE5308001315C2 /* JSElementCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = ADEC78F718EE5308001315C2 /* JSElementCustom.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4633 ADFE2B551BD5F61200DAB457 /* ResourceUsageOverlayCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = ADFE2B541BD5F41200DAB457 /* ResourceUsageOverlayCocoa.mm */; }; 4631 4634 B10B6980140C174000BC1C26 /* WebVTTToken.h in Headers */ = {isa = PBXBuildFile; fileRef = B10B697D140C174000BC1C26 /* WebVTTToken.h */; }; 4632 4635 B10B6981140C174000BC1C26 /* WebVTTTokenizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B10B697E140C174000BC1C26 /* WebVTTTokenizer.cpp */; }; … … 12207 12210 AD9FF6E01908391D003B61E0 /* IOSurfacePoolCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IOSurfacePoolCocoa.mm; sourceTree = "<group>"; }; 12208 12211 ADB6B29718FB90240081963E /* MemoryPressureHandlerCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryPressureHandlerCocoa.mm; sourceTree = "<group>"; }; 12212 ADBAD6EC1BCDD95000381325 /* ResourceUsageOverlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceUsageOverlay.cpp; sourceTree = "<group>"; }; 12213 ADBAD6ED1BCDD95000381325 /* ResourceUsageOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceUsageOverlay.h; sourceTree = "<group>"; }; 12209 12214 ADDA94BF19686F8000453029 /* JSDocumentCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDocumentCustom.h; sourceTree = "<group>"; }; 12210 12215 ADDF1AD41257CD9A0003A759 /* RenderSVGPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGPath.cpp; sourceTree = "<group>"; }; … … 12213 12218 ADE16736181050C300463A2E /* RenderPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderPtr.h; sourceTree = "<group>"; }; 12214 12219 ADEC78F718EE5308001315C2 /* JSElementCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSElementCustom.h; sourceTree = "<group>"; }; 12220 ADFE2B541BD5F41200DAB457 /* ResourceUsageOverlayCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceUsageOverlayCocoa.mm; sourceTree = "<group>"; }; 12215 12221 B10B697D140C174000BC1C26 /* WebVTTToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVTTToken.h; sourceTree = "<group>"; }; 12216 12222 B10B697E140C174000BC1C26 /* WebVTTTokenizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebVTTTokenizer.cpp; sourceTree = "<group>"; }; … … 14969 14975 }; 14970 14976 /* End PBXFrameworksBuildPhase section */ 14971 14972 14977 /* Begin PBXGroup section */ 14973 14978 00B9318013BA867F0035A948 /* parser */ = { … … 17077 17082 isa = PBXGroup; 17078 17083 children = ( 17084 ADFE2B541BD5F41200DAB457 /* ResourceUsageOverlayCocoa.mm */, 17079 17085 26255F0118878E110006E1FD /* UserAgent.h */, 17080 17086 5D5975B61963637B00D00878 /* UserAgent.mm */, … … 17505 17511 isa = PBXGroup; 17506 17512 children = ( 17513 ADBAD6EC1BCDD95000381325 /* ResourceUsageOverlay.cpp */, 17514 ADBAD6ED1BCDD95000381325 /* ResourceUsageOverlay.h */, 17507 17515 316FE1060E6E1D8400BF6088 /* animation */, 17508 17516 5D5975B5196362BE00D00878 /* cocoa */, … … 27741 27749 37FD4298118368460093C029 /* TreeDepthLimit.h in Headers */, 27742 27750 14D64B5D134A5B6B00E58FDA /* TreeScope.h in Headers */, 27751 ADBAD6EF1BCDD95700381325 /* ResourceUsageOverlay.h in Headers */, 27743 27752 A77E1FF014AACB6E005B7CB6 /* TreeScopeAdopter.h in Headers */, 27744 27753 854FE7390A2297BE0058D7AD /* TreeWalker.h in Headers */, … … 29516 29525 BCC5BE000C0E93110011C2DB /* JSCSSStyleSheet.cpp in Sources */, 29517 29526 FD67773A195CB14A0072E0D3 /* JSCSSSupportsRule.cpp in Sources */, 29527 ADFE2B551BD5F61200DAB457 /* ResourceUsageOverlayCocoa.mm in Sources */, 29518 29528 14CF78A409F58CBF00EB3665 /* JSCSSValue.cpp in Sources */, 29519 29529 BC20FB7F0C0E8E6C00D1447F /* JSCSSValueCustom.cpp in Sources */, … … 30389 30399 F34742DC134362F000531BC2 /* PageDebuggerAgent.cpp in Sources */, 30390 30400 9302B0BD0D79F82900C7EE83 /* PageGroup.cpp in Sources */, 30401 ADBAD6EE1BCDD95500381325 /* ResourceUsageOverlay.cpp in Sources */, 30391 30402 7A674BDB0F9EBF4E006CF099 /* PageGroupLoadDeferrer.cpp in Sources */, 30392 30403 2D5C9CFF19C7B52E00B3C5C1 /* PageOverlay.cpp in Sources */, -
trunk/Source/WebCore/page/Page.cpp
r191673 r191849 74 74 #include "RenderView.h" 75 75 #include "RenderWidget.h" 76 #include "ResourceUsageOverlay.h" 76 77 #include "RuntimeEnabledFeatures.h" 77 78 #include "SchemeRegistry.h" … … 1783 1784 #endif 1784 1785 1786 #if ENABLE(RESOURCE_USAGE_OVERLAY) 1787 void Page::setResourceUsageOverlayVisible(bool visible) 1788 { 1789 if (!visible) { 1790 m_resourceUsageOverlay = nullptr; 1791 return; 1792 } 1793 1794 if (!m_resourceUsageOverlay) 1795 m_resourceUsageOverlay = std::make_unique<ResourceUsageOverlay>(*this); 1796 } 1797 #endif 1798 1785 1799 } // namespace WebCore -
trunk/Source/WebCore/page/Page.h
r191673 r191849 110 110 class RenderTheme; 111 111 class ReplayController; 112 class ResourceUsageOverlay; 112 113 class VisibleSelection; 113 114 class ScrollableArea; … … 334 335 void storageBlockingStateChanged(); 335 336 337 #if ENABLE(RESOURCE_USAGE_OVERLAY) 338 void setResourceUsageOverlayVisible(bool); 339 #endif 340 336 341 void setDebugger(JSC::Debugger*); 337 342 JSC::Debugger* debugger() const { return m_debugger; } … … 632 637 HashSet<ViewStateChangeObserver*> m_viewStateChangeObservers; 633 638 639 #if ENABLE(RESOURCE_USAGE_OVERLAY) 640 std::unique_ptr<ResourceUsageOverlay> m_resourceUsageOverlay; 641 #endif 642 634 643 SessionID m_sessionID; 635 644 -
trunk/Source/WebCore/page/PageOverlay.cpp
r189270 r191849 80 80 { 81 81 if (!m_overrideFrame.isEmpty()) 82 return IntRect(IntPoint(), m_overrideFrame.size());82 return m_overrideFrame; 83 83 84 84 FrameView* frameView = m_page->mainFrame().view(); … … 193 193 194 194 // Ignore events outside the bounds. 195 if ( !bounds().contains(mousePositionInOverlayCoordinates))195 if (m_shouldIgnoreMouseEventsOutsideBounds && !bounds().contains(mousePositionInOverlayCoordinates)) 196 196 return false; 197 197 -
trunk/Source/WebCore/page/PageOverlay.h
r184066 r191849 111 111 void setBackgroundColor(RGBA32); 112 112 113 void setShouldIgnoreMouseEventsOutsideBounds(bool flag) { m_shouldIgnoreMouseEventsOutsideBounds = flag; } 114 113 115 // FIXME: PageOverlay should own its layer, instead of PageOverlayController. 114 116 WEBCORE_EXPORT GraphicsLayer& layer(); … … 141 143 RGBA32 m_backgroundColor; 142 144 PageOverlayID m_pageOverlayID; 145 146 bool m_shouldIgnoreMouseEventsOutsideBounds { true }; 143 147 }; 144 148 -
trunk/Source/WebCore/page/Settings.cpp
r189129 r191849 532 532 } 533 533 534 #if ENABLE(RESOURCE_USAGE_OVERLAY) 535 void Settings::setResourceUsageOverlayVisible(bool visible) 536 { 537 if (m_resourceUsageOverlayVisible == visible) 538 return; 539 540 m_resourceUsageOverlayVisible = visible; 541 if (m_page) 542 m_page->setResourceUsageOverlayVisible(visible); 543 } 544 #endif 545 534 546 #if PLATFORM(WIN) 535 547 void Settings::setShouldUseHighResolutionTimers(bool shouldUseHighResolutionTimers) -
trunk/Source/WebCore/page/Settings.h
r188234 r191849 190 190 bool showTiledScrollingIndicator() const { return m_showTiledScrollingIndicator; } 191 191 192 #if ENABLE(RESOURCE_USAGE_OVERLAY) 193 bool resourceUsageOverlayVisible() const { return m_resourceUsageOverlayVisible; } 194 WEBCORE_EXPORT void setResourceUsageOverlayVisible(bool); 195 #endif 196 192 197 #if PLATFORM(WIN) 193 198 static void setShouldUseHighResolutionTimers(bool); … … 334 339 bool m_forcePendingWebGLPolicy : 1; 335 340 341 #if ENABLE(RESOURCE_USAGE_OVERLAY) 342 bool m_resourceUsageOverlayVisible { false }; 343 #endif 344 336 345 #if USE(AVFOUNDATION) 337 346 WEBCORE_EXPORT static bool gAVFoundationEnabled; -
trunk/Source/WebCore/platform/spi/cocoa/MachVMSPI.h
r176265 r191849 42 42 EXTERN_C kern_return_t mach_vm_region(vm_map_t targetTask, mach_vm_address_t*, mach_vm_size_t*, vm_region_flavor_t, vm_region_info_t, 43 43 mach_msg_type_number_t* infoCount, mach_port_t* objectName); 44 EXTERN_C kern_return_t mach_vm_region_recurse(vm_map_t targetTask, mach_vm_address_t*, mach_vm_size_t*, uint32_t* depth, vm_region_recurse_info_t, mach_msg_type_number_t* infoCount); 44 45 45 46 #endif // MachVMSPI_h -
trunk/Source/WebKit2/ChangeLog
r191848 r191849 1 2015-10-31 Andreas Kling <akling@apple.com> 2 3 Add a debug overlay with information about web process resource usage. 4 <https://webkit.org/b/150599> 5 6 Reviewed by Darin Adler. 7 8 Add WK2 preferences SPI for showing/hiding the resource usage overlay. 9 10 * Shared/WebPreferencesDefinitions.h: 11 * UIProcess/API/C/WKPreferences.cpp: 12 (WKPreferencesSetResourceUsageOverlayVisible): 13 (WKPreferencesGetResourceUsageOverlayVisible): 14 * UIProcess/API/C/WKPreferencesRefPrivate.h: 15 * UIProcess/API/Cocoa/WKPreferences.mm: 16 (-[WKPreferences _resourceUsageOverlayVisible]): 17 (-[WKPreferences _setResourceUsageOverlayVisible:]): 18 * UIProcess/API/Cocoa/WKPreferencesPrivate.h: 19 * WebProcess/WebPage/WebPage.cpp: 20 (WebKit::WebPage::updatePreferences): 21 1 22 2015-10-31 Alex Christensen <achristensen@webkit.org> 2 23 -
trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h
r191323 r191849 244 244 macro(IgnoreViewportScalingConstraints, ignoreViewportScalingConstraints, Bool, bool, true) \ 245 245 macro(ForceAlwaysUserScalable, forceAlwaysUserScalable, Bool, bool, false) \ 246 macro(ResourceUsageOverlayVisible, resourceUsageOverlayVisible, Bool, bool, false) \ 246 247 \ 247 248 -
trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
r191323 r191849 1407 1407 return toImpl(preferencesRef)->allowsAirPlayForMediaPlayback(); 1408 1408 } 1409 1410 void WKPreferencesSetResourceUsageOverlayVisible(WKPreferencesRef preferencesRef, bool javaEnabled) 1411 { 1412 toImpl(preferencesRef)->setResourceUsageOverlayVisible(javaEnabled); 1413 } 1414 1415 bool WKPreferencesGetResourceUsageOverlayVisible(WKPreferencesRef preferencesRef) 1416 { 1417 return toImpl(preferencesRef)->resourceUsageOverlayVisible(); 1418 } 1419 -
trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h
r191323 r191849 384 384 WK_EXPORT bool WKPreferencesGetHTTPEquivEnabled(WKPreferencesRef preferences); 385 385 386 // Defaults to false. 387 WK_EXPORT void WKPreferencesSetResourceUsageOverlayVisible(WKPreferencesRef, bool); 388 WK_EXPORT bool WKPreferencesGetResourceUsageOverlayVisible(WKPreferencesRef); 389 386 390 #ifdef __cplusplus 387 391 } -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm
r189513 r191849 218 218 } 219 219 220 - (BOOL)_resourceUsageOverlayVisible 221 { 222 return _preferences->resourceUsageOverlayVisible(); 223 } 224 225 - (void)_setResourceUsageOverlayVisible:(BOOL)resourceUsageOverlayVisible 226 { 227 _preferences->setResourceUsageOverlayVisible(resourceUsageOverlayVisible); 228 } 229 220 230 - (_WKDebugOverlayRegions)_visibleDebugOverlayRegions 221 231 { -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h
r189547 r191849 56 56 @property (nonatomic, setter=_setCompositingRepaintCountersVisible:) BOOL _compositingRepaintCountersVisible; 57 57 @property (nonatomic, setter=_setTiledScrollingIndicatorVisible:) BOOL _tiledScrollingIndicatorVisible; 58 @property (nonatomic, setter=_setResourceUsageOverlayVisible:) BOOL _resourceUsageOverlayVisible WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA); 58 59 @property (nonatomic, setter=_setVisibleDebugOverlayRegions:) _WKDebugOverlayRegions _visibleDebugOverlayRegions WK_AVAILABLE(10_11, 9_0); 59 60 @property (nonatomic, setter=_setSimpleLineLayoutDebugBordersEnabled:) BOOL _simpleLineLayoutDebugBordersEnabled WK_AVAILABLE(10_11, 9_0); -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r191644 r191849 2825 2825 #endif 2826 2826 2827 #if ENABLE(RESOURCE_USAGE_OVERLAY) 2828 settings.setResourceUsageOverlayVisible(store.getBoolValueForKey(WebPreferencesKey::resourceUsageOverlayVisibleKey())); 2829 #endif 2830 2827 2831 settings.setSuppressesIncrementalRendering(store.getBoolValueForKey(WebPreferencesKey::suppressesIncrementalRenderingKey())); 2828 2832 settings.setIncrementalRenderingSuppressionTimeoutInSeconds(store.getDoubleValueForKey(WebPreferencesKey::incrementalRenderingSuppressionTimeoutKey())); -
trunk/Tools/ChangeLog
r191843 r191849 1 2015-10-31 Andreas Kling <akling@apple.com> 2 3 Add a debug overlay with information about web process resource usage. 4 <https://webkit.org/b/150599> 5 6 Reviewed by Darin Adler. 7 8 Add a menu item to the MiniBrowser so we can toggle the resource usage overlay on/off. 9 10 * MiniBrowser/mac/SettingsController.h: 11 * MiniBrowser/mac/SettingsController.m: 12 (-[SettingsController _populateMenu]): 13 (-[SettingsController validateMenuItem:]): 14 (-[SettingsController toggleShowResourceUsageOverlay:]): 15 (-[SettingsController resourceUsageOverlayVisible]): 16 * MiniBrowser/mac/WK2BrowserWindowController.m: 17 (-[WK2BrowserWindowController didChangeSettings]): 18 1 19 2015-10-31 Lucas Forschler <lforschler@apple.com> 2 20 -
trunk/Tools/MiniBrowser/mac/SettingsController.h
r189513 r191849 41 41 @property (nonatomic, readonly) BOOL incrementalRenderingSuppressed; 42 42 @property (nonatomic, readonly) BOOL tiledScrollingIndicatorVisible; 43 @property (nonatomic, readonly) BOOL resourceUsageOverlayVisible; 43 44 @property (nonatomic, readonly) BOOL nonFastScrollableRegionOverlayVisible; 44 45 @property (nonatomic, readonly) BOOL wheelEventHandlerRegionOverlayVisible; -
trunk/Tools/MiniBrowser/mac/SettingsController.m
r189513 r191849 36 36 static NSString * const SimpleLineLayoutDebugBordersEnabledPreferenceKey = @"SimpleLineLayoutDebugBordersEnabled"; 37 37 static NSString * const TiledScrollingIndicatorVisiblePreferenceKey = @"TiledScrollingIndicatorVisible"; 38 static NSString * const ResourceUsageOverlayVisiblePreferenceKey = @"ResourceUsageOverlayVisible"; 38 39 static NSString * const IncrementalRenderingSuppressedPreferenceKey = @"IncrementalRenderingSuppressed"; 39 40 static NSString * const AcceleratedDrawingEnabledPreferenceKey = @"AcceleratedDrawingEnabled"; … … 116 117 [self _addItemWithTitle:@"Use UI-Side Compositing" action:@selector(toggleUseUISideCompositing:) indented:YES]; 117 118 [self _addItemWithTitle:@"Disable Per-Window Web Processes" action:@selector(togglePerWindowWebProcessesDisabled:) indented:YES]; 119 [self _addItemWithTitle:@"Show Resource Usage Overlay" action:@selector(toggleShowResourceUsageOverlay:) indented:YES]; 118 120 119 121 NSMenuItem *debugOverlaysSubmenuItem = [[NSMenuItem alloc] initWithTitle:@"Debug Overlays" action:nil keyEquivalent:@""]; … … 159 161 else if (action == @selector(toggleShowTiledScrollingIndicator:)) 160 162 [menuItem setState:[self tiledScrollingIndicatorVisible] ? NSOnState : NSOffState]; 163 else if (action == @selector(toggleShowResourceUsageOverlay:)) 164 [menuItem setState:[self resourceUsageOverlayVisible] ? NSOnState : NSOffState]; 161 165 else if (action == @selector(toggleUseUISideCompositing:)) 162 166 [menuItem setState:[self useUISideCompositing] ? NSOnState : NSOffState]; … … 284 288 } 285 289 290 - (void)toggleShowResourceUsageOverlay:(id)sender 291 { 292 [self _toggleBooleanDefault:ResourceUsageOverlayVisiblePreferenceKey]; 293 } 294 286 295 - (BOOL)tiledScrollingIndicatorVisible 287 296 { 288 297 return [[NSUserDefaults standardUserDefaults] boolForKey:TiledScrollingIndicatorVisiblePreferenceKey]; 298 } 299 300 - (BOOL)resourceUsageOverlayVisible 301 { 302 return [[NSUserDefaults standardUserDefaults] boolForKey:ResourceUsageOverlayVisiblePreferenceKey]; 289 303 } 290 304 -
trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m
r189513 r191849 343 343 preferences._simpleLineLayoutDebugBordersEnabled = settings.simpleLineLayoutDebugBordersEnabled; 344 344 preferences._acceleratedDrawingEnabled = settings.acceleratedDrawingEnabled; 345 preferences._resourceUsageOverlayVisible = settings.resourceUsageOverlayVisible; 345 346 346 347 BOOL useTransparentWindows = settings.useTransparentWindows;
Note: See TracChangeset
for help on using the changeset viewer.