| 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 12 matching lines...) Expand all Loading... |
| 23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "platform/v8_inspector/InjectedScriptHost.h" | 31 #include "platform/v8_inspector/InjectedScriptHost.h" |
| 32 | 32 |
| 33 #include "platform/inspector_protocol/String16.h" | |
| 34 #include "platform/inspector_protocol/Values.h" | 33 #include "platform/inspector_protocol/Values.h" |
| 35 #include "platform/v8_inspector/V8InspectorSessionImpl.h" | 34 #include "platform/v8_inspector/V8InspectorSessionImpl.h" |
| 36 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" | 35 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" |
| 37 | 36 |
| 38 namespace blink { | 37 namespace blink { |
| 39 | 38 |
| 40 PassOwnPtr<InjectedScriptHost> InjectedScriptHost::create(V8DebuggerImpl* debugg
er, V8InspectorSessionImpl* session) | 39 PassOwnPtr<InjectedScriptHost> InjectedScriptHost::create(V8DebuggerImpl* debugg
er, V8InspectorSessionImpl* session) |
| 41 { | 40 { |
| 42 return adoptPtr(new InjectedScriptHost(debugger, session)); | 41 return adoptPtr(new InjectedScriptHost(debugger, session)); |
| 43 } | 42 } |
| 44 | 43 |
| 45 InjectedScriptHost::InjectedScriptHost(V8DebuggerImpl* debugger, V8InspectorSess
ionImpl* session) | 44 InjectedScriptHost::InjectedScriptHost(V8DebuggerImpl* debugger, V8InspectorSess
ionImpl* session) |
| 46 : m_debugger(debugger) | 45 : m_debugger(debugger) |
| 47 , m_session(session) | 46 , m_session(session) |
| 48 { | 47 { |
| 49 } | 48 } |
| 50 | 49 |
| 51 InjectedScriptHost::~InjectedScriptHost() | 50 InjectedScriptHost::~InjectedScriptHost() |
| 52 { | 51 { |
| 53 } | 52 } |
| 54 | 53 |
| 55 void InjectedScriptHost::inspectImpl(PassOwnPtr<protocol::Value> object, PassOwn
Ptr<protocol::Value> hints) | 54 void InjectedScriptHost::inspectImpl(PassOwnPtr<protocol::Value> object, PassOwn
Ptr<protocol::Value> hints) |
| 56 { | 55 { |
| 57 protocol::ErrorSupport errors; | 56 protocol::ErrorSupport errors; |
| 58 OwnPtr<protocol::Runtime::RemoteObject> remoteObject = protocol::Runtime::Re
moteObject::parse(object.get(), &errors); | 57 OwnPtr<protocol::Runtime::RemoteObject> remoteObject = protocol::Runtime::Re
moteObject::parse(object.get(), &errors); |
| 59 m_session->runtimeAgentImpl()->inspect(remoteObject.release(), protocol::Dic
tionaryValue::cast(hints)); | 58 m_session->runtimeAgentImpl()->inspect(remoteObject.release(), protocol::Dic
tionaryValue::cast(hints)); |
| 60 } | 59 } |
| 61 | 60 |
| 62 void InjectedScriptHost::addInspectedObject(PassOwnPtr<V8RuntimeAgent::Inspectab
le> object) | |
| 63 { | |
| 64 m_inspectedObjects.prepend(object); | |
| 65 while (m_inspectedObjects.size() > 5) | |
| 66 m_inspectedObjects.removeLast(); | |
| 67 } | |
| 68 | |
| 69 void InjectedScriptHost::clearInspectedObjects() | |
| 70 { | |
| 71 m_inspectedObjects.clear(); | |
| 72 } | |
| 73 | |
| 74 V8RuntimeAgent::Inspectable* InjectedScriptHost::inspectedObject(unsigned num) | |
| 75 { | |
| 76 if (num >= m_inspectedObjects.size()) | |
| 77 return nullptr; | |
| 78 return m_inspectedObjects[num].get(); | |
| 79 } | |
| 80 | |
| 81 } // namespace blink | 61 } // namespace blink |
| OLD | NEW |