Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/SourceLocation.h

Issue 2246233002: [DevTools] Move platform/v8_inspector classes under v8_inspector namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/CrossThreadCopier.h"
10 #include "platform/v8_inspector/public/V8StackTrace.h" 10 #include "platform/v8_inspector/public/V8StackTrace.h"
11 #include "wtf/Forward.h" 11 #include "wtf/Forward.h"
12 #include "wtf/text/WTFString.h" 12 #include "wtf/text/WTFString.h"
13 #include <memory> 13 #include <memory>
14 14
15 namespace blink { 15 namespace blink {
16 16
17 class ExecutionContext; 17 class ExecutionContext;
18 class TracedValue; 18 class TracedValue;
19 class V8StackTrace;
20 19
21 class CORE_EXPORT SourceLocation { 20 class CORE_EXPORT SourceLocation {
22 public: 21 public:
23 // Zero lineNumber and columnNumber mean unknown. Captures current stack tra ce. 22 // Zero lineNumber and columnNumber mean unknown. Captures current stack tra ce.
24 static std::unique_ptr<SourceLocation> capture(const String& url, unsigned l ineNumber, unsigned columnNumber); 23 static std::unique_ptr<SourceLocation> capture(const String& url, unsigned l ineNumber, unsigned columnNumber);
25 24
26 // Shortcut when location is unknown. Tries to capture call stack or parsing location if available. 25 // Shortcut when location is unknown. Tries to capture call stack or parsing location if available.
27 static std::unique_ptr<SourceLocation> capture(ExecutionContext* = nullptr); 26 static std::unique_ptr<SourceLocation> capture(ExecutionContext* = nullptr);
28 27
29 static std::unique_ptr<SourceLocation> fromMessage(v8::Isolate*, v8::Local<v 8::Message>, ExecutionContext*); 28 static std::unique_ptr<SourceLocation> fromMessage(v8::Isolate*, v8::Local<v 8::Message>, ExecutionContext*);
30 29
31 static std::unique_ptr<SourceLocation> fromFunction(v8::Local<v8::Function>) ; 30 static std::unique_ptr<SourceLocation> fromFunction(v8::Local<v8::Function>) ;
32 31
33 // Forces full stack trace. 32 // Forces full stack trace.
34 static std::unique_ptr<SourceLocation> captureWithFullStackTrace(); 33 static std::unique_ptr<SourceLocation> captureWithFullStackTrace();
35 34
36 static std::unique_ptr<SourceLocation> create(const String& url, unsigned li neNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace>, int scriptId = 0 ); 35 static std::unique_ptr<SourceLocation> create(const String& url, unsigned li neNumber, unsigned columnNumber, std::unique_ptr<v8_inspector::V8StackTrace>, in t scriptId = 0);
37 ~SourceLocation(); 36 ~SourceLocation();
38 37
39 bool isUnknown() const { return m_url.isNull() && !m_scriptId && !m_lineNumb er; } 38 bool isUnknown() const { return m_url.isNull() && !m_scriptId && !m_lineNumb er; }
40 const String& url() const { return m_url; } 39 const String& url() const { return m_url; }
41 unsigned lineNumber() const { return m_lineNumber; } 40 unsigned lineNumber() const { return m_lineNumber; }
42 unsigned columnNumber() const { return m_columnNumber; } 41 unsigned columnNumber() const { return m_columnNumber; }
43 int scriptId() const { return m_scriptId; } 42 int scriptId() const { return m_scriptId; }
44 std::unique_ptr<V8StackTrace> takeStackTrace() { return std::move(m_stackTra ce); } 43 std::unique_ptr<v8_inspector::V8StackTrace> takeStackTrace() { return std::m ove(m_stackTrace); }
45 44
46 std::unique_ptr<SourceLocation> clone() const; // Safe to pass between threa ds. 45 std::unique_ptr<SourceLocation> clone() const; // Safe to pass between threa ds.
47 46
48 // No-op when stack trace is unknown. 47 // No-op when stack trace is unknown.
49 void toTracedValue(TracedValue*, const char* name) const; 48 void toTracedValue(TracedValue*, const char* name) const;
50 49
51 // Could be null string when stack trace is unknown. 50 // Could be null string when stack trace is unknown.
52 String toString() const; 51 String toString() const;
53 52
54 // Could be null when stack trace is unknown. 53 // Could be null when stack trace is unknown.
55 std::unique_ptr<protocol::Runtime::API::StackTrace> buildInspectorObject() c onst; 54 std::unique_ptr<protocol::Runtime::API::StackTrace> buildInspectorObject() c onst;
56 55
57 private: 56 private:
58 SourceLocation(const String& url, unsigned lineNumber, unsigned columnNumber , std::unique_ptr<V8StackTrace>, int scriptId); 57 SourceLocation(const String& url, unsigned lineNumber, unsigned columnNumber , std::unique_ptr<v8_inspector::V8StackTrace>, int scriptId);
59 static std::unique_ptr<SourceLocation> createFromNonEmptyV8StackTrace(std::u nique_ptr<V8StackTrace>, int scriptId); 58 static std::unique_ptr<SourceLocation> createFromNonEmptyV8StackTrace(std::u nique_ptr<v8_inspector::V8StackTrace>, int scriptId);
60 59
61 String m_url; 60 String m_url;
62 unsigned m_lineNumber; 61 unsigned m_lineNumber;
63 unsigned m_columnNumber; 62 unsigned m_columnNumber;
64 std::unique_ptr<V8StackTrace> m_stackTrace; 63 std::unique_ptr<v8_inspector::V8StackTrace> m_stackTrace;
65 int m_scriptId; 64 int m_scriptId;
66 }; 65 };
67 66
68 } // namespace blink 67 } // namespace blink
69 68
70 #endif // SourceLocation_h 69 #endif // SourceLocation_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698