| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 String type; | 156 String type; |
| 157 bool skipWhenUnbalanced; | 157 bool skipWhenUnbalanced; |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 class TimelineRecordStack { | 160 class TimelineRecordStack { |
| 161 private: | 161 private: |
| 162 struct Entry { | 162 struct Entry { |
| 163 Entry(PassRefPtr<TimelineEvent> record, const String& type) | 163 Entry(PassRefPtr<TimelineEvent> record, const String& type) |
| 164 : record(record) | 164 : record(record) |
| 165 , children(TypeBuilder::Array<TimelineEvent>::create()) | 165 , children(TypeBuilder::Array<TimelineEvent>::create()) |
| 166 #ifndef NDEBUG | 166 #if ENABLE(ASSERT) |
| 167 , type(type) | 167 , type(type) |
| 168 #endif | 168 #endif |
| 169 { | 169 { |
| 170 } | 170 } |
| 171 | 171 |
| 172 RefPtr<TimelineEvent> record; | 172 RefPtr<TimelineEvent> record; |
| 173 RefPtr<TypeBuilder::Array<TimelineEvent> > children; | 173 RefPtr<TypeBuilder::Array<TimelineEvent> > children; |
| 174 #ifndef NDEBUG | 174 #if ENABLE(ASSERT) |
| 175 String type; | 175 String type; |
| 176 #endif | 176 #endif |
| 177 }; | 177 }; |
| 178 | 178 |
| 179 public: | 179 public: |
| 180 TimelineRecordStack() : m_timelineAgent(0) { } | 180 TimelineRecordStack() : m_timelineAgent(0) { } |
| 181 TimelineRecordStack(InspectorTimelineAgent*); | 181 TimelineRecordStack(InspectorTimelineAgent*); |
| 182 | 182 |
| 183 void addScopedRecord(PassRefPtr<TimelineEvent> record, const String& type); | 183 void addScopedRecord(PassRefPtr<TimelineEvent> record, const String& type); |
| 184 void closeScopedRecord(double endTime); | 184 void closeScopedRecord(double endTime); |
| 185 void addInstantRecord(PassRefPtr<TimelineEvent> record); | 185 void addInstantRecord(PassRefPtr<TimelineEvent> record); |
| 186 | 186 |
| 187 #ifndef NDEBUG | 187 #if ENABLE(ASSERT) |
| 188 bool isOpenRecordOfType(const String& type); | 188 bool isOpenRecordOfType(const String& type); |
| 189 #endif | 189 #endif |
| 190 | 190 |
| 191 private: | 191 private: |
| 192 void send(PassRefPtr<JSONObject>); | 192 void send(PassRefPtr<JSONObject>); |
| 193 | 193 |
| 194 InspectorTimelineAgent* m_timelineAgent; | 194 InspectorTimelineAgent* m_timelineAgent; |
| 195 Vector<Entry> m_stack; | 195 Vector<Entry> m_stack; |
| 196 }; | 196 }; |
| 197 | 197 |
| (...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 } | 1297 } |
| 1298 | 1298 |
| 1299 void TimelineRecordStack::addInstantRecord(PassRefPtr<TimelineEvent> record) | 1299 void TimelineRecordStack::addInstantRecord(PassRefPtr<TimelineEvent> record) |
| 1300 { | 1300 { |
| 1301 if (m_stack.isEmpty()) | 1301 if (m_stack.isEmpty()) |
| 1302 m_timelineAgent->sendEvent(record); | 1302 m_timelineAgent->sendEvent(record); |
| 1303 else | 1303 else |
| 1304 m_stack.last().children->addItem(record); | 1304 m_stack.last().children->addItem(record); |
| 1305 } | 1305 } |
| 1306 | 1306 |
| 1307 #ifndef NDEBUG | 1307 #if ENABLE(ASSERT) |
| 1308 bool TimelineRecordStack::isOpenRecordOfType(const String& type) | 1308 bool TimelineRecordStack::isOpenRecordOfType(const String& type) |
| 1309 { | 1309 { |
| 1310 return !m_stack.isEmpty() && m_stack.last().type == type; | 1310 return !m_stack.isEmpty() && m_stack.last().type == type; |
| 1311 } | 1311 } |
| 1312 #endif | 1312 #endif |
| 1313 | 1313 |
| 1314 } // namespace WebCore | 1314 } // namespace WebCore |
| 1315 | 1315 |
| OLD | NEW |