Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Side by Side Diff: src/inspector/v8-stack-trace-impl.cc

Issue 2884613004: [inspector] added in-deeper-frame continue-to-location strategy
Patch Set: rebased Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/inspector/v8-stack-trace-impl.h" 5 #include "src/inspector/v8-stack-trace-impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "src/inspector/v8-debugger.h" 9 #include "src/inspector/v8-debugger.h"
10 #include "src/inspector/wasm-translation.h" 10 #include "src/inspector/wasm-translation.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 while (!current.done() && !target.done()) { 257 while (!current.done() && !target.done()) {
258 if (!current.frame()->isEqual(target.frame())) { 258 if (!current.frame()->isEqual(target.frame())) {
259 return false; 259 return false;
260 } 260 }
261 current.next(); 261 current.next();
262 target.next(); 262 target.next();
263 } 263 }
264 return current.done() == target.done(); 264 return current.done() == target.done();
265 } 265 }
266 266
267 void V8StackTraceImpl::allFrames(std::vector<StackFrame*>* frames) const {
268 StackFrameIterator current(this);
269 while (!current.done()) {
270 frames->push_back(current.frame());
271 current.next();
272 }
273 }
274
275 bool V8StackTraceImpl::isPrefix(V8StackTraceImpl* currentStack) const {
276 std::vector<StackFrame*> prefix;
277 allFrames(&prefix);
278 std::vector<StackFrame*> current;
279 currentStack->allFrames(&current);
280
281 auto itPrefix = prefix.rbegin();
282 auto itCurrent = current.rbegin();
283 while (itPrefix != prefix.rend() && itCurrent != current.rend()) {
284 if (!(*itPrefix)->isEqual(*itCurrent)) {
285 return false;
286 }
287 ++itPrefix;
288 ++itCurrent;
289 }
290 return itPrefix == prefix.rend();
291 }
292
267 V8StackTraceImpl::StackFrameIterator::StackFrameIterator( 293 V8StackTraceImpl::StackFrameIterator::StackFrameIterator(
268 const V8StackTraceImpl* stackTrace) 294 const V8StackTraceImpl* stackTrace)
269 : m_currentIt(stackTrace->m_frames.begin()), 295 : m_currentIt(stackTrace->m_frames.begin()),
270 m_currentEnd(stackTrace->m_frames.end()), 296 m_currentEnd(stackTrace->m_frames.end()),
271 m_parent(stackTrace->m_asyncParent.lock().get()) {} 297 m_parent(stackTrace->m_asyncParent.lock().get()) {}
272 298
273 void V8StackTraceImpl::StackFrameIterator::next() { 299 void V8StackTraceImpl::StackFrameIterator::next() {
274 if (m_currentIt == m_currentEnd) return; 300 if (m_currentIt == m_currentEnd) return;
275 ++m_currentIt; 301 ++m_currentIt;
276 while (m_currentIt == m_currentEnd && m_parent) { 302 while (m_currentIt == m_currentEnd && m_parent) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 return m_asyncParent; 386 return m_asyncParent;
361 } 387 }
362 388
363 std::weak_ptr<AsyncStackTrace> AsyncStackTrace::creation() const { 389 std::weak_ptr<AsyncStackTrace> AsyncStackTrace::creation() const {
364 return m_asyncCreation; 390 return m_asyncCreation;
365 } 391 }
366 392
367 bool AsyncStackTrace::isEmpty() const { return m_frames.empty(); } 393 bool AsyncStackTrace::isEmpty() const { return m_frames.empty(); }
368 394
369 } // namespace v8_inspector 395 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/inspector/v8-stack-trace-impl.h ('k') | test/inspector/debugger/continue-to-location-target-call-frames.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698