OLD | NEW |
---|---|
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 19 matching lines...) Expand all Loading... | |
30 | 30 |
31 #include "platform/v8_inspector/V8DebuggerImpl.h" | 31 #include "platform/v8_inspector/V8DebuggerImpl.h" |
32 | 32 |
33 #include "platform/inspector_protocol/Values.h" | 33 #include "platform/inspector_protocol/Values.h" |
34 #include "platform/v8_inspector/Atomics.h" | 34 #include "platform/v8_inspector/Atomics.h" |
35 #include "platform/v8_inspector/DebuggerScript.h" | 35 #include "platform/v8_inspector/DebuggerScript.h" |
36 #include "platform/v8_inspector/InspectedContext.h" | 36 #include "platform/v8_inspector/InspectedContext.h" |
37 #include "platform/v8_inspector/ScriptBreakpoint.h" | 37 #include "platform/v8_inspector/ScriptBreakpoint.h" |
38 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" | 38 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
39 #include "platform/v8_inspector/V8InspectorSessionImpl.h" | 39 #include "platform/v8_inspector/V8InspectorSessionImpl.h" |
40 #include "platform/v8_inspector/V8ProfilerAgentImpl.h" | |
dgozman
2016/04/12 23:21:58
unused?
kozy
2016/04/12 23:34:26
Done.
| |
40 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" | 41 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" |
41 #include "platform/v8_inspector/V8StackTraceImpl.h" | 42 #include "platform/v8_inspector/V8StackTraceImpl.h" |
42 #include "platform/v8_inspector/V8StringUtil.h" | 43 #include "platform/v8_inspector/V8StringUtil.h" |
43 #include "platform/v8_inspector/public/V8DebuggerClient.h" | 44 #include "platform/v8_inspector/public/V8DebuggerClient.h" |
44 | 45 |
45 namespace blink { | 46 namespace blink { |
46 | 47 |
47 namespace { | 48 namespace { |
48 const char stepIntoV8MethodName[] = "stepIntoStatement"; | 49 const char stepIntoV8MethodName[] = "stepIntoStatement"; |
49 const char stepOutV8MethodName[] = "stepOutOfFunction"; | 50 const char stepOutV8MethodName[] = "stepOutOfFunction"; |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
763 int contextId = atomicIncrement(&s_lastContextId); | 764 int contextId = atomicIncrement(&s_lastContextId); |
764 String16 debugData = String16::number(info.contextGroupId) + "," + String16: :number(contextId) + "," + (info.isDefault ? "default" : "nondefault"); | 765 String16 debugData = String16::number(info.contextGroupId) + "," + String16: :number(contextId) + "," + (info.isDefault ? "default" : "nondefault"); |
765 v8::HandleScope scope(m_isolate); | 766 v8::HandleScope scope(m_isolate); |
766 v8::Context::Scope contextScope(info.context); | 767 v8::Context::Scope contextScope(info.context); |
767 info.context->SetEmbedderData(static_cast<int>(v8::Context::kDebugIdIndex), toV8String(m_isolate, debugData)); | 768 info.context->SetEmbedderData(static_cast<int>(v8::Context::kDebugIdIndex), toV8String(m_isolate, debugData)); |
768 | 769 |
769 if (!m_contexts.contains(info.contextGroupId)) | 770 if (!m_contexts.contains(info.contextGroupId)) |
770 m_contexts.set(info.contextGroupId, adoptPtr(new ContextByIdMap())); | 771 m_contexts.set(info.contextGroupId, adoptPtr(new ContextByIdMap())); |
771 ASSERT(!m_contexts.get(info.contextGroupId)->contains(contextId)); | 772 ASSERT(!m_contexts.get(info.contextGroupId)->contains(contextId)); |
772 | 773 |
773 OwnPtr<InspectedContext> contextOwner = adoptPtr(new InspectedContext(this, info, contextId)); | 774 OwnPtr<InspectedContext> contextOwner = adoptPtr(new InspectedContext(this, info, contextId, info.hasMemoryOnConsole)); |
774 InspectedContext* inspectedContext = contextOwner.get(); | 775 InspectedContext* inspectedContext = contextOwner.get(); |
775 m_contexts.get(info.contextGroupId)->set(contextId, contextOwner.release()); | 776 m_contexts.get(info.contextGroupId)->set(contextId, contextOwner.release()); |
776 | 777 |
777 if (V8InspectorSessionImpl* session = m_sessions.get(info.contextGroupId)) | 778 if (V8InspectorSessionImpl* session = m_sessions.get(info.contextGroupId)) |
778 session->runtimeAgentImpl()->reportExecutionContextCreated(inspectedCont ext); | 779 session->runtimeAgentImpl()->reportExecutionContextCreated(inspectedCont ext); |
779 } | 780 } |
780 | 781 |
781 void V8DebuggerImpl::contextDestroyed(v8::Local<v8::Context> context) | 782 void V8DebuggerImpl::contextDestroyed(v8::Local<v8::Context> context) |
782 { | 783 { |
783 int contextId = V8Debugger::contextId(context); | 784 int contextId = V8Debugger::contextId(context); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
828 if (!m_contexts.contains(contextGroupId)) | 829 if (!m_contexts.contains(contextGroupId)) |
829 return nullptr; | 830 return nullptr; |
830 return m_contexts.get(contextGroupId); | 831 return m_contexts.get(contextGroupId); |
831 } | 832 } |
832 | 833 |
833 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI d) | 834 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI d) |
834 { | 835 { |
835 return contextGroupId ? m_sessions.get(contextGroupId) : nullptr; | 836 return contextGroupId ? m_sessions.get(contextGroupId) : nullptr; |
836 } | 837 } |
837 | 838 |
839 v8::MaybeLocal<v8::FunctionTemplate> V8DebuggerImpl::functionTemplate(const Stri ng16& name) | |
840 { | |
841 if (!m_templates.contains(name)) | |
842 return v8::MaybeLocal<v8::FunctionTemplate>(); | |
843 return v8::Local<v8::FunctionTemplate>::New(m_isolate, *m_templates.get(name )); | |
dgozman
2016/04/12 23:21:58
global has .Get(isolate)
kozy
2016/04/12 23:34:26
Done.
| |
844 } | |
845 | |
846 void V8DebuggerImpl::setFunctionTemplate(const String16& name, v8::Local<v8::Fun ctionTemplate> functionTemplate) | |
847 { | |
848 OwnPtr<v8::Global<v8::FunctionTemplate>> global = adoptPtr(new v8::Global<v8 ::FunctionTemplate>(m_isolate, functionTemplate)); | |
849 m_templates.set(name, global.release()); | |
850 } | |
851 | |
838 } // namespace blink | 852 } // namespace blink |
OLD | NEW |