| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
| 4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "core/inspector/InspectorConsoleAgent.h" | 35 #include "core/inspector/InspectorConsoleAgent.h" |
| 36 #include "core/inspector/v8/V8Debugger.h" | 36 #include "core/inspector/v8/V8Debugger.h" |
| 37 #include "core/inspector/v8/V8DebuggerAgent.h" | 37 #include "core/inspector/v8/V8DebuggerAgent.h" |
| 38 #include "platform/JSONValues.h" | 38 #include "platform/JSONValues.h" |
| 39 | 39 |
| 40 #include "wtf/RefPtr.h" | 40 #include "wtf/RefPtr.h" |
| 41 #include "wtf/text/StringBuilder.h" | 41 #include "wtf/text/StringBuilder.h" |
| 42 | 42 |
| 43 namespace blink { | 43 namespace blink { |
| 44 | 44 |
| 45 PassRefPtrWillBeRawPtr<InjectedScriptHost> InjectedScriptHost::create() | 45 PassRefPtr<InjectedScriptHost> InjectedScriptHost::create() |
| 46 { | 46 { |
| 47 return adoptRefWillBeNoop(new InjectedScriptHost()); | 47 return adoptRef(new InjectedScriptHost()); |
| 48 } | 48 } |
| 49 | 49 |
| 50 InjectedScriptHost::InjectedScriptHost() | 50 InjectedScriptHost::InjectedScriptHost() |
| 51 : m_consoleAgent(nullptr) | 51 : m_debuggerAgent(nullptr) |
| 52 , m_debuggerAgent(nullptr) | |
| 53 , m_inspectCallback(nullptr) | 52 , m_inspectCallback(nullptr) |
| 53 , m_clearConsoleCallback(nullptr) |
| 54 , m_debugger(nullptr) | 54 , m_debugger(nullptr) |
| 55 { | 55 { |
| 56 m_defaultInspectableObject = adoptPtrWillBeNoop(new InspectableObject()); | 56 m_defaultInspectableObject = adoptPtr(new InspectableObject()); |
| 57 } | 57 } |
| 58 | 58 |
| 59 InjectedScriptHost::~InjectedScriptHost() | 59 InjectedScriptHost::~InjectedScriptHost() |
| 60 { | 60 { |
| 61 } | 61 } |
| 62 | 62 |
| 63 DEFINE_TRACE(InjectedScriptHost) | |
| 64 { | |
| 65 visitor->trace(m_consoleAgent); | |
| 66 visitor->trace(m_inspectedObjects); | |
| 67 visitor->trace(m_defaultInspectableObject); | |
| 68 } | |
| 69 | |
| 70 void InjectedScriptHost::disconnect() | 63 void InjectedScriptHost::disconnect() |
| 71 { | 64 { |
| 72 m_consoleAgent = nullptr; | |
| 73 m_debuggerAgent = nullptr; | 65 m_debuggerAgent = nullptr; |
| 74 m_inspectCallback = nullptr; | 66 m_inspectCallback = nullptr; |
| 67 m_clearConsoleCallback = nullptr; |
| 75 m_debugger = nullptr; | 68 m_debugger = nullptr; |
| 76 } | 69 } |
| 77 | 70 |
| 78 void InjectedScriptHost::inspectImpl(PassRefPtr<JSONValue> object, PassRefPtr<JS
ONValue> hints) | 71 void InjectedScriptHost::inspectImpl(PassRefPtr<JSONValue> object, PassRefPtr<JS
ONValue> hints) |
| 79 { | 72 { |
| 80 if (m_inspectCallback) { | 73 if (m_inspectCallback) { |
| 81 RefPtr<TypeBuilder::Runtime::RemoteObject> remoteObject = TypeBuilder::R
untime::RemoteObject::runtimeCast(object); | 74 RefPtr<TypeBuilder::Runtime::RemoteObject> remoteObject = TypeBuilder::R
untime::RemoteObject::runtimeCast(object); |
| 82 (*m_inspectCallback)(remoteObject, hints->asObject()); | 75 (*m_inspectCallback)(remoteObject, hints->asObject()); |
| 83 } | 76 } |
| 84 } | 77 } |
| 85 | 78 |
| 86 void InjectedScriptHost::getEventListenersImpl(EventTarget* target, WillBeHeapVe
ctor<EventListenerInfo>& listenersArray) | 79 void InjectedScriptHost::getEventListenersImpl(EventTarget* target, WillBeHeapVe
ctor<EventListenerInfo>& listenersArray) |
| 87 { | 80 { |
| 88 EventListenerInfo::getEventListeners(target, listenersArray, false); | 81 EventListenerInfo::getEventListeners(target, listenersArray, false); |
| 89 } | 82 } |
| 90 | 83 |
| 91 void InjectedScriptHost::clearConsoleMessages() | 84 void InjectedScriptHost::clearConsoleMessages() |
| 92 { | 85 { |
| 93 if (m_consoleAgent) { | 86 if (m_clearConsoleCallback) |
| 94 ErrorString error; | 87 (*m_clearConsoleCallback)(); |
| 95 m_consoleAgent->clearMessages(&error); | |
| 96 } | |
| 97 } | 88 } |
| 98 | 89 |
| 99 ScriptValue InjectedScriptHost::InspectableObject::get(ScriptState*) | 90 ScriptValue InjectedScriptHost::InspectableObject::get(ScriptState*) |
| 100 { | 91 { |
| 101 return ScriptValue(); | 92 return ScriptValue(); |
| 102 }; | 93 }; |
| 103 | 94 |
| 104 void InjectedScriptHost::addInspectedObject(PassOwnPtrWillBeRawPtr<InjectedScrip
tHost::InspectableObject> object) | 95 void InjectedScriptHost::addInspectedObject(PassOwnPtr<InjectedScriptHost::Inspe
ctableObject> object) |
| 105 { | 96 { |
| 106 m_inspectedObjects.prepend(object); | 97 m_inspectedObjects.prepend(object); |
| 107 while (m_inspectedObjects.size() > 5) | 98 while (m_inspectedObjects.size() > 5) |
| 108 m_inspectedObjects.removeLast(); | 99 m_inspectedObjects.removeLast(); |
| 109 } | 100 } |
| 110 | 101 |
| 111 void InjectedScriptHost::clearInspectedObjects() | 102 void InjectedScriptHost::clearInspectedObjects() |
| 112 { | 103 { |
| 113 m_inspectedObjects.clear(); | 104 m_inspectedObjects.clear(); |
| 114 } | 105 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 145 m_debuggerAgent->setBreakpoint(scriptId, lineNumber, columnNumber, V8Deb
uggerAgent::MonitorCommandBreakpointSource, builder.toString()); | 136 m_debuggerAgent->setBreakpoint(scriptId, lineNumber, columnNumber, V8Deb
uggerAgent::MonitorCommandBreakpointSource, builder.toString()); |
| 146 } | 137 } |
| 147 | 138 |
| 148 void InjectedScriptHost::unmonitorFunction(const String& scriptId, int lineNumbe
r, int columnNumber) | 139 void InjectedScriptHost::unmonitorFunction(const String& scriptId, int lineNumbe
r, int columnNumber) |
| 149 { | 140 { |
| 150 if (m_debuggerAgent) | 141 if (m_debuggerAgent) |
| 151 m_debuggerAgent->removeBreakpoint(scriptId, lineNumber, columnNumber, V8
DebuggerAgent::MonitorCommandBreakpointSource); | 142 m_debuggerAgent->removeBreakpoint(scriptId, lineNumber, columnNumber, V8
DebuggerAgent::MonitorCommandBreakpointSource); |
| 152 } | 143 } |
| 153 | 144 |
| 154 } // namespace blink | 145 } // namespace blink |
| OLD | NEW |