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

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

Issue 2249663003: Revert of [DevTools] Rename entities in js_protocol, remove deprecated ones. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium 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 "platform/v8_inspector/V8Debugger.h" 5 #include "platform/v8_inspector/V8Debugger.h"
6 6
7 #include "platform/v8_inspector/DebuggerScript.h" 7 #include "platform/v8_inspector/DebuggerScript.h"
8 #include "platform/v8_inspector/ScriptBreakpoint.h" 8 #include "platform/v8_inspector/ScriptBreakpoint.h"
9 #include "platform/v8_inspector/V8Compat.h" 9 #include "platform/v8_inspector/V8Compat.h"
10 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" 10 #include "platform/v8_inspector/V8DebuggerAgentImpl.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 void V8Debugger::clearStepping() 295 void V8Debugger::clearStepping()
296 { 296 {
297 DCHECK(enabled()); 297 DCHECK(enabled());
298 v8::HandleScope scope(m_isolate); 298 v8::HandleScope scope(m_isolate);
299 v8::Context::Scope contextScope(debuggerContext()); 299 v8::Context::Scope contextScope(debuggerContext());
300 300
301 v8::Local<v8::Value> argv[] = { v8::Undefined(m_isolate) }; 301 v8::Local<v8::Value> argv[] = { v8::Undefined(m_isolate) };
302 callDebuggerMethod("clearStepping", 0, argv); 302 callDebuggerMethod("clearStepping", 0, argv);
303 } 303 }
304 304
305 bool V8Debugger::setScriptSource(const String16& sourceID, v8::Local<v8::String> newSource, bool dryRun, ErrorString* error, Maybe<protocol::Runtime::ExceptionD etails>* exceptionDetails, JavaScriptCallFrames* newCallFrames, Maybe<bool>* sta ckChanged) 305 bool V8Debugger::setScriptSource(const String16& sourceID, v8::Local<v8::String> newSource, bool preview, ErrorString* error, Maybe<protocol::Runtime::Exception Details>* exceptionDetails, JavaScriptCallFrames* newCallFrames, Maybe<bool>* st ackChanged)
306 { 306 {
307 class EnableLiveEditScope { 307 class EnableLiveEditScope {
308 public: 308 public:
309 explicit EnableLiveEditScope(v8::Isolate* isolate) : m_isolate(isolate) 309 explicit EnableLiveEditScope(v8::Isolate* isolate) : m_isolate(isolate)
310 { 310 {
311 v8::Debug::SetLiveEditEnabled(m_isolate, true); 311 v8::Debug::SetLiveEditEnabled(m_isolate, true);
312 inLiveEditScope = true; 312 inLiveEditScope = true;
313 } 313 }
314 ~EnableLiveEditScope() 314 ~EnableLiveEditScope()
315 { 315 {
316 v8::Debug::SetLiveEditEnabled(m_isolate, false); 316 v8::Debug::SetLiveEditEnabled(m_isolate, false);
317 inLiveEditScope = false; 317 inLiveEditScope = false;
318 } 318 }
319 private: 319 private:
320 v8::Isolate* m_isolate; 320 v8::Isolate* m_isolate;
321 }; 321 };
322 322
323 DCHECK(enabled()); 323 DCHECK(enabled());
324 v8::HandleScope scope(m_isolate); 324 v8::HandleScope scope(m_isolate);
325 325
326 std::unique_ptr<v8::Context::Scope> contextScope; 326 std::unique_ptr<v8::Context::Scope> contextScope;
327 if (!isPaused()) 327 if (!isPaused())
328 contextScope = wrapUnique(new v8::Context::Scope(debuggerContext())); 328 contextScope = wrapUnique(new v8::Context::Scope(debuggerContext()));
329 329
330 v8::Local<v8::Value> argv[] = { toV8String(m_isolate, sourceID), newSource, v8Boolean(dryRun, m_isolate) }; 330 v8::Local<v8::Value> argv[] = { toV8String(m_isolate, sourceID), newSource, v8Boolean(preview, m_isolate) };
331 331
332 v8::Local<v8::Value> v8result; 332 v8::Local<v8::Value> v8result;
333 { 333 {
334 EnableLiveEditScope enableLiveEditScope(m_isolate); 334 EnableLiveEditScope enableLiveEditScope(m_isolate);
335 v8::TryCatch tryCatch(m_isolate); 335 v8::TryCatch tryCatch(m_isolate);
336 tryCatch.SetVerbose(false); 336 tryCatch.SetVerbose(false);
337 v8::MaybeLocal<v8::Value> maybeResult = callDebuggerMethod("liveEditScri ptSource", 3, argv); 337 v8::MaybeLocal<v8::Value> maybeResult = callDebuggerMethod("liveEditScri ptSource", 3, argv);
338 if (tryCatch.HasCaught()) { 338 if (tryCatch.HasCaught()) {
339 v8::Local<v8::Message> message = tryCatch.Message(); 339 v8::Local<v8::Message> message = tryCatch.Message();
340 if (!message.IsEmpty()) 340 if (!message.IsEmpty())
341 *error = toProtocolStringWithTypeCheck(message->Get()); 341 *error = toProtocolStringWithTypeCheck(message->Get());
342 else 342 else
343 *error = "Unknown error."; 343 *error = "Unknown error.";
344 return false; 344 return false;
345 } 345 }
346 v8result = maybeResult.ToLocalChecked(); 346 v8result = maybeResult.ToLocalChecked();
347 } 347 }
348 DCHECK(!v8result.IsEmpty()); 348 DCHECK(!v8result.IsEmpty());
349 v8::Local<v8::Object> resultTuple = v8result->ToObject(m_isolate); 349 v8::Local<v8::Object> resultTuple = v8result->ToObject(m_isolate);
350 int code = static_cast<int>(resultTuple->Get(0)->ToInteger(m_isolate)->Value ()); 350 int code = static_cast<int>(resultTuple->Get(0)->ToInteger(m_isolate)->Value ());
351 switch (code) { 351 switch (code) {
352 case 0: 352 case 0:
353 { 353 {
354 *stackChanged = resultTuple->Get(1)->BooleanValue(); 354 *stackChanged = resultTuple->Get(1)->BooleanValue();
355 // Call stack may have changed after if the edited function was on t he stack. 355 // Call stack may have changed after if the edited function was on t he stack.
356 if (!dryRun && isPaused()) { 356 if (!preview && isPaused()) {
357 JavaScriptCallFrames frames = currentCallFrames(); 357 JavaScriptCallFrames frames = currentCallFrames();
358 newCallFrames->swap(frames); 358 newCallFrames->swap(frames);
359 } 359 }
360 return true; 360 return true;
361 } 361 }
362 // Compile error. 362 // Compile error.
363 case 1: 363 case 1:
364 { 364 {
365 *exceptionDetails = protocol::Runtime::ExceptionDetails::create() 365 *exceptionDetails = protocol::Runtime::ExceptionDetails::create()
366 .setText(toProtocolStringWithTypeCheck(resultTuple->Get(2))) 366 .setText(toProtocolStringWithTypeCheck(resultTuple->Get(2)))
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 return nullptr; 830 return nullptr;
831 831
832 size_t stackSize = fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; 832 size_t stackSize = fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1;
833 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) 833 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId))
834 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; 834 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture;
835 835
836 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); 836 return V8StackTraceImpl::capture(this, contextGroupId, stackSize);
837 } 837 }
838 838
839 } // namespace blink 839 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698