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

Side by Side Diff: sky/engine/v8_inspector/ScriptDebugServer.cpp

Issue 776743002: Make v8 inspector not crash (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 /* 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 23 matching lines...) Expand all
34 #include "gen/sky/bindings/core/v8/V8JavaScriptCallFrame.h" 34 #include "gen/sky/bindings/core/v8/V8JavaScriptCallFrame.h"
35 #include "sky/engine/bindings/core/v8/ScopedPersistent.h" 35 #include "sky/engine/bindings/core/v8/ScopedPersistent.h"
36 #include "sky/engine/bindings/core/v8/ScriptCallStackFactory.h" 36 #include "sky/engine/bindings/core/v8/ScriptCallStackFactory.h"
37 #include "sky/engine/bindings/core/v8/ScriptController.h" 37 #include "sky/engine/bindings/core/v8/ScriptController.h"
38 #include "sky/engine/bindings/core/v8/ScriptSourceCode.h" 38 #include "sky/engine/bindings/core/v8/ScriptSourceCode.h"
39 #include "sky/engine/bindings/core/v8/ScriptValue.h" 39 #include "sky/engine/bindings/core/v8/ScriptValue.h"
40 #include "sky/engine/bindings/core/v8/V8Binding.h" 40 #include "sky/engine/bindings/core/v8/V8Binding.h"
41 #include "sky/engine/bindings/core/v8/V8ScriptRunner.h" 41 #include "sky/engine/bindings/core/v8/V8ScriptRunner.h"
42 #include "sky/engine/core/inspector/JavaScriptCallFrame.h" 42 #include "sky/engine/core/inspector/JavaScriptCallFrame.h"
43 #include "sky/engine/platform/JSONValues.h" 43 #include "sky/engine/platform/JSONValues.h"
44 #include "sky/engine/public/platform/Platform.h" 44 #include "sky/engine/v8_inspector/read_from_source_tree.h"
45 #include "sky/engine/public/platform/WebData.h"
46 #include "sky/engine/v8_inspector/ScriptDebugListener.h" 45 #include "sky/engine/v8_inspector/ScriptDebugListener.h"
46 #include "sky/engine/wtf/dtoa/utils.h"
47 #include "sky/engine/wtf/StdLibExtras.h" 47 #include "sky/engine/wtf/StdLibExtras.h"
48 #include "sky/engine/wtf/text/CString.h"
48 #include "sky/engine/wtf/Vector.h" 49 #include "sky/engine/wtf/Vector.h"
49 #include "sky/engine/wtf/dtoa/utils.h"
50 #include "sky/engine/wtf/text/CString.h"
51 50
52 namespace blink { 51 namespace blink {
53 52
54 namespace { 53 namespace {
55 54
56 class ClientDataImpl : public v8::Debug::ClientData { 55 class ClientDataImpl : public v8::Debug::ClientData {
57 public: 56 public:
58 ClientDataImpl(PassOwnPtr<ScriptDebugServer::Task> task) : m_task(task) { } 57 ClientDataImpl(PassOwnPtr<ScriptDebugServer::Task> task) : m_task(task) { }
59 virtual ~ClientDataImpl() { } 58 virtual ~ClientDataImpl() { }
60 ScriptDebugServer::Task* task() const { return m_task.get(); } 59 ScriptDebugServer::Task* task() const { return m_task.get(); }
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 listener->didParseSource(sourceID, script, compileResult); 572 listener->didParseSource(sourceID, script, compileResult);
574 } 573 }
575 574
576 void ScriptDebugServer::ensureDebuggerScriptCompiled() 575 void ScriptDebugServer::ensureDebuggerScriptCompiled()
577 { 576 {
578 if (!m_debuggerScript.isEmpty()) 577 if (!m_debuggerScript.isEmpty())
579 return; 578 return;
580 579
581 v8::HandleScope scope(m_isolate); 580 v8::HandleScope scope(m_isolate);
582 v8::Context::Scope contextScope(v8::Debug::GetDebugContext()); 581 v8::Context::Scope contextScope(v8::Debug::GetDebugContext());
583 const blink::WebData& debuggerScriptSourceResource = blink::Platform::curren t()->loadResource("DebuggerScript.js"); 582
584 v8::Handle<v8::String> source = v8String(m_isolate, String(debuggerScriptSou rceResource.data(), debuggerScriptSourceResource.size())); 583 std::string buffer;
584 inspector::ReadFileFromSourceTree("DebuggerScript.js", &buffer);
585 v8::Handle<v8::String> source = v8String(m_isolate, String::fromUTF8(buffer) );
585 v8::Local<v8::Value> value = V8ScriptRunner::compileAndRunInternalScript(sou rce, m_isolate); 586 v8::Local<v8::Value> value = V8ScriptRunner::compileAndRunInternalScript(sou rce, m_isolate);
586 ASSERT(!value.IsEmpty()); 587 ASSERT(!value.IsEmpty());
587 ASSERT(value->IsObject()); 588 ASSERT(value->IsObject());
588 m_debuggerScript.set(m_isolate, v8::Handle<v8::Object>::Cast(value)); 589 m_debuggerScript.set(m_isolate, v8::Handle<v8::Object>::Cast(value));
589 } 590 }
590 591
591 void ScriptDebugServer::discardDebuggerScript() 592 void ScriptDebugServer::discardDebuggerScript()
592 { 593 {
593 ASSERT(!m_debuggerScript.isEmpty()); 594 ASSERT(!m_debuggerScript.isEmpty());
594 m_debuggerScript.clear(); 595 m_debuggerScript.clear();
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 { 707 {
707 return PassOwnPtr<ScriptSourceCode>(); 708 return PassOwnPtr<ScriptSourceCode>();
708 } 709 }
709 710
710 String ScriptDebugServer::preprocessEventListener(LocalFrame*, const String& sou rce, const String& url, const String& functionName) 711 String ScriptDebugServer::preprocessEventListener(LocalFrame*, const String& sou rce, const String& url, const String& functionName)
711 { 712 {
712 return source; 713 return source;
713 } 714 }
714 715
715 } // namespace blink 716 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/v8_inspector/InjectedScriptManager.cpp ('k') | sky/engine/v8_inspector/read_from_source_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698