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 22 matching lines...) Expand all Loading... |
33 #include "bindings/core/v8/V8PerIsolateData.h" | 33 #include "bindings/core/v8/V8PerIsolateData.h" |
34 #include "core/inspector/InspectorInstrumentation.h" | 34 #include "core/inspector/InspectorInstrumentation.h" |
35 #include "core/inspector/ThreadDebugger.h" | 35 #include "core/inspector/ThreadDebugger.h" |
36 #include "platform/ScriptForbiddenScope.h" | 36 #include "platform/ScriptForbiddenScope.h" |
37 #include "platform/TracedValue.h" | 37 #include "platform/TracedValue.h" |
38 #include "platform/v8_inspector/public/V8Debugger.h" | 38 #include "platform/v8_inspector/public/V8Debugger.h" |
39 #include "platform/v8_inspector/public/V8StackTrace.h" | 39 #include "platform/v8_inspector/public/V8StackTrace.h" |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
43 PassRefPtr<ScriptCallStack> ScriptCallStack::create(v8::Isolate* isolate, v8::Lo
cal<v8::StackTrace> stackTrace, size_t maxStackSize) | |
44 { | |
45 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | |
46 if (!data->threadDebugger()) | |
47 return nullptr; | |
48 std::unique_ptr<V8StackTrace> stack = data->threadDebugger()->debugger()->cr
eateStackTrace(stackTrace, maxStackSize); | |
49 return stack ? adoptRef(new ScriptCallStack(std::move(stack))) : nullptr; | |
50 } | |
51 | |
52 PassRefPtr<ScriptCallStack> ScriptCallStack::capture(size_t maxStackSize) | 43 PassRefPtr<ScriptCallStack> ScriptCallStack::capture(size_t maxStackSize) |
53 { | 44 { |
54 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 45 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
55 if (!isolate->InContext()) | 46 if (!isolate->InContext()) |
56 return nullptr; | 47 return nullptr; |
57 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 48 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
58 if (!data->threadDebugger()) | 49 if (!data->threadDebugger()) |
59 return nullptr; | 50 return nullptr; |
60 ScriptForbiddenScope::AllowUserAgentScript allowScripting; | 51 ScriptForbiddenScope::AllowUserAgentScript allowScripting; |
61 std::unique_ptr<V8StackTrace> stack = data->threadDebugger()->debugger()->ca
ptureStackTrace(maxStackSize); | 52 std::unique_ptr<V8StackTrace> stack = data->threadDebugger()->debugger()->ca
ptureStackTrace(maxStackSize); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 { | 119 { |
129 return m_stackTrace->toString(); | 120 return m_stackTrace->toString(); |
130 } | 121 } |
131 | 122 |
132 std::unique_ptr<V8StackTrace> ScriptCallStack::copyStackTrace() const | 123 std::unique_ptr<V8StackTrace> ScriptCallStack::copyStackTrace() const |
133 { | 124 { |
134 return m_stackTrace ? m_stackTrace->clone() : nullptr; | 125 return m_stackTrace ? m_stackTrace->clone() : nullptr; |
135 } | 126 } |
136 | 127 |
137 } // namespace blink | 128 } // namespace blink |
OLD | NEW |