OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SourceLocation_h | 5 #ifndef SourceLocation_h |
6 #define SourceLocation_h | 6 #define SourceLocation_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "platform/CrossThreadCopier.h" |
9 #include "platform/v8_inspector/public/V8StackTrace.h" | 10 #include "platform/v8_inspector/public/V8StackTrace.h" |
10 #include "wtf/Forward.h" | 11 #include "wtf/Forward.h" |
11 #include "wtf/PassOwnPtr.h" | 12 #include "wtf/PassOwnPtr.h" |
12 #include "wtf/text/WTFString.h" | 13 #include "wtf/text/WTFString.h" |
13 | 14 |
14 namespace blink { | 15 namespace blink { |
15 | 16 |
16 class ExecutionContext; | 17 class ExecutionContext; |
17 class TracedValue; | 18 class TracedValue; |
18 class V8StackTrace; | 19 class V8StackTrace; |
(...skipping 12 matching lines...) Expand all Loading... |
31 ~SourceLocation(); | 32 ~SourceLocation(); |
32 | 33 |
33 bool isEmpty() const { return m_url.isNull(); } | 34 bool isEmpty() const { return m_url.isNull(); } |
34 const String& url() const { return m_url; } | 35 const String& url() const { return m_url; } |
35 unsigned lineNumber() const { return m_lineNumber; } | 36 unsigned lineNumber() const { return m_lineNumber; } |
36 unsigned columnNumber() const { return m_columnNumber; } | 37 unsigned columnNumber() const { return m_columnNumber; } |
37 std::unique_ptr<V8StackTrace> takeStackTrace() { return std::move(m_stackTra
ce); } | 38 std::unique_ptr<V8StackTrace> takeStackTrace() { return std::move(m_stackTra
ce); } |
38 int scriptId() const { return m_scriptId; } | 39 int scriptId() const { return m_scriptId; } |
39 void toTracedValue(TracedValue*, const char* name) const; | 40 void toTracedValue(TracedValue*, const char* name) const; |
40 PassOwnPtr<SourceLocation> clone() const; | 41 PassOwnPtr<SourceLocation> clone() const; |
| 42 PassOwnPtr<SourceLocation> isolatedCopy() const; // Safe to pass between thr
eads. |
41 | 43 |
42 private: | 44 private: |
43 SourceLocation(const String& url, unsigned lineNumber, unsigned columnNumber
, std::unique_ptr<V8StackTrace>, int scriptId); | 45 SourceLocation(const String& url, unsigned lineNumber, unsigned columnNumber
, std::unique_ptr<V8StackTrace>, int scriptId); |
44 static PassOwnPtr<SourceLocation> createFromNonEmptyV8StackTrace(std::unique
_ptr<V8StackTrace>, int scriptId); | 46 static PassOwnPtr<SourceLocation> createFromNonEmptyV8StackTrace(std::unique
_ptr<V8StackTrace>, int scriptId); |
45 | 47 |
46 String m_url; | 48 String m_url; |
47 unsigned m_lineNumber; | 49 unsigned m_lineNumber; |
48 unsigned m_columnNumber; | 50 unsigned m_columnNumber; |
49 std::unique_ptr<V8StackTrace> m_stackTrace; | 51 std::unique_ptr<V8StackTrace> m_stackTrace; |
50 int m_scriptId; | 52 int m_scriptId; |
51 }; | 53 }; |
52 | 54 |
| 55 template <> |
| 56 struct CrossThreadCopier<PassOwnPtr<SourceLocation>> { |
| 57 using Type = PassOwnPtr<SourceLocation>; |
| 58 static Type copy(PassOwnPtr<SourceLocation> location) |
| 59 { |
| 60 return location ? location->isolatedCopy() : nullptr; |
| 61 } |
| 62 }; |
| 63 |
53 } // namespace blink | 64 } // namespace blink |
54 | 65 |
55 #endif // SourceLocation_h | 66 #endif // SourceLocation_h |
OLD | NEW |