1197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch// Copyright 2014 The Chromium Authors. All rights reserved. 2197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch// Use of this source code is governed by a BSD-style license that can be 3197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch// found in the LICENSE file. 4197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch 5197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#include "config.h" 6197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#include "core/inspector/ScriptAsyncCallStack.h" 7197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch 8c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)namespace blink { 9197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch 10197021e6b966cfb06891637935ef33fff06433d1Ben MurdochDEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ScriptAsyncCallStack); 11197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch 12197021e6b966cfb06891637935ef33fff06433d1Ben MurdochPassRefPtrWillBeRawPtr<ScriptAsyncCallStack> ScriptAsyncCallStack::create(const String& description, PassRefPtrWillBeRawPtr<ScriptCallStack> callStack, PassRefPtrWillBeRawPtr<ScriptAsyncCallStack> asyncStackTrace) 13197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch{ 14197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch return adoptRefWillBeNoop(new ScriptAsyncCallStack(description, callStack, asyncStackTrace)); 15197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch} 16197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch 17197021e6b966cfb06891637935ef33fff06433d1Ben MurdochScriptAsyncCallStack::ScriptAsyncCallStack(const String& description, PassRefPtrWillBeRawPtr<ScriptCallStack> callStack, PassRefPtrWillBeRawPtr<ScriptAsyncCallStack> asyncStackTrace) 18197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch : m_description(description) 19197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch , m_callStack(callStack) 20197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch , m_asyncStackTrace(asyncStackTrace) 21197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch{ 22197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch ASSERT(m_callStack); 23197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch} 24197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch 25197021e6b966cfb06891637935ef33fff06433d1Ben MurdochPassRefPtr<TypeBuilder::Console::AsyncStackTrace> ScriptAsyncCallStack::buildInspectorObject() const 26197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch{ 27197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch RefPtr<TypeBuilder::Console::AsyncStackTrace> result = TypeBuilder::Console::AsyncStackTrace::create() 28197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch .setCallFrames(m_callStack->buildInspectorArray()) 29197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch .release(); 30197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch result->setDescription(m_description); 31197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch if (m_asyncStackTrace) 32197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch result->setAsyncStackTrace(m_asyncStackTrace->buildInspectorObject()); 33197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch return result.release(); 34197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch} 35197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch 36197021e6b966cfb06891637935ef33fff06433d1Ben Murdochvoid ScriptAsyncCallStack::trace(Visitor* visitor) 37197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch{ 38197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch visitor->trace(m_callStack); 39197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch visitor->trace(m_asyncStackTrace); 40197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch} 41197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch 42c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)} // namespace blink 43