| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 void InspectorTimelineAgent::willPaint(RenderObject* renderer) | 362 void InspectorTimelineAgent::willPaint(RenderObject* renderer) |
| 363 { | 363 { |
| 364 Frame* frame = renderer->frame(); | 364 Frame* frame = renderer->frame(); |
| 365 TRACE_EVENT_INSTANT2("instrumentation", InstrumentationEvents::Paint, | 365 TRACE_EVENT_INSTANT2("instrumentation", InstrumentationEvents::Paint, |
| 366 InstrumentationEventArguments::PageId, reinterpret_cast<unsigned long lo
ng>(frame->page()), | 366 InstrumentationEventArguments::PageId, reinterpret_cast<unsigned long lo
ng>(frame->page()), |
| 367 InstrumentationEventArguments::NodeId, idForNode(renderer->generatingNod
e())); | 367 InstrumentationEventArguments::NodeId, idForNode(renderer->generatingNod
e())); |
| 368 | 368 |
| 369 pushCurrentRecord(InspectorObject::create(), TimelineRecordType::Paint, true
, frame, true); | 369 pushCurrentRecord(InspectorObject::create(), TimelineRecordType::Paint, true
, frame, true); |
| 370 } | 370 } |
| 371 | 371 |
| 372 void InspectorTimelineAgent::willUpdateLayer(int) |
| 373 { |
| 374 enablePlatformInstrumentation(); |
| 375 } |
| 376 |
| 377 void InspectorTimelineAgent::didUpdateLayer() |
| 378 { |
| 379 disablePlatformInstrumentation(); |
| 380 } |
| 381 |
| 372 void InspectorTimelineAgent::didPaint(RenderObject* renderer, GraphicsContext*,
const LayoutRect& clipRect) | 382 void InspectorTimelineAgent::didPaint(RenderObject* renderer, GraphicsContext*,
const LayoutRect& clipRect) |
| 373 { | 383 { |
| 374 TimelineRecordEntry& entry = m_recordStack.last(); | 384 TimelineRecordEntry& entry = m_recordStack.last(); |
| 375 ASSERT(entry.type == TimelineRecordType::Paint); | 385 ASSERT(entry.type == TimelineRecordType::Paint); |
| 376 FloatQuad quad; | 386 FloatQuad quad; |
| 377 localToPageQuad(*renderer, clipRect, &quad); | 387 localToPageQuad(*renderer, clipRect, &quad); |
| 378 entry.data = TimelineRecordFactory::createPaintData(quad, idForNode(renderer
->generatingNode())); | 388 entry.data = TimelineRecordFactory::createPaintData(quad, idForNode(renderer
->generatingNode())); |
| 379 didCompleteCurrentRecord(TimelineRecordType::Paint); | 389 didCompleteCurrentRecord(TimelineRecordType::Paint); |
| 380 } | 390 } |
| 381 | 391 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 402 void InspectorTimelineAgent::willResizeImage(bool shouldCache) | 412 void InspectorTimelineAgent::willResizeImage(bool shouldCache) |
| 403 { | 413 { |
| 404 pushCurrentRecord(TimelineRecordFactory::createResizeImageData(shouldCache),
TimelineRecordType::ResizeImage, true, 0); | 414 pushCurrentRecord(TimelineRecordFactory::createResizeImageData(shouldCache),
TimelineRecordType::ResizeImage, true, 0); |
| 405 } | 415 } |
| 406 | 416 |
| 407 void InspectorTimelineAgent::didResizeImage() | 417 void InspectorTimelineAgent::didResizeImage() |
| 408 { | 418 { |
| 409 didCompleteCurrentRecord(TimelineRecordType::ResizeImage); | 419 didCompleteCurrentRecord(TimelineRecordType::ResizeImage); |
| 410 } | 420 } |
| 411 | 421 |
| 422 void InspectorTimelineAgent::willRasterizeCanvas() |
| 423 { |
| 424 pushCurrentRecord(InspectorObject::create(), TimelineRecordType::Rasterize,
false, 0); |
| 425 } |
| 426 |
| 427 void InspectorTimelineAgent::didRasterizeCanvas() |
| 428 { |
| 429 didCompleteCurrentRecord(TimelineRecordType::Rasterize); |
| 430 } |
| 431 |
| 412 void InspectorTimelineAgent::willComposite() | 432 void InspectorTimelineAgent::willComposite() |
| 413 { | 433 { |
| 414 pushCurrentRecord(InspectorObject::create(), TimelineRecordType::CompositeLa
yers, false, 0); | 434 pushCurrentRecord(InspectorObject::create(), TimelineRecordType::CompositeLa
yers, false, 0); |
| 415 } | 435 } |
| 416 | 436 |
| 417 void InspectorTimelineAgent::didComposite() | 437 void InspectorTimelineAgent::didComposite() |
| 418 { | 438 { |
| 419 didCompleteCurrentRecord(TimelineRecordType::CompositeLayers); | 439 didCompleteCurrentRecord(TimelineRecordType::CompositeLayers); |
| 420 } | 440 } |
| 421 | 441 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 if (frame && m_pageAgent) | 725 if (frame && m_pageAgent) |
| 706 frameId = m_pageAgent->frameId(frame); | 726 frameId = m_pageAgent->frameId(frame); |
| 707 record->setString("frameId", frameId); | 727 record->setString("frameId", frameId); |
| 708 } | 728 } |
| 709 | 729 |
| 710 void InspectorTimelineAgent::didCompleteCurrentRecord(const String& type) | 730 void InspectorTimelineAgent::didCompleteCurrentRecord(const String& type) |
| 711 { | 731 { |
| 712 // An empty stack could merely mean that the timeline agent was turned on in
the middle of | 732 // An empty stack could merely mean that the timeline agent was turned on in
the middle of |
| 713 // an event. Don't treat as an error. | 733 // an event. Don't treat as an error. |
| 714 if (!m_recordStack.isEmpty()) { | 734 if (!m_recordStack.isEmpty()) { |
| 715 if (m_platformInstrumentationClientInstalledAtStackDepth == m_recordStac
k.size()) { | 735 disablePlatformInstrumentation(); |
| 716 m_platformInstrumentationClientInstalledAtStackDepth = 0; | |
| 717 PlatformInstrumentation::setClient(0); | |
| 718 } | |
| 719 | 736 |
| 720 pushGCEventRecords(); | 737 pushGCEventRecords(); |
| 721 TimelineRecordEntry entry = m_recordStack.last(); | 738 TimelineRecordEntry entry = m_recordStack.last(); |
| 722 m_recordStack.removeLast(); | 739 m_recordStack.removeLast(); |
| 723 ASSERT(entry.type == type); | 740 ASSERT(entry.type == type); |
| 724 entry.record->setObject("data", entry.data); | 741 entry.record->setObject("data", entry.data); |
| 725 entry.record->setArray("children", entry.children); | 742 entry.record->setArray("children", entry.children); |
| 726 entry.record->setNumber("endTime", timestamp()); | 743 entry.record->setNumber("endTime", timestamp()); |
| 727 size_t usedHeapSizeDelta = getUsedHeapSize() - entry.usedHeapSizeAtStart
; | 744 size_t usedHeapSizeDelta = getUsedHeapSize() - entry.usedHeapSizeAtStart
; |
| 728 if (usedHeapSizeDelta) | 745 if (usedHeapSizeDelta) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 m_frontend->eventRecorded(recordChecked.release()); | 780 m_frontend->eventRecorded(recordChecked.release()); |
| 764 } | 781 } |
| 765 | 782 |
| 766 void InspectorTimelineAgent::pushCurrentRecord(PassRefPtr<InspectorObject> data,
const String& type, bool captureCallStack, Frame* frame, bool hasLowLevelDetail
s) | 783 void InspectorTimelineAgent::pushCurrentRecord(PassRefPtr<InspectorObject> data,
const String& type, bool captureCallStack, Frame* frame, bool hasLowLevelDetail
s) |
| 767 { | 784 { |
| 768 pushGCEventRecords(); | 785 pushGCEventRecords(); |
| 769 commitFrameRecord(); | 786 commitFrameRecord(); |
| 770 RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(
timestamp(), captureCallStack ? m_maxCallStackDepth : 0, type); | 787 RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(
timestamp(), captureCallStack ? m_maxCallStackDepth : 0, type); |
| 771 setFrameIdentifier(record.get(), frame); | 788 setFrameIdentifier(record.get(), frame); |
| 772 m_recordStack.append(TimelineRecordEntry(record.release(), data, InspectorAr
ray::create(), type, getUsedHeapSize())); | 789 m_recordStack.append(TimelineRecordEntry(record.release(), data, InspectorAr
ray::create(), type, getUsedHeapSize())); |
| 773 if (hasLowLevelDetails && !m_platformInstrumentationClientInstalledAtStackDe
pth && !PlatformInstrumentation::hasClient()) { | 790 if (hasLowLevelDetails) |
| 774 m_platformInstrumentationClientInstalledAtStackDepth = m_recordStack.siz
e(); | 791 enablePlatformInstrumentation(); |
| 775 PlatformInstrumentation::setClient(this); | 792 } |
| 793 |
| 794 void InspectorTimelineAgent::enablePlatformInstrumentation() |
| 795 { |
| 796 if (m_platformInstrumentationClientInstalledAtStackDepth || PlatformInstrume
ntation::hasClient()) |
| 797 return; |
| 798 m_platformInstrumentationClientInstalledAtStackDepth = m_recordStack.size(); |
| 799 PlatformInstrumentation::setClient(this); |
| 800 } |
| 801 |
| 802 void InspectorTimelineAgent::disablePlatformInstrumentation() |
| 803 { |
| 804 if (m_platformInstrumentationClientInstalledAtStackDepth == m_recordStack.si
ze()) { |
| 805 m_platformInstrumentationClientInstalledAtStackDepth = 0; |
| 806 PlatformInstrumentation::setClient(0); |
| 776 } | 807 } |
| 777 } | 808 } |
| 778 | 809 |
| 779 void InspectorTimelineAgent::commitFrameRecord() | 810 void InspectorTimelineAgent::commitFrameRecord() |
| 780 { | 811 { |
| 781 if (!m_pendingFrameRecord) | 812 if (!m_pendingFrameRecord) |
| 782 return; | 813 return; |
| 783 | 814 |
| 784 m_pendingFrameRecord->setObject("data", InspectorObject::create()); | 815 m_pendingFrameRecord->setObject("data", InspectorObject::create()); |
| 785 innerAddRecordToTimeline(m_pendingFrameRecord.release()); | 816 innerAddRecordToTimeline(m_pendingFrameRecord.release()); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 return m_timeConverter.fromMonotonicallyIncreasingTime(WTF::monotonicallyInc
reasingTime()); | 855 return m_timeConverter.fromMonotonicallyIncreasingTime(WTF::monotonicallyInc
reasingTime()); |
| 825 } | 856 } |
| 826 | 857 |
| 827 Page* InspectorTimelineAgent::page() | 858 Page* InspectorTimelineAgent::page() |
| 828 { | 859 { |
| 829 return m_pageAgent ? m_pageAgent->page() : 0; | 860 return m_pageAgent ? m_pageAgent->page() : 0; |
| 830 } | 861 } |
| 831 | 862 |
| 832 } // namespace WebCore | 863 } // namespace WebCore |
| 833 | 864 |
| OLD | NEW |