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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp

Issue 2176373004: [DevTools] Speculative crash fix in currentCallFrames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010-2011 Google Inc. All rights reserved. 2 * Copyright (c) 2010-2011 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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 static V8DebuggerImpl* toV8DebuggerImpl(v8::Local<v8::Value> data) 473 static V8DebuggerImpl* toV8DebuggerImpl(v8::Local<v8::Value> data)
474 { 474 {
475 void* p = v8::Local<v8::External>::Cast(data)->Value(); 475 void* p = v8::Local<v8::External>::Cast(data)->Value();
476 return static_cast<V8DebuggerImpl*>(p); 476 return static_cast<V8DebuggerImpl*>(p);
477 } 477 }
478 478
479 void V8DebuggerImpl::breakProgramCallback(const v8::FunctionCallbackInfo<v8::Val ue>& info) 479 void V8DebuggerImpl::breakProgramCallback(const v8::FunctionCallbackInfo<v8::Val ue>& info)
480 { 480 {
481 DCHECK_EQ(info.Length(), 2); 481 DCHECK_EQ(info.Length(), 2);
482 V8DebuggerImpl* thisPtr = toV8DebuggerImpl(info.Data()); 482 V8DebuggerImpl* thisPtr = toV8DebuggerImpl(info.Data());
483 if (!thisPtr->enabled())
484 return;
483 v8::Local<v8::Context> pausedContext = thisPtr->m_isolate->GetCurrentContext (); 485 v8::Local<v8::Context> pausedContext = thisPtr->m_isolate->GetCurrentContext ();
484 v8::Local<v8::Value> exception; 486 v8::Local<v8::Value> exception;
485 v8::Local<v8::Array> hitBreakpoints; 487 v8::Local<v8::Array> hitBreakpoints;
486 thisPtr->handleProgramBreak(pausedContext, v8::Local<v8::Object>::Cast(info[ 0]), exception, hitBreakpoints); 488 thisPtr->handleProgramBreak(pausedContext, v8::Local<v8::Object>::Cast(info[ 0]), exception, hitBreakpoints);
487 } 489 }
488 490
489 void V8DebuggerImpl::handleProgramBreak(v8::Local<v8::Context> pausedContext, v8 ::Local<v8::Object> executionState, v8::Local<v8::Value> exception, v8::Local<v8 ::Array> hitBreakpointNumbers, bool isPromiseRejection) 491 void V8DebuggerImpl::handleProgramBreak(v8::Local<v8::Context> pausedContext, v8 ::Local<v8::Object> executionState, v8::Local<v8::Value> exception, v8::Local<v8 ::Array> hitBreakpointNumbers, bool isPromiseRejection)
490 { 492 {
491 // Don't allow nested breaks. 493 // Don't allow nested breaks.
492 if (m_runningNestedMessageLoop) 494 if (m_runningNestedMessageLoop)
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 if (!m_debuggerScript.IsEmpty()) { 625 if (!m_debuggerScript.IsEmpty()) {
624 NOTREACHED(); 626 NOTREACHED();
625 return; 627 return;
626 } 628 }
627 629
628 v8::HandleScope scope(m_isolate); 630 v8::HandleScope scope(m_isolate);
629 v8::Context::Scope contextScope(debuggerContext()); 631 v8::Context::Scope contextScope(debuggerContext());
630 632
631 v8::Local<v8::String> scriptValue = v8::String::NewFromUtf8(m_isolate, Debug gerScript_js, v8::NewStringType::kInternalized, sizeof(DebuggerScript_js)).ToLoc alChecked(); 633 v8::Local<v8::String> scriptValue = v8::String::NewFromUtf8(m_isolate, Debug gerScript_js, v8::NewStringType::kInternalized, sizeof(DebuggerScript_js)).ToLoc alChecked();
632 v8::Local<v8::Value> value; 634 v8::Local<v8::Value> value;
633 if (!compileAndRunInternalScript(debuggerContext(), scriptValue).ToLocal(&va lue)) 635 if (!compileAndRunInternalScript(debuggerContext(), scriptValue).ToLocal(&va lue)) {
636 NOTREACHED();
634 return; 637 return;
638 }
635 DCHECK(value->IsObject()); 639 DCHECK(value->IsObject());
636 m_debuggerScript.Reset(m_isolate, value.As<v8::Object>()); 640 m_debuggerScript.Reset(m_isolate, value.As<v8::Object>());
637 } 641 }
638 642
639 v8::Local<v8::Context> V8DebuggerImpl::debuggerContext() const 643 v8::Local<v8::Context> V8DebuggerImpl::debuggerContext() const
640 { 644 {
641 DCHECK(!m_debuggerContext.IsEmpty()); 645 DCHECK(!m_debuggerContext.IsEmpty());
642 return m_debuggerContext.Get(m_isolate); 646 return m_debuggerContext.Get(m_isolate);
643 } 647 }
644 648
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 1158
1155 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI d) 1159 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI d)
1156 { 1160 {
1157 if (!contextGroupId) 1161 if (!contextGroupId)
1158 return nullptr; 1162 return nullptr;
1159 SessionMap::iterator iter = m_sessions.find(contextGroupId); 1163 SessionMap::iterator iter = m_sessions.find(contextGroupId);
1160 return iter == m_sessions.end() ? nullptr : iter->second; 1164 return iter == m_sessions.end() ? nullptr : iter->second;
1161 } 1165 }
1162 1166
1163 } // namespace blink 1167 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698