Chromium Code Reviews| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 { | 151 { |
| 152 } | 152 } |
| 153 RefPtr<TimelineEvent> record; | 153 RefPtr<TimelineEvent> record; |
| 154 RefPtr<JSONObject> data; | 154 RefPtr<JSONObject> data; |
| 155 RefPtr<TypeBuilder::Array<TimelineEvent> > children; | 155 RefPtr<TypeBuilder::Array<TimelineEvent> > children; |
| 156 String type; | 156 String type; |
| 157 bool skipWhenUnbalanced; | 157 bool skipWhenUnbalanced; |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 class TimelineRecordStack { | 160 class TimelineRecordStack { |
| 161 DISALLOW_ALLOCATION(); | |
| 161 private: | 162 private: |
| 162 struct Entry { | 163 struct Entry { |
| 163 Entry(PassRefPtr<TimelineEvent> record, const String& type) | 164 Entry(PassRefPtr<TimelineEvent> record, const String& type) |
| 164 : record(record) | 165 : record(record) |
| 165 , children(TypeBuilder::Array<TimelineEvent>::create()) | 166 , children(TypeBuilder::Array<TimelineEvent>::create()) |
| 166 #ifndef NDEBUG | 167 #ifndef NDEBUG |
| 167 , type(type) | 168 , type(type) |
| 168 #endif | 169 #endif |
| 169 { | 170 { |
| 170 } | 171 } |
| 171 | 172 |
| 172 RefPtr<TimelineEvent> record; | 173 RefPtr<TimelineEvent> record; |
| 173 RefPtr<TypeBuilder::Array<TimelineEvent> > children; | 174 RefPtr<TypeBuilder::Array<TimelineEvent> > children; |
| 174 #ifndef NDEBUG | 175 #ifndef NDEBUG |
| 175 String type; | 176 String type; |
| 176 #endif | 177 #endif |
| 177 }; | 178 }; |
| 178 | 179 |
| 179 public: | 180 public: |
| 180 TimelineRecordStack() : m_timelineAgent(0) { } | 181 TimelineRecordStack() : m_timelineAgent(nullptr) { } |
| 181 TimelineRecordStack(InspectorTimelineAgent*); | 182 TimelineRecordStack(InspectorTimelineAgent*); |
|
haraken
2014/06/19 05:49:53
Add explicit.
keishi
2014/07/24 02:15:02
Done.
| |
| 182 | 183 |
| 183 void addScopedRecord(PassRefPtr<TimelineEvent> record, const String& type); | 184 void addScopedRecord(PassRefPtr<TimelineEvent> record, const String& type); |
| 184 void closeScopedRecord(double endTime); | 185 void closeScopedRecord(double endTime); |
| 185 void addInstantRecord(PassRefPtr<TimelineEvent> record); | 186 void addInstantRecord(PassRefPtr<TimelineEvent> record); |
| 186 | 187 |
| 187 #ifndef NDEBUG | 188 #ifndef NDEBUG |
| 188 bool isOpenRecordOfType(const String& type); | 189 bool isOpenRecordOfType(const String& type); |
| 189 #endif | 190 #endif |
| 190 | 191 |
| 192 void trace(Visitor*); | |
| 193 | |
| 191 private: | 194 private: |
| 192 void send(PassRefPtr<JSONObject>); | 195 void send(PassRefPtr<JSONObject>); |
| 193 | 196 |
| 194 InspectorTimelineAgent* m_timelineAgent; | 197 RawPtrWillBeMember<InspectorTimelineAgent> m_timelineAgent; |
| 195 Vector<Entry> m_stack; | 198 Vector<Entry> m_stack; |
| 196 }; | 199 }; |
| 197 | 200 |
| 198 struct TimelineThreadState { | 201 struct TimelineThreadState : public NoBaseWillBeGarbageCollectedFinalized<Timeli neThreadState> { |
|
haraken
2014/06/19 05:49:53
I think you can use ALLOW_ONLY_INLINE_ALLOCATION i
haraken
2014/06/19 05:49:53
Nit: struct => class
keishi
2014/07/24 02:15:02
Done.
keishi
2014/07/24 02:15:02
Should this be a class? The accessors are public.
| |
| 199 TimelineThreadState() { } | 202 TimelineThreadState() { } |
| 200 | 203 |
| 201 TimelineThreadState(InspectorTimelineAgent* timelineAgent) | 204 TimelineThreadState(InspectorTimelineAgent* timelineAgent) |
| 202 : recordStack(timelineAgent) | 205 : recordStack(timelineAgent) |
| 203 , inKnownLayerTask(false) | 206 , inKnownLayerTask(false) |
| 204 , decodedPixelRefId(0) | 207 , decodedPixelRefId(0) |
| 205 { | 208 { |
| 206 } | 209 } |
| 207 | 210 |
| 211 void trace(Visitor*); | |
| 212 | |
| 208 TimelineRecordStack recordStack; | 213 TimelineRecordStack recordStack; |
| 209 bool inKnownLayerTask; | 214 bool inKnownLayerTask; |
| 210 unsigned long long decodedPixelRefId; | 215 unsigned long long decodedPixelRefId; |
| 211 }; | 216 }; |
| 212 | 217 |
| 213 struct TimelineImageInfo { | 218 struct TimelineImageInfo { |
| 214 int backendNodeId; | 219 int backendNodeId; |
| 215 String url; | 220 String url; |
| 216 | 221 |
| 217 TimelineImageInfo() : backendNodeId(0) { } | 222 TimelineImageInfo() : backendNodeId(0) { } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 258 } | 263 } |
| 259 | 264 |
| 260 InspectorTimelineAgent::~InspectorTimelineAgent() | 265 InspectorTimelineAgent::~InspectorTimelineAgent() |
| 261 { | 266 { |
| 262 } | 267 } |
| 263 | 268 |
| 264 void InspectorTimelineAgent::trace(Visitor* visitor) | 269 void InspectorTimelineAgent::trace(Visitor* visitor) |
| 265 { | 270 { |
| 266 visitor->trace(m_pageAgent); | 271 visitor->trace(m_pageAgent); |
| 267 visitor->trace(m_layerTreeAgent); | 272 visitor->trace(m_layerTreeAgent); |
| 273 visitor->trace(m_threadStates); | |
| 268 InspectorBaseAgent::trace(visitor); | 274 InspectorBaseAgent::trace(visitor); |
| 269 } | 275 } |
| 270 | 276 |
| 271 void InspectorTimelineAgent::setFrontend(InspectorFrontend* frontend) | 277 void InspectorTimelineAgent::setFrontend(InspectorFrontend* frontend) |
| 272 { | 278 { |
| 273 m_frontend = frontend->timeline(); | 279 m_frontend = frontend->timeline(); |
| 274 } | 280 } |
| 275 | 281 |
| 276 void InspectorTimelineAgent::clearFrontend() | 282 void InspectorTimelineAgent::clearFrontend() |
| 277 { | 283 { |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1201 if (hasLowLevelDetails && !m_platformInstrumentationClientInstalledAtStackDe pth && !PlatformInstrumentation::hasClient()) { | 1207 if (hasLowLevelDetails && !m_platformInstrumentationClientInstalledAtStackDe pth && !PlatformInstrumentation::hasClient()) { |
| 1202 m_platformInstrumentationClientInstalledAtStackDepth = m_recordStack.siz e(); | 1208 m_platformInstrumentationClientInstalledAtStackDepth = m_recordStack.siz e(); |
| 1203 PlatformInstrumentation::setClient(this); | 1209 PlatformInstrumentation::setClient(this); |
| 1204 } | 1210 } |
| 1205 } | 1211 } |
| 1206 | 1212 |
| 1207 TimelineThreadState& InspectorTimelineAgent::threadState(ThreadIdentifier thread ) | 1213 TimelineThreadState& InspectorTimelineAgent::threadState(ThreadIdentifier thread ) |
| 1208 { | 1214 { |
| 1209 ThreadStateMap::iterator it = m_threadStates.find(thread); | 1215 ThreadStateMap::iterator it = m_threadStates.find(thread); |
| 1210 if (it != m_threadStates.end()) | 1216 if (it != m_threadStates.end()) |
| 1211 return it->value; | 1217 return *(it->value); |
| 1212 return m_threadStates.add(thread, TimelineThreadState(this)).storedValue->va lue; | 1218 return *(m_threadStates.add(thread, adoptPtrWillBeNoop(new TimelineThreadSta te(this))).storedValue->value); |
| 1213 } | 1219 } |
| 1214 | 1220 |
| 1215 void InspectorTimelineAgent::commitFrameRecord() | 1221 void InspectorTimelineAgent::commitFrameRecord() |
| 1216 { | 1222 { |
| 1217 if (!m_pendingFrameRecord) | 1223 if (!m_pendingFrameRecord) |
| 1218 return; | 1224 return; |
| 1219 innerAddRecordToTimeline(m_pendingFrameRecord.release()); | 1225 innerAddRecordToTimeline(m_pendingFrameRecord.release()); |
| 1220 } | 1226 } |
| 1221 | 1227 |
| 1222 void InspectorTimelineAgent::clearRecordStack() | 1228 void InspectorTimelineAgent::clearRecordStack() |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1310 m_stack.last().children->addItem(record); | 1316 m_stack.last().children->addItem(record); |
| 1311 } | 1317 } |
| 1312 | 1318 |
| 1313 #ifndef NDEBUG | 1319 #ifndef NDEBUG |
| 1314 bool TimelineRecordStack::isOpenRecordOfType(const String& type) | 1320 bool TimelineRecordStack::isOpenRecordOfType(const String& type) |
| 1315 { | 1321 { |
| 1316 return !m_stack.isEmpty() && m_stack.last().type == type; | 1322 return !m_stack.isEmpty() && m_stack.last().type == type; |
| 1317 } | 1323 } |
| 1318 #endif | 1324 #endif |
| 1319 | 1325 |
| 1326 void TimelineRecordStack::trace(Visitor* visitor) | |
| 1327 { | |
| 1328 visitor->trace(m_timelineAgent); | |
| 1329 } | |
| 1330 | |
| 1331 void TimelineThreadState::trace(Visitor* visitor) | |
| 1332 { | |
| 1333 recordStack.trace(visitor); | |
|
haraken
2014/06/19 05:49:53
visitor->trace(recordStack) should work.
keishi
2014/07/24 02:15:02
Done.
| |
| 1334 } | |
| 1335 | |
| 1320 } // namespace WebCore | 1336 } // namespace WebCore |
| 1321 | 1337 |
| OLD | NEW |