Index: src/inspector/v8-stack-trace-impl.cc |
diff --git a/src/inspector/v8-stack-trace-impl.cc b/src/inspector/v8-stack-trace-impl.cc |
index 9db6b47caf01c79944bb40412c1c9416a62e2a31..daa03fee875f91f342e3e603cdfab103fffde67e 100644 |
--- a/src/inspector/v8-stack-trace-impl.cc |
+++ b/src/inspector/v8-stack-trace-impl.cc |
@@ -264,6 +264,32 @@ bool V8StackTraceImpl::isEqualIgnoringTopFrame( |
return current.done() == target.done(); |
} |
+void V8StackTraceImpl::allFrames(std::vector<StackFrame*>* frames) const { |
+ StackFrameIterator current(this); |
+ while (!current.done()) { |
+ frames->push_back(current.frame()); |
+ current.next(); |
+ } |
+} |
+ |
+bool V8StackTraceImpl::isPrefix(V8StackTraceImpl* currentStack) const { |
+ std::vector<StackFrame*> prefix; |
+ allFrames(&prefix); |
+ std::vector<StackFrame*> current; |
+ currentStack->allFrames(¤t); |
+ |
+ auto itPrefix = prefix.rbegin(); |
+ auto itCurrent = current.rbegin(); |
+ while (itPrefix != prefix.rend() && itCurrent != current.rend()) { |
+ if (!(*itPrefix)->isEqual(*itCurrent)) { |
+ return false; |
+ } |
+ ++itPrefix; |
+ ++itCurrent; |
+ } |
+ return itPrefix == prefix.rend(); |
+} |
+ |
V8StackTraceImpl::StackFrameIterator::StackFrameIterator( |
const V8StackTraceImpl* stackTrace) |
: m_currentIt(stackTrace->m_frames.begin()), |