| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "core/inspector/InspectorInstrumentation.h" | 45 #include "core/inspector/InspectorInstrumentation.h" |
| 46 #include "core/inspector/InspectorLayerTreeAgent.h" | 46 #include "core/inspector/InspectorLayerTreeAgent.h" |
| 47 #include "core/inspector/InspectorNodeIds.h" | 47 #include "core/inspector/InspectorNodeIds.h" |
| 48 #include "core/inspector/InspectorOverlay.h" | 48 #include "core/inspector/InspectorOverlay.h" |
| 49 #include "core/inspector/InspectorPageAgent.h" | 49 #include "core/inspector/InspectorPageAgent.h" |
| 50 #include "core/inspector/InspectorState.h" | 50 #include "core/inspector/InspectorState.h" |
| 51 #include "core/inspector/InstrumentingAgents.h" | 51 #include "core/inspector/InstrumentingAgents.h" |
| 52 #include "core/inspector/ScriptCallStack.h" | 52 #include "core/inspector/ScriptCallStack.h" |
| 53 #include "core/inspector/TimelineRecordFactory.h" | 53 #include "core/inspector/TimelineRecordFactory.h" |
| 54 #include "core/inspector/TraceEventDispatcher.h" | 54 #include "core/inspector/TraceEventDispatcher.h" |
| 55 #include "core/layout/LayoutObject.h" |
| 55 #include "core/loader/DocumentLoader.h" | 56 #include "core/loader/DocumentLoader.h" |
| 56 #include "core/page/Page.h" | 57 #include "core/page/Page.h" |
| 57 #include "core/rendering/RenderObject.h" | |
| 58 #include "core/rendering/RenderView.h" | 58 #include "core/rendering/RenderView.h" |
| 59 #include "core/xmlhttprequest/XMLHttpRequest.h" | 59 #include "core/xmlhttprequest/XMLHttpRequest.h" |
| 60 #include "platform/TraceEvent.h" | 60 #include "platform/TraceEvent.h" |
| 61 #include "platform/graphics/DeferredImageDecoder.h" | 61 #include "platform/graphics/DeferredImageDecoder.h" |
| 62 #include "platform/graphics/GraphicsLayer.h" | 62 #include "platform/graphics/GraphicsLayer.h" |
| 63 #include "platform/network/ResourceRequest.h" | 63 #include "platform/network/ResourceRequest.h" |
| 64 #include "wtf/CurrentTime.h" | 64 #include "wtf/CurrentTime.h" |
| 65 #include "wtf/DateMath.h" | 65 #include "wtf/DateMath.h" |
| 66 | 66 |
| 67 namespace blink { | 67 namespace blink { |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 { | 531 { |
| 532 bool isPartial; | 532 bool isPartial; |
| 533 unsigned needsLayoutObjects; | 533 unsigned needsLayoutObjects; |
| 534 unsigned totalObjects; | 534 unsigned totalObjects; |
| 535 frame->countObjectsNeedingLayout(needsLayoutObjects, totalObjects, isPartial
); | 535 frame->countObjectsNeedingLayout(needsLayoutObjects, totalObjects, isPartial
); |
| 536 | 536 |
| 537 pushCurrentRecord(TimelineRecordFactory::createLayoutData(needsLayoutObjects
, totalObjects, isPartial), TimelineRecordType::Layout, true, frame); | 537 pushCurrentRecord(TimelineRecordFactory::createLayoutData(needsLayoutObjects
, totalObjects, isPartial), TimelineRecordType::Layout, true, frame); |
| 538 return true; | 538 return true; |
| 539 } | 539 } |
| 540 | 540 |
| 541 void InspectorTimelineAgent::didLayout(RenderObject* root) | 541 void InspectorTimelineAgent::didLayout(LayoutObject* root) |
| 542 { | 542 { |
| 543 if (m_recordStack.isEmpty()) | 543 if (m_recordStack.isEmpty()) |
| 544 return; | 544 return; |
| 545 TimelineRecordEntry& entry = m_recordStack.last(); | 545 TimelineRecordEntry& entry = m_recordStack.last(); |
| 546 ASSERT(entry.type == TimelineRecordType::Layout); | 546 ASSERT(entry.type == TimelineRecordType::Layout); |
| 547 Vector<FloatQuad> quads; | 547 Vector<FloatQuad> quads; |
| 548 root->absoluteQuads(quads); | 548 root->absoluteQuads(quads); |
| 549 if (quads.size() >= 1) | 549 if (quads.size() >= 1) |
| 550 TimelineRecordFactory::setLayoutRoot(entry.data.get(), quads[0], nodeId(
root)); | 550 TimelineRecordFactory::setLayoutRoot(entry.data.get(), quads[0], nodeId(
root)); |
| 551 else | 551 else |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 void InspectorTimelineAgent::didRecalculateStyle(int elementCount) | 589 void InspectorTimelineAgent::didRecalculateStyle(int elementCount) |
| 590 { | 590 { |
| 591 if (m_recordStack.isEmpty()) | 591 if (m_recordStack.isEmpty()) |
| 592 return; | 592 return; |
| 593 TimelineRecordEntry& entry = m_recordStack.last(); | 593 TimelineRecordEntry& entry = m_recordStack.last(); |
| 594 ASSERT(entry.type == TimelineRecordType::RecalculateStyles); | 594 ASSERT(entry.type == TimelineRecordType::RecalculateStyles); |
| 595 TimelineRecordFactory::setStyleRecalcDetails(entry.data.get(), elementCount)
; | 595 TimelineRecordFactory::setStyleRecalcDetails(entry.data.get(), elementCount)
; |
| 596 didCompleteCurrentRecord(TimelineRecordType::RecalculateStyles); | 596 didCompleteCurrentRecord(TimelineRecordType::RecalculateStyles); |
| 597 } | 597 } |
| 598 | 598 |
| 599 void InspectorTimelineAgent::willPaint(RenderObject* renderer, const GraphicsLay
er* graphicsLayer) | 599 void InspectorTimelineAgent::willPaint(LayoutObject* renderer, const GraphicsLay
er* graphicsLayer) |
| 600 { | 600 { |
| 601 LocalFrame* frame = renderer->frame(); | 601 LocalFrame* frame = renderer->frame(); |
| 602 | 602 |
| 603 TraceEventDispatcher::instance()->processBackgroundEvents(); | 603 TraceEventDispatcher::instance()->processBackgroundEvents(); |
| 604 double paintSetupStart = m_paintSetupStart; | 604 double paintSetupStart = m_paintSetupStart; |
| 605 m_paintSetupStart = 0; | 605 m_paintSetupStart = 0; |
| 606 if (graphicsLayer) { | 606 if (graphicsLayer) { |
| 607 int layerIdentifier = graphicsLayer->platformLayer()->id(); | 607 int layerIdentifier = graphicsLayer->platformLayer()->id(); |
| 608 int nodeIdentifier = nodeId(renderer); | 608 int nodeIdentifier = nodeId(renderer); |
| 609 ASSERT(layerIdentifier && nodeIdentifier); | 609 ASSERT(layerIdentifier && nodeIdentifier); |
| 610 m_layerToNodeMap.set(layerIdentifier, nodeIdentifier); | 610 m_layerToNodeMap.set(layerIdentifier, nodeIdentifier); |
| 611 if (paintSetupStart) { | 611 if (paintSetupStart) { |
| 612 RefPtr<TimelineEvent> paintSetupRecord = TimelineRecordFactory::crea
teGenericRecord(paintSetupStart, 0, TimelineRecordType::PaintSetup, TimelineReco
rdFactory::createLayerData(nodeIdentifier)); | 612 RefPtr<TimelineEvent> paintSetupRecord = TimelineRecordFactory::crea
teGenericRecord(paintSetupStart, 0, TimelineRecordType::PaintSetup, TimelineReco
rdFactory::createLayerData(nodeIdentifier)); |
| 613 paintSetupRecord->setEndTime(m_paintSetupEnd); | 613 paintSetupRecord->setEndTime(m_paintSetupEnd); |
| 614 addRecordToTimeline(paintSetupRecord, paintSetupStart); | 614 addRecordToTimeline(paintSetupRecord, paintSetupStart); |
| 615 } | 615 } |
| 616 } | 616 } |
| 617 pushCurrentRecord(JSONObject::create(), TimelineRecordType::Paint, true, fra
me, true); | 617 pushCurrentRecord(JSONObject::create(), TimelineRecordType::Paint, true, fra
me, true); |
| 618 } | 618 } |
| 619 | 619 |
| 620 void InspectorTimelineAgent::didPaint(RenderObject* renderer, const GraphicsLaye
r* graphicsLayer, GraphicsContext*, const LayoutRect& clipRect) | 620 void InspectorTimelineAgent::didPaint(LayoutObject* renderer, const GraphicsLaye
r* graphicsLayer, GraphicsContext*, const LayoutRect& clipRect) |
| 621 { | 621 { |
| 622 TimelineRecordEntry& entry = m_recordStack.last(); | 622 TimelineRecordEntry& entry = m_recordStack.last(); |
| 623 ASSERT(entry.type == TimelineRecordType::Paint); | 623 ASSERT(entry.type == TimelineRecordType::Paint); |
| 624 FloatQuad quad; | 624 FloatQuad quad; |
| 625 localToPageQuad(*renderer, clipRect, &quad); | 625 localToPageQuad(*renderer, clipRect, &quad); |
| 626 int graphicsLayerId = graphicsLayer ? graphicsLayer->platformLayer()->id() :
0; | 626 int graphicsLayerId = graphicsLayer ? graphicsLayer->platformLayer()->id() :
0; |
| 627 TimelineRecordFactory::setPaintData(entry.data.get(), quad, nodeId(renderer)
, graphicsLayerId); | 627 TimelineRecordFactory::setPaintData(entry.data.get(), quad, nodeId(renderer)
, graphicsLayerId); |
| 628 didCompleteCurrentRecord(TimelineRecordType::Paint); | 628 didCompleteCurrentRecord(TimelineRecordType::Paint); |
| 629 if (m_mayEmitFirstPaint && !graphicsLayer) { | 629 if (m_mayEmitFirstPaint && !graphicsLayer) { |
| 630 m_mayEmitFirstPaint = false; | 630 m_mayEmitFirstPaint = false; |
| 631 appendRecord(JSONObject::create(), TimelineRecordType::MarkFirstPaint, f
alse, 0); | 631 appendRecord(JSONObject::create(), TimelineRecordType::MarkFirstPaint, f
alse, 0); |
| 632 } | 632 } |
| 633 } | 633 } |
| 634 | 634 |
| 635 void InspectorTimelineAgent::willPaintImage(RenderImage* renderImage) | 635 void InspectorTimelineAgent::willPaintImage(RenderImage* renderImage) |
| 636 { | 636 { |
| 637 ASSERT(!m_imageBeingPainted); | 637 ASSERT(!m_imageBeingPainted); |
| 638 m_imageBeingPainted = renderImage; | 638 m_imageBeingPainted = renderImage; |
| 639 } | 639 } |
| 640 | 640 |
| 641 void InspectorTimelineAgent::didPaintImage() | 641 void InspectorTimelineAgent::didPaintImage() |
| 642 { | 642 { |
| 643 m_imageBeingPainted = 0; | 643 m_imageBeingPainted = 0; |
| 644 } | 644 } |
| 645 | 645 |
| 646 void InspectorTimelineAgent::willScrollLayer(RenderObject* renderer) | 646 void InspectorTimelineAgent::willScrollLayer(LayoutObject* renderer) |
| 647 { | 647 { |
| 648 pushCurrentRecord(TimelineRecordFactory::createLayerData(nodeId(renderer)),
TimelineRecordType::ScrollLayer, false, renderer->frame()); | 648 pushCurrentRecord(TimelineRecordFactory::createLayerData(nodeId(renderer)),
TimelineRecordType::ScrollLayer, false, renderer->frame()); |
| 649 } | 649 } |
| 650 | 650 |
| 651 void InspectorTimelineAgent::didScrollLayer() | 651 void InspectorTimelineAgent::didScrollLayer() |
| 652 { | 652 { |
| 653 didCompleteCurrentRecord(TimelineRecordType::ScrollLayer); | 653 didCompleteCurrentRecord(TimelineRecordType::ScrollLayer); |
| 654 } | 654 } |
| 655 | 655 |
| 656 void InspectorTimelineAgent::willDecodeImage(const String& imageType) | 656 void InspectorTimelineAgent::willDecodeImage(const String& imageType) |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 { | 1251 { |
| 1252 if (m_platformInstrumentationClientInstalledAtStackDepth) { | 1252 if (m_platformInstrumentationClientInstalledAtStackDepth) { |
| 1253 m_platformInstrumentationClientInstalledAtStackDepth = 0; | 1253 m_platformInstrumentationClientInstalledAtStackDepth = 0; |
| 1254 PlatformInstrumentation::setClient(0); | 1254 PlatformInstrumentation::setClient(0); |
| 1255 } | 1255 } |
| 1256 m_pendingFrameRecord.clear(); | 1256 m_pendingFrameRecord.clear(); |
| 1257 m_recordStack.clear(); | 1257 m_recordStack.clear(); |
| 1258 m_id++; | 1258 m_id++; |
| 1259 } | 1259 } |
| 1260 | 1260 |
| 1261 void InspectorTimelineAgent::localToPageQuad(const RenderObject& renderer, const
LayoutRect& rect, FloatQuad* quad) | 1261 void InspectorTimelineAgent::localToPageQuad(const LayoutObject& renderer, const
LayoutRect& rect, FloatQuad* quad) |
| 1262 { | 1262 { |
| 1263 LocalFrame* frame = renderer.frame(); | 1263 LocalFrame* frame = renderer.frame(); |
| 1264 FrameView* view = frame->view(); | 1264 FrameView* view = frame->view(); |
| 1265 FloatQuad absolute = renderer.localToAbsoluteQuad(FloatQuad(rect)); | 1265 FloatQuad absolute = renderer.localToAbsoluteQuad(FloatQuad(rect)); |
| 1266 quad->setP1(view->contentsToRootView(roundedIntPoint(absolute.p1()))); | 1266 quad->setP1(view->contentsToRootView(roundedIntPoint(absolute.p1()))); |
| 1267 quad->setP2(view->contentsToRootView(roundedIntPoint(absolute.p2()))); | 1267 quad->setP2(view->contentsToRootView(roundedIntPoint(absolute.p2()))); |
| 1268 quad->setP3(view->contentsToRootView(roundedIntPoint(absolute.p3()))); | 1268 quad->setP3(view->contentsToRootView(roundedIntPoint(absolute.p3()))); |
| 1269 quad->setP4(view->contentsToRootView(roundedIntPoint(absolute.p4()))); | 1269 quad->setP4(view->contentsToRootView(roundedIntPoint(absolute.p4()))); |
| 1270 } | 1270 } |
| 1271 | 1271 |
| 1272 long long InspectorTimelineAgent::nodeId(Node* node) | 1272 long long InspectorTimelineAgent::nodeId(Node* node) |
| 1273 { | 1273 { |
| 1274 return node ? InspectorNodeIds::idForNode(node) : 0; | 1274 return node ? InspectorNodeIds::idForNode(node) : 0; |
| 1275 } | 1275 } |
| 1276 | 1276 |
| 1277 long long InspectorTimelineAgent::nodeId(RenderObject* renderer) | 1277 long long InspectorTimelineAgent::nodeId(LayoutObject* renderer) |
| 1278 { | 1278 { |
| 1279 return InspectorNodeIds::idForNode(renderer->generatingNode()); | 1279 return InspectorNodeIds::idForNode(renderer->generatingNode()); |
| 1280 } | 1280 } |
| 1281 | 1281 |
| 1282 double InspectorTimelineAgent::timestamp() | 1282 double InspectorTimelineAgent::timestamp() |
| 1283 { | 1283 { |
| 1284 return WTF::monotonicallyIncreasingTime() * msPerSecond; | 1284 return WTF::monotonicallyIncreasingTime() * msPerSecond; |
| 1285 } | 1285 } |
| 1286 | 1286 |
| 1287 LocalFrame* InspectorTimelineAgent::inspectedFrame() const | 1287 LocalFrame* InspectorTimelineAgent::inspectedFrame() const |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 { | 1349 { |
| 1350 visitor->trace(m_timelineAgent); | 1350 visitor->trace(m_timelineAgent); |
| 1351 } | 1351 } |
| 1352 | 1352 |
| 1353 void TimelineThreadState::trace(Visitor* visitor) | 1353 void TimelineThreadState::trace(Visitor* visitor) |
| 1354 { | 1354 { |
| 1355 visitor->trace(recordStack); | 1355 visitor->trace(recordStack); |
| 1356 } | 1356 } |
| 1357 | 1357 |
| 1358 } // namespace blink | 1358 } // namespace blink |
| OLD | NEW |