| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, 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 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "core/inspector/ScriptCallStack.h" | 31 #include "core/inspector/ScriptCallStack.h" |
| 32 | 32 |
| 33 #include "core/inspector/ScriptAsyncCallStack.h" | 33 #include "core/inspector/ScriptAsyncCallStack.h" |
| 34 #include "platform/TracedValue.h" | 34 #include "platform/TracedValue.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 PassRefPtrWillBeRawPtr<ScriptCallStack> ScriptCallStack::create(Vector<ScriptCal
lFrame>& frames) | 38 PassRefPtr<ScriptCallStack> ScriptCallStack::create(Vector<ScriptCallFrame>& fra
mes) |
| 39 { | 39 { |
| 40 return adoptRefWillBeNoop(new ScriptCallStack(frames)); | 40 return adoptRef(new ScriptCallStack(frames)); |
| 41 } | 41 } |
| 42 | 42 |
| 43 ScriptCallStack::ScriptCallStack(Vector<ScriptCallFrame>& frames) | 43 ScriptCallStack::ScriptCallStack(Vector<ScriptCallFrame>& frames) |
| 44 { | 44 { |
| 45 m_frames.swap(frames); | 45 m_frames.swap(frames); |
| 46 } | 46 } |
| 47 | 47 |
| 48 ScriptCallStack::~ScriptCallStack() | 48 ScriptCallStack::~ScriptCallStack() |
| 49 { | 49 { |
| 50 } | 50 } |
| 51 | 51 |
| 52 const ScriptCallFrame &ScriptCallStack::at(size_t index) const | 52 const ScriptCallFrame &ScriptCallStack::at(size_t index) const |
| 53 { | 53 { |
| 54 ASSERT(m_frames.size() > index); | 54 ASSERT(m_frames.size() > index); |
| 55 return m_frames[index]; | 55 return m_frames[index]; |
| 56 } | 56 } |
| 57 | 57 |
| 58 size_t ScriptCallStack::size() const | 58 size_t ScriptCallStack::size() const |
| 59 { | 59 { |
| 60 return m_frames.size(); | 60 return m_frames.size(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 PassRefPtrWillBeRawPtr<ScriptAsyncCallStack> ScriptCallStack::asyncCallStack() c
onst | 63 PassRefPtr<ScriptAsyncCallStack> ScriptCallStack::asyncCallStack() const |
| 64 { | 64 { |
| 65 return m_asyncCallStack; | 65 return m_asyncCallStack; |
| 66 } | 66 } |
| 67 | 67 |
| 68 void ScriptCallStack::setAsyncCallStack(PassRefPtrWillBeRawPtr<ScriptAsyncCallSt
ack> asyncCallStack) | 68 void ScriptCallStack::setAsyncCallStack(PassRefPtr<ScriptAsyncCallStack> asyncCa
llStack) |
| 69 { | 69 { |
| 70 m_asyncCallStack = asyncCallStack; | 70 m_asyncCallStack = asyncCallStack; |
| 71 } | 71 } |
| 72 | 72 |
| 73 PassRefPtr<TypeBuilder::Array<TypeBuilder::Console::CallFrame> > ScriptCallStack
::buildInspectorArray() const | 73 PassRefPtr<TypeBuilder::Array<TypeBuilder::Console::CallFrame> > ScriptCallStack
::buildInspectorArray() const |
| 74 { | 74 { |
| 75 RefPtr<TypeBuilder::Array<TypeBuilder::Console::CallFrame> > frames = TypeBu
ilder::Array<TypeBuilder::Console::CallFrame>::create(); | 75 RefPtr<TypeBuilder::Array<TypeBuilder::Console::CallFrame> > frames = TypeBu
ilder::Array<TypeBuilder::Console::CallFrame>::create(); |
| 76 for (size_t i = 0; i < m_frames.size(); i++) | 76 for (size_t i = 0; i < m_frames.size(); i++) |
| 77 frames->addItem(m_frames.at(i).buildInspectorObject()); | 77 frames->addItem(m_frames.at(i).buildInspectorObject()); |
| 78 return frames; | 78 return frames; |
| 79 } | 79 } |
| 80 | 80 |
| 81 void ScriptCallStack::toTracedValue(TracedValue* value, const char* name) const | 81 void ScriptCallStack::toTracedValue(TracedValue* value, const char* name) const |
| 82 { | 82 { |
| 83 value->beginArray(name); | 83 value->beginArray(name); |
| 84 for (size_t i = 0; i < m_frames.size(); i++) | 84 for (size_t i = 0; i < m_frames.size(); i++) |
| 85 m_frames.at(i).toTracedValue(value); | 85 m_frames.at(i).toTracedValue(value); |
| 86 value->endArray(); | 86 value->endArray(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 DEFINE_TRACE(ScriptCallStack) | |
| 90 { | |
| 91 visitor->trace(m_asyncCallStack); | |
| 92 } | |
| 93 | |
| 94 } // namespace blink | 89 } // namespace blink |
| OLD | NEW |