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

Side by Side Diff: src/inspector/v8-debugger-script.h

Issue 2532433003: [inspector] Split V8DebuggerScript implementation for wasm (Closed)
Patch Set: Refactor a bit Created 4 years 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 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2010 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 22 matching lines...) Expand all
33 #include "src/base/macros.h" 33 #include "src/base/macros.h"
34 #include "src/inspector/string-16.h" 34 #include "src/inspector/string-16.h"
35 35
36 #include "include/v8.h" 36 #include "include/v8.h"
37 #include "src/debug/debug-interface.h" 37 #include "src/debug/debug-interface.h"
38 38
39 namespace v8_inspector { 39 namespace v8_inspector {
40 40
41 class V8DebuggerScript { 41 class V8DebuggerScript {
42 public: 42 public:
43 V8DebuggerScript(v8::Isolate* isolate, 43 static std::unique_ptr<V8DebuggerScript> Create(
44 v8::Local<v8::DebugInterface::Script> script, 44 v8::Isolate* isolate, v8::Local<v8::DebugInterface::Script> script,
45 bool isLiveEdit); 45 bool isLiveEdit);
46 V8DebuggerScript(String16 id, String16 url, String16 source); 46 // TODO(clemensh): Move away from using scripts for wasm (bug 667767).
47 ~V8DebuggerScript(); 47 static std::unique_ptr<V8DebuggerScript> CreateWasm(
48 v8::Local<v8::DebugInterface::Script> script, String16 id, String16 url,
49 String16 source);
50
51 virtual ~V8DebuggerScript();
48 52
49 const String16& scriptId() const { return m_id; } 53 const String16& scriptId() const { return m_id; }
50 const String16& url() const { return m_url; } 54 const String16& url() const { return m_url; }
51 bool hasSourceURL() const { return !m_sourceURL.isEmpty(); } 55 bool hasSourceURL() const { return !m_sourceURL.isEmpty(); }
52 const String16& sourceURL() const; 56 const String16& sourceURL() const;
53 const String16& sourceMappingURL() const { return m_sourceMappingURL; } 57 virtual const String16& sourceMappingURL() const = 0;
54 String16 source(v8::Isolate*) const; 58 virtual String16 source(v8::Isolate*) const { return m_source; }
55 const String16& hash(v8::Isolate*) const; 59 const String16& hash(v8::Isolate*) const;
56 int startLine() const { return m_startLine; } 60 int startLine() const { return m_startLine; }
57 int startColumn() const { return m_startColumn; } 61 int startColumn() const { return m_startColumn; }
58 int endLine() const { return m_endLine; } 62 int endLine() const { return m_endLine; }
59 int endColumn() const { return m_endColumn; } 63 int endColumn() const { return m_endColumn; }
60 int executionContextId() const { return m_executionContextId; } 64 int executionContextId() const { return m_executionContextId; }
61 const String16& executionContextAuxData() const { 65 virtual const String16& executionContextAuxData() const = 0;
62 return m_executionContextAuxData; 66 virtual bool isLiveEdit() const = 0;
63 }
64 bool isLiveEdit() const { return m_isLiveEdit; }
65 67
66 void setSourceURL(const String16&); 68 void setSourceURL(const String16&);
67 void setSourceMappingURL(const String16&); 69 virtual void setSourceMappingURL(const String16&) {}
68 void setSource(v8::Local<v8::String>); 70 virtual void setSource(v8::Local<v8::String>) {}
69 71
70 bool getPossibleBreakpoints( 72 virtual bool getPossibleBreakpoints(
71 const v8::DebugInterface::Location& start, 73 const v8::DebugInterface::Location& start,
72 const v8::DebugInterface::Location& end, 74 const v8::DebugInterface::Location& end,
73 std::vector<v8::DebugInterface::Location>* locations); 75 std::vector<v8::DebugInterface::Location>* locations) = 0;
74 76
75 private: 77 protected:
78 V8DebuggerScript(v8::Isolate*, String16 id, String16 url);
79
76 String16 m_id; 80 String16 m_id;
77 String16 m_url; 81 String16 m_url;
78 String16 m_sourceURL; 82 String16 m_sourceURL;
79 String16 m_sourceMappingURL;
80 v8::Global<v8::String> m_sourceObj;
81 String16 m_source; 83 String16 m_source;
82 mutable String16 m_hash; 84 mutable String16 m_hash;
83 int m_startLine = 0; 85 int m_startLine = 0;
84 int m_startColumn = 0; 86 int m_startColumn = 0;
85 int m_endLine = 0; 87 int m_endLine = 0;
86 int m_endColumn = 0; 88 int m_endColumn = 0;
87 int m_executionContextId = 0; 89 int m_executionContextId = 0;
88 String16 m_executionContextAuxData;
89 bool m_isLiveEdit = false;
90 90
91 v8::Isolate* m_isolate; 91 v8::Isolate* m_isolate;
92 v8::Global<v8::DebugInterface::Script> m_script;
93 92
93 private:
94 DISALLOW_COPY_AND_ASSIGN(V8DebuggerScript); 94 DISALLOW_COPY_AND_ASSIGN(V8DebuggerScript);
95 }; 95 };
96 96
97 } // namespace v8_inspector 97 } // namespace v8_inspector
98 98
99 #endif // V8_INSPECTOR_V8DEBUGGERSCRIPT_H_ 99 #endif // V8_INSPECTOR_V8DEBUGGERSCRIPT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698