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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 return true; | 249 return true; |
250 | 250 |
251 for (size_t i = 0; i < eventPath.size(); i++) { | 251 for (size_t i = 0; i < eventPath.size(); i++) { |
252 if (eventPath[i].node()->hasEventListeners(eventType)) | 252 if (eventPath[i].node()->hasEventListeners(eventType)) |
253 return true; | 253 return true; |
254 } | 254 } |
255 | 255 |
256 return false; | 256 return false; |
257 } | 257 } |
258 | 258 |
259 void TimelineTimeConverter::reset() | |
260 { | |
261 m_startOffset = monotonicallyIncreasingTime() - currentTime(); | |
pfeldman
2014/03/27 13:26:57
I am not sure what this gives you. Either wall or
| |
262 } | |
263 | |
264 void InspectorTimelineAgent::pushGCEventRecords() | 259 void InspectorTimelineAgent::pushGCEventRecords() |
265 { | 260 { |
266 if (!m_gcEvents.size()) | 261 if (!m_gcEvents.size()) |
267 return; | 262 return; |
268 | 263 |
269 GCEvents events = m_gcEvents; | 264 GCEvents events = m_gcEvents; |
270 m_gcEvents.clear(); | 265 m_gcEvents.clear(); |
271 for (GCEvents::iterator i = events.begin(); i != events.end(); ++i) { | 266 for (GCEvents::iterator i = events.begin(); i != events.end(); ++i) { |
272 RefPtr<TimelineEvent> record = TimelineRecordFactory::createGenericRecor d(m_timeConverter.fromMonotonicallyIncreasingTime(i->startTime), m_maxCallStackD epth, TimelineRecordType::GCEvent, TimelineRecordFactory::createGCEventData(i->c ollectedBytes)); | 267 RefPtr<TimelineEvent> record = TimelineRecordFactory::createGenericRecor d(toTimelineTimestamp(i->startTime), m_maxCallStackDepth, TimelineRecordType::GC Event, TimelineRecordFactory::createGCEventData(i->collectedBytes)); |
273 record->setEndTime(m_timeConverter.fromMonotonicallyIncreasingTime(i->en dTime)); | 268 record->setEndTime(toTimelineTimestamp(i->endTime)); |
274 addRecordToTimeline(record.release()); | 269 addRecordToTimeline(record.release()); |
275 } | 270 } |
276 } | 271 } |
277 | 272 |
278 void InspectorTimelineAgent::didGC(double startTime, double endTime, size_t coll ectedBytesCount) | 273 void InspectorTimelineAgent::didGC(double startTime, double endTime, size_t coll ectedBytesCount) |
279 { | 274 { |
280 m_gcEvents.append(TimelineGCEvent(startTime, endTime, collectedBytesCount)); | 275 m_gcEvents.append(TimelineGCEvent(startTime, endTime, collectedBytesCount)); |
281 } | 276 } |
282 | 277 |
283 InspectorTimelineAgent::~InspectorTimelineAgent() | 278 InspectorTimelineAgent::~InspectorTimelineAgent() |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
357 bool InspectorTimelineAgent::isStarted() | 352 bool InspectorTimelineAgent::isStarted() |
358 { | 353 { |
359 return m_state->getBoolean(TimelineAgentState::started); | 354 return m_state->getBoolean(TimelineAgentState::started); |
360 } | 355 } |
361 | 356 |
362 void InspectorTimelineAgent::innerStart() | 357 void InspectorTimelineAgent::innerStart() |
363 { | 358 { |
364 if (m_overlay) | 359 if (m_overlay) |
365 m_overlay->startedRecordingProfile(); | 360 m_overlay->startedRecordingProfile(); |
366 m_state->setBoolean(TimelineAgentState::started, true); | 361 m_state->setBoolean(TimelineAgentState::started, true); |
367 m_timeConverter.reset(); | |
368 m_instrumentingAgents->setInspectorTimelineAgent(this); | 362 m_instrumentingAgents->setInspectorTimelineAgent(this); |
369 ScriptGCEvent::addEventListener(this); | 363 ScriptGCEvent::addEventListener(this); |
370 if (m_client) { | 364 if (m_client) { |
371 TraceEventDispatcher* dispatcher = TraceEventDispatcher::instance(); | 365 TraceEventDispatcher* dispatcher = TraceEventDispatcher::instance(); |
372 dispatcher->addListener(InstrumentationEvents::BeginFrame, TRACE_EVENT_P HASE_INSTANT, this, &InspectorTimelineAgent::onBeginImplSideFrame, m_client); | 366 dispatcher->addListener(InstrumentationEvents::BeginFrame, TRACE_EVENT_P HASE_INSTANT, this, &InspectorTimelineAgent::onBeginImplSideFrame, m_client); |
373 dispatcher->addListener(InstrumentationEvents::PaintSetup, TRACE_EVENT_P HASE_BEGIN, this, &InspectorTimelineAgent::onPaintSetupBegin, m_client); | 367 dispatcher->addListener(InstrumentationEvents::PaintSetup, TRACE_EVENT_P HASE_BEGIN, this, &InspectorTimelineAgent::onPaintSetupBegin, m_client); |
374 dispatcher->addListener(InstrumentationEvents::PaintSetup, TRACE_EVENT_P HASE_END, this, &InspectorTimelineAgent::onPaintSetupEnd, m_client); | 368 dispatcher->addListener(InstrumentationEvents::PaintSetup, TRACE_EVENT_P HASE_END, this, &InspectorTimelineAgent::onPaintSetupEnd, m_client); |
375 dispatcher->addListener(InstrumentationEvents::RasterTask, TRACE_EVENT_P HASE_BEGIN, this, &InspectorTimelineAgent::onRasterTaskBegin, m_client); | 369 dispatcher->addListener(InstrumentationEvents::RasterTask, TRACE_EVENT_P HASE_BEGIN, this, &InspectorTimelineAgent::onRasterTaskBegin, m_client); |
376 dispatcher->addListener(InstrumentationEvents::RasterTask, TRACE_EVENT_P HASE_END, this, &InspectorTimelineAgent::onRasterTaskEnd, m_client); | 370 dispatcher->addListener(InstrumentationEvents::RasterTask, TRACE_EVENT_P HASE_END, this, &InspectorTimelineAgent::onRasterTaskEnd, m_client); |
377 dispatcher->addListener(InstrumentationEvents::Layer, TRACE_EVENT_PHASE_ DELETE_OBJECT, this, &InspectorTimelineAgent::onLayerDeleted, m_client); | 371 dispatcher->addListener(InstrumentationEvents::Layer, TRACE_EVENT_PHASE_ DELETE_OBJECT, this, &InspectorTimelineAgent::onLayerDeleted, m_client); |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
758 } | 752 } |
759 | 753 |
760 void InspectorTimelineAgent::didReceiveResourceResponse(LocalFrame* frame, unsig ned long identifier, DocumentLoader* loader, const ResourceResponse& response, R esourceLoader* resourceLoader) | 754 void InspectorTimelineAgent::didReceiveResourceResponse(LocalFrame* frame, unsig ned long identifier, DocumentLoader* loader, const ResourceResponse& response, R esourceLoader* resourceLoader) |
761 { | 755 { |
762 String requestId = IdentifiersFactory::requestId(identifier); | 756 String requestId = IdentifiersFactory::requestId(identifier); |
763 appendRecord(TimelineRecordFactory::createResourceReceiveResponseData(reques tId, response), TimelineRecordType::ResourceReceiveResponse, false, 0); | 757 appendRecord(TimelineRecordFactory::createResourceReceiveResponseData(reques tId, response), TimelineRecordType::ResourceReceiveResponse, false, 0); |
764 } | 758 } |
765 | 759 |
766 void InspectorTimelineAgent::didFinishLoadingResource(unsigned long identifier, bool didFail, double finishTime) | 760 void InspectorTimelineAgent::didFinishLoadingResource(unsigned long identifier, bool didFail, double finishTime) |
767 { | 761 { |
768 appendRecord(TimelineRecordFactory::createResourceFinishData(IdentifiersFact ory::requestId(identifier), didFail, finishTime * 1000), TimelineRecordType::Res ourceFinish, false, 0); | 762 appendRecord(TimelineRecordFactory::createResourceFinishData(IdentifiersFact ory::requestId(identifier), didFail, finishTime), TimelineRecordType::ResourceFi nish, false, 0); |
769 } | 763 } |
770 | 764 |
771 void InspectorTimelineAgent::didFinishLoading(unsigned long identifier, Document Loader* loader, double monotonicFinishTime, int64_t) | 765 void InspectorTimelineAgent::didFinishLoading(unsigned long identifier, Document Loader* loader, double monotonicFinishTime, int64_t) |
772 { | 766 { |
773 double finishTime = 0.0; | 767 didFinishLoadingResource(identifier, false, toTimelineTimestamp(monotonicFin ishTime)); |
774 // FIXME: Expose all of the timing details to inspector and have it calculat e finishTime. | |
775 if (monotonicFinishTime) | |
776 finishTime = loader->timing()->monotonicTimeToPseudoWallTime(monotonicFi nishTime); | |
777 | |
778 didFinishLoadingResource(identifier, false, finishTime); | |
779 } | 768 } |
780 | 769 |
781 void InspectorTimelineAgent::didFailLoading(unsigned long identifier, const Reso urceError& error) | 770 void InspectorTimelineAgent::didFailLoading(unsigned long identifier, const Reso urceError& error) |
782 { | 771 { |
783 didFinishLoadingResource(identifier, true, 0); | 772 didFinishLoadingResource(identifier, true, 0); |
784 } | 773 } |
785 | 774 |
786 void InspectorTimelineAgent::consoleTimeStamp(ExecutionContext* context, const S tring& title) | 775 void InspectorTimelineAgent::consoleTimeStamp(ExecutionContext* context, const S tring& title) |
787 { | 776 { |
788 appendRecord(TimelineRecordFactory::createTimeStampData(title), TimelineReco rdType::TimeStamp, true, frameForExecutionContext(context)); | 777 appendRecord(TimelineRecordFactory::createTimeStampData(title), TimelineReco rdType::TimeStamp, true, frameForExecutionContext(context)); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
918 unsigned long long layerTreeId = event.asUInt(InstrumentationEventArguments: :LayerTreeId); | 907 unsigned long long layerTreeId = event.asUInt(InstrumentationEventArguments: :LayerTreeId); |
919 if (layerTreeId != m_layerTreeId) | 908 if (layerTreeId != m_layerTreeId) |
920 return; | 909 return; |
921 TimelineThreadState& state = threadState(event.threadIdentifier()); | 910 TimelineThreadState& state = threadState(event.threadIdentifier()); |
922 state.recordStack.addInstantRecord(createRecordForEvent(event, TimelineRecor dType::BeginFrame, JSONObject::create())); | 911 state.recordStack.addInstantRecord(createRecordForEvent(event, TimelineRecor dType::BeginFrame, JSONObject::create())); |
923 } | 912 } |
924 | 913 |
925 void InspectorTimelineAgent::onPaintSetupBegin(const TraceEventDispatcher::Trace Event& event) | 914 void InspectorTimelineAgent::onPaintSetupBegin(const TraceEventDispatcher::Trace Event& event) |
926 { | 915 { |
927 ASSERT(!m_paintSetupStart); | 916 ASSERT(!m_paintSetupStart); |
928 m_paintSetupStart = m_timeConverter.fromMonotonicallyIncreasingTime(event.ti mestamp()); | 917 m_paintSetupStart = toTimelineTimestamp(event.timestamp()); |
929 } | 918 } |
930 | 919 |
931 void InspectorTimelineAgent::onPaintSetupEnd(const TraceEventDispatcher::TraceEv ent& event) | 920 void InspectorTimelineAgent::onPaintSetupEnd(const TraceEventDispatcher::TraceEv ent& event) |
932 { | 921 { |
933 ASSERT(m_paintSetupStart); | 922 ASSERT(m_paintSetupStart); |
934 m_paintSetupEnd = m_timeConverter.fromMonotonicallyIncreasingTime(event.time stamp()); | 923 m_paintSetupEnd = toTimelineTimestamp(event.timestamp()); |
935 } | 924 } |
936 | 925 |
937 void InspectorTimelineAgent::onRasterTaskBegin(const TraceEventDispatcher::Trace Event& event) | 926 void InspectorTimelineAgent::onRasterTaskBegin(const TraceEventDispatcher::Trace Event& event) |
938 { | 927 { |
939 TimelineThreadState& state = threadState(event.threadIdentifier()); | 928 TimelineThreadState& state = threadState(event.threadIdentifier()); |
940 unsigned long long layerId = event.asUInt(InstrumentationEventArguments::Lay erId); | 929 unsigned long long layerId = event.asUInt(InstrumentationEventArguments::Lay erId); |
941 ASSERT(layerId); | 930 ASSERT(layerId); |
942 if (!m_layerToNodeMap.contains(layerId)) | 931 if (!m_layerToNodeMap.contains(layerId)) |
943 return; | 932 return; |
944 ASSERT(!state.inKnownLayerTask); | 933 ASSERT(!state.inKnownLayerTask); |
945 state.inKnownLayerTask = true; | 934 state.inKnownLayerTask = true; |
946 double timestamp = m_timeConverter.fromMonotonicallyIncreasingTime(event.tim estamp()); | 935 double timestamp = toTimelineTimestamp(event.timestamp()); |
947 RefPtr<JSONObject> data = TimelineRecordFactory::createLayerData(m_layerToNo deMap.get(layerId)); | 936 RefPtr<JSONObject> data = TimelineRecordFactory::createLayerData(m_layerToNo deMap.get(layerId)); |
948 RefPtr<TimelineEvent> record = TimelineRecordFactory::createBackgroundRecord (timestamp, String::number(event.threadIdentifier()), TimelineRecordType::Raster ize, data); | 937 RefPtr<TimelineEvent> record = TimelineRecordFactory::createBackgroundRecord (timestamp, String::number(event.threadIdentifier()), TimelineRecordType::Raster ize, data); |
949 state.recordStack.addScopedRecord(record, TimelineRecordType::Rasterize); | 938 state.recordStack.addScopedRecord(record, TimelineRecordType::Rasterize); |
950 } | 939 } |
951 | 940 |
952 void InspectorTimelineAgent::onRasterTaskEnd(const TraceEventDispatcher::TraceEv ent& event) | 941 void InspectorTimelineAgent::onRasterTaskEnd(const TraceEventDispatcher::TraceEv ent& event) |
953 { | 942 { |
954 TimelineThreadState& state = threadState(event.threadIdentifier()); | 943 TimelineThreadState& state = threadState(event.threadIdentifier()); |
955 if (!state.inKnownLayerTask) | 944 if (!state.inKnownLayerTask) |
956 return; | 945 return; |
957 ASSERT(state.recordStack.isOpenRecordOfType(TimelineRecordType::Rasterize)); | 946 ASSERT(state.recordStack.isOpenRecordOfType(TimelineRecordType::Rasterize)); |
958 state.recordStack.closeScopedRecord(m_timeConverter.fromMonotonicallyIncreas ingTime(event.timestamp())); | 947 state.recordStack.closeScopedRecord(toTimelineTimestamp(event.timestamp())); |
959 state.inKnownLayerTask = false; | 948 state.inKnownLayerTask = false; |
960 } | 949 } |
961 | 950 |
962 void InspectorTimelineAgent::onImageDecodeBegin(const TraceEventDispatcher::Trac eEvent& event) | 951 void InspectorTimelineAgent::onImageDecodeBegin(const TraceEventDispatcher::Trac eEvent& event) |
963 { | 952 { |
964 TimelineThreadState& state = threadState(event.threadIdentifier()); | 953 TimelineThreadState& state = threadState(event.threadIdentifier()); |
965 if (!state.decodedPixelRefId && !state.inKnownLayerTask) | 954 if (!state.decodedPixelRefId && !state.inKnownLayerTask) |
966 return; | 955 return; |
967 TimelineImageInfo imageInfo; | 956 TimelineImageInfo imageInfo; |
968 if (state.decodedPixelRefId) { | 957 if (state.decodedPixelRefId) { |
969 PixelRefToImageInfoMap::const_iterator it = m_pixelRefToImageInfo.find(s tate.decodedPixelRefId); | 958 PixelRefToImageInfoMap::const_iterator it = m_pixelRefToImageInfo.find(s tate.decodedPixelRefId); |
970 if (it != m_pixelRefToImageInfo.end()) | 959 if (it != m_pixelRefToImageInfo.end()) |
971 imageInfo = it->value; | 960 imageInfo = it->value; |
972 else | 961 else |
973 ASSERT_NOT_REACHED(); | 962 ASSERT_NOT_REACHED(); |
974 } | 963 } |
975 RefPtr<JSONObject> data = JSONObject::create(); | 964 RefPtr<JSONObject> data = JSONObject::create(); |
976 TimelineRecordFactory::setImageDetails(data.get(), imageInfo.backendNodeId, imageInfo.url); | 965 TimelineRecordFactory::setImageDetails(data.get(), imageInfo.backendNodeId, imageInfo.url); |
977 double timeestamp = m_timeConverter.fromMonotonicallyIncreasingTime(event.ti mestamp()); | 966 double timeestamp = toTimelineTimestamp(event.timestamp()); |
978 state.recordStack.addScopedRecord(TimelineRecordFactory::createBackgroundRec ord(timeestamp, String::number(event.threadIdentifier()), TimelineRecordType::De codeImage, data), TimelineRecordType::DecodeImage); | 967 state.recordStack.addScopedRecord(TimelineRecordFactory::createBackgroundRec ord(timeestamp, String::number(event.threadIdentifier()), TimelineRecordType::De codeImage, data), TimelineRecordType::DecodeImage); |
979 } | 968 } |
980 | 969 |
981 void InspectorTimelineAgent::onImageDecodeEnd(const TraceEventDispatcher::TraceE vent& event) | 970 void InspectorTimelineAgent::onImageDecodeEnd(const TraceEventDispatcher::TraceE vent& event) |
982 { | 971 { |
983 TimelineThreadState& state = threadState(event.threadIdentifier()); | 972 TimelineThreadState& state = threadState(event.threadIdentifier()); |
984 if (!state.decodedPixelRefId) | 973 if (!state.decodedPixelRefId) |
985 return; | 974 return; |
986 ASSERT(state.recordStack.isOpenRecordOfType(TimelineRecordType::DecodeImage) ); | 975 ASSERT(state.recordStack.isOpenRecordOfType(TimelineRecordType::DecodeImage) ); |
987 state.recordStack.closeScopedRecord(m_timeConverter.fromMonotonicallyIncreas ingTime(event.timestamp())); | 976 state.recordStack.closeScopedRecord(toTimelineTimestamp(event.timestamp())); |
988 } | 977 } |
989 | 978 |
990 void InspectorTimelineAgent::onRequestMainThreadFrame(const TraceEventDispatcher ::TraceEvent& event) | 979 void InspectorTimelineAgent::onRequestMainThreadFrame(const TraceEventDispatcher ::TraceEvent& event) |
991 { | 980 { |
992 unsigned long long layerTreeId = event.asUInt(InstrumentationEventArguments: :LayerTreeId); | 981 unsigned long long layerTreeId = event.asUInt(InstrumentationEventArguments: :LayerTreeId); |
993 if (layerTreeId != m_layerTreeId) | 982 if (layerTreeId != m_layerTreeId) |
994 return; | 983 return; |
995 TimelineThreadState& state = threadState(event.threadIdentifier()); | 984 TimelineThreadState& state = threadState(event.threadIdentifier()); |
996 state.recordStack.addInstantRecord(createRecordForEvent(event, TimelineRecor dType::RequestMainThreadFrame, JSONObject::create())); | 985 state.recordStack.addInstantRecord(createRecordForEvent(event, TimelineRecor dType::RequestMainThreadFrame, JSONObject::create())); |
997 } | 986 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1049 m_pixelRefToImageInfo.set(pixelRefId, TimelineImageInfo(nodeId(m_imageBeingP ainted->generatingNode()), url)); | 1038 m_pixelRefToImageInfo.set(pixelRefId, TimelineImageInfo(nodeId(m_imageBeingP ainted->generatingNode()), url)); |
1050 } | 1039 } |
1051 | 1040 |
1052 void InspectorTimelineAgent::onLazyPixelRefDeleted(const TraceEventDispatcher::T raceEvent& event) | 1041 void InspectorTimelineAgent::onLazyPixelRefDeleted(const TraceEventDispatcher::T raceEvent& event) |
1053 { | 1042 { |
1054 m_pixelRefToImageInfo.remove(event.id()); | 1043 m_pixelRefToImageInfo.remove(event.id()); |
1055 } | 1044 } |
1056 | 1045 |
1057 void InspectorTimelineAgent::processGPUEvent(const GPUEvent& event) | 1046 void InspectorTimelineAgent::processGPUEvent(const GPUEvent& event) |
1058 { | 1047 { |
1059 double timelineTimestamp = m_timeConverter.fromMonotonicallyIncreasingTime(e vent.timestamp); | 1048 double timelineTimestamp = toTimelineTimestamp(event.timestamp); |
1060 if (event.phase == GPUEvent::PhaseBegin) { | 1049 if (event.phase == GPUEvent::PhaseBegin) { |
1061 m_pendingGPURecord = TimelineRecordFactory::createBackgroundRecord(timel ineTimestamp, "gpu", TimelineRecordType::GPUTask, TimelineRecordFactory::createG PUTaskData(event.foreign)); | 1050 m_pendingGPURecord = TimelineRecordFactory::createBackgroundRecord(timel ineTimestamp, "gpu", TimelineRecordType::GPUTask, TimelineRecordFactory::createG PUTaskData(event.foreign)); |
1062 } else if (m_pendingGPURecord) { | 1051 } else if (m_pendingGPURecord) { |
1063 m_pendingGPURecord->setEndTime(timelineTimestamp); | 1052 m_pendingGPURecord->setEndTime(timelineTimestamp); |
1064 if (!event.foreign && m_state->getBoolean(TimelineAgentState::includeCou nters)) { | 1053 if (!event.foreign && m_state->getBoolean(TimelineAgentState::includeCou nters)) { |
1065 RefPtr<TypeBuilder::Timeline::Counters> counters = TypeBuilder::Time line::Counters::create(); | 1054 RefPtr<TypeBuilder::Timeline::Counters> counters = TypeBuilder::Time line::Counters::create(); |
1066 counters->setGpuMemoryUsedKB(static_cast<double>(event.usedGPUMemory Bytes / 1024)); | 1055 counters->setGpuMemoryUsedKB(static_cast<double>(event.usedGPUMemory Bytes / 1024)); |
1067 m_pendingGPURecord->setCounters(counters.release()); | 1056 m_pendingGPURecord->setCounters(counters.release()); |
1068 } | 1057 } |
1069 sendEvent(m_pendingGPURecord.release()); | 1058 sendEvent(m_pendingGPURecord.release()); |
1070 } | 1059 } |
1071 } | 1060 } |
1072 | 1061 |
1073 void InspectorTimelineAgent::onEmbedderCallbackBegin(const TraceEventDispatcher: :TraceEvent& event) | 1062 void InspectorTimelineAgent::onEmbedderCallbackBegin(const TraceEventDispatcher: :TraceEvent& event) |
1074 { | 1063 { |
1075 TimelineThreadState& state = threadState(event.threadIdentifier()); | 1064 TimelineThreadState& state = threadState(event.threadIdentifier()); |
1076 double timestamp = m_timeConverter.fromMonotonicallyIncreasingTime(event.tim estamp()); | 1065 double timestamp = toTimelineTimestamp(event.timestamp()); |
1077 RefPtr<JSONObject> data = TimelineRecordFactory::createEmbedderCallbackData( event.asString(InstrumentationEventArguments::CallbackName)); | 1066 RefPtr<JSONObject> data = TimelineRecordFactory::createEmbedderCallbackData( event.asString(InstrumentationEventArguments::CallbackName)); |
1078 RefPtr<TimelineEvent> record = TimelineRecordFactory::createGenericRecord(ti mestamp, 0, TimelineRecordType::EmbedderCallback, data); | 1067 RefPtr<TimelineEvent> record = TimelineRecordFactory::createGenericRecord(ti mestamp, 0, TimelineRecordType::EmbedderCallback, data); |
1079 state.recordStack.addScopedRecord(record, TimelineRecordType::EmbedderCallba ck); | 1068 state.recordStack.addScopedRecord(record, TimelineRecordType::EmbedderCallba ck); |
1080 } | 1069 } |
1081 | 1070 |
1082 void InspectorTimelineAgent::onEmbedderCallbackEnd(const TraceEventDispatcher::T raceEvent& event) | 1071 void InspectorTimelineAgent::onEmbedderCallbackEnd(const TraceEventDispatcher::T raceEvent& event) |
1083 { | 1072 { |
1084 TimelineThreadState& state = threadState(event.threadIdentifier()); | 1073 TimelineThreadState& state = threadState(event.threadIdentifier()); |
1085 state.recordStack.closeScopedRecord(m_timeConverter.fromMonotonicallyIncreas ingTime(event.timestamp())); | 1074 state.recordStack.closeScopedRecord(toTimelineTimestamp(event.timestamp())); |
1086 } | 1075 } |
1087 | 1076 |
1088 void InspectorTimelineAgent::addRecordToTimeline(PassRefPtr<TimelineEvent> recor d) | 1077 void InspectorTimelineAgent::addRecordToTimeline(PassRefPtr<TimelineEvent> recor d) |
1089 { | 1078 { |
1090 commitFrameRecord(); | 1079 commitFrameRecord(); |
1091 innerAddRecordToTimeline(record); | 1080 innerAddRecordToTimeline(record); |
1092 } | 1081 } |
1093 | 1082 |
1094 void InspectorTimelineAgent::innerAddRecordToTimeline(PassRefPtr<TimelineEvent> record) | 1083 void InspectorTimelineAgent::innerAddRecordToTimeline(PassRefPtr<TimelineEvent> record) |
1095 { | 1084 { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1275 return nodeId(renderer->generatingNode()); | 1264 return nodeId(renderer->generatingNode()); |
1276 } | 1265 } |
1277 | 1266 |
1278 void InspectorTimelineAgent::releaseNodeIds() | 1267 void InspectorTimelineAgent::releaseNodeIds() |
1279 { | 1268 { |
1280 ErrorString unused; | 1269 ErrorString unused; |
1281 if (m_domAgent) | 1270 if (m_domAgent) |
1282 m_domAgent->releaseBackendNodeIds(&unused, BackendNodeIdGroup); | 1271 m_domAgent->releaseBackendNodeIds(&unused, BackendNodeIdGroup); |
1283 } | 1272 } |
1284 | 1273 |
1274 double InspectorTimelineAgent::toTimelineTimestamp(double monotonicallyIncreasin gTime) | |
pfeldman
2014/03/27 13:26:57
There is no "timeline timestamp", it is millis all
| |
1275 { | |
1276 return monotonicallyIncreasingTime * 1000.0; | |
1277 } | |
1278 | |
1285 double InspectorTimelineAgent::timestamp() | 1279 double InspectorTimelineAgent::timestamp() |
1286 { | 1280 { |
1287 return m_timeConverter.fromMonotonicallyIncreasingTime(WTF::monotonicallyInc reasingTime()); | 1281 return toTimelineTimestamp(WTF::monotonicallyIncreasingTime()); |
1288 } | 1282 } |
1289 | 1283 |
1290 FrameHost* InspectorTimelineAgent::frameHost() const | 1284 FrameHost* InspectorTimelineAgent::frameHost() const |
1291 { | 1285 { |
1292 if (!m_pageAgent || !m_pageAgent->page()) | 1286 if (!m_pageAgent || !m_pageAgent->page()) |
1293 return 0; | 1287 return 0; |
1294 return &m_pageAgent->page()->frameHost(); | 1288 return &m_pageAgent->page()->frameHost(); |
1295 } | 1289 } |
1296 | 1290 |
1297 PassRefPtr<TimelineEvent> InspectorTimelineAgent::createRecordForEvent(const Tra ceEventDispatcher::TraceEvent& event, const String& type, PassRefPtr<JSONObject> data) | 1291 PassRefPtr<TimelineEvent> InspectorTimelineAgent::createRecordForEvent(const Tra ceEventDispatcher::TraceEvent& event, const String& type, PassRefPtr<JSONObject> data) |
1298 { | 1292 { |
1299 double timeestamp = m_timeConverter.fromMonotonicallyIncreasingTime(event.ti mestamp()); | 1293 double timeestamp = toTimelineTimestamp(event.timestamp()); |
1300 return TimelineRecordFactory::createBackgroundRecord(timeestamp, String::num ber(event.threadIdentifier()), type, data); | 1294 return TimelineRecordFactory::createBackgroundRecord(timeestamp, String::num ber(event.threadIdentifier()), type, data); |
1301 } | 1295 } |
1302 | 1296 |
1303 TimelineRecordStack::TimelineRecordStack(InspectorTimelineAgent* timelineAgent) | 1297 TimelineRecordStack::TimelineRecordStack(InspectorTimelineAgent* timelineAgent) |
1304 : m_timelineAgent(timelineAgent) | 1298 : m_timelineAgent(timelineAgent) |
1305 { | 1299 { |
1306 } | 1300 } |
1307 | 1301 |
1308 void TimelineRecordStack::addScopedRecord(PassRefPtr<TimelineEvent> record, cons t String& type) | 1302 void TimelineRecordStack::addScopedRecord(PassRefPtr<TimelineEvent> record, cons t String& type) |
1309 { | 1303 { |
(...skipping 22 matching lines...) Expand all Loading... | |
1332 | 1326 |
1333 #ifndef NDEBUG | 1327 #ifndef NDEBUG |
1334 bool TimelineRecordStack::isOpenRecordOfType(const String& type) | 1328 bool TimelineRecordStack::isOpenRecordOfType(const String& type) |
1335 { | 1329 { |
1336 return !m_stack.isEmpty() && m_stack.last().type == type; | 1330 return !m_stack.isEmpty() && m_stack.last().type == type; |
1337 } | 1331 } |
1338 #endif | 1332 #endif |
1339 | 1333 |
1340 } // namespace WebCore | 1334 } // namespace WebCore |
1341 | 1335 |
OLD | NEW |