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

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

Issue 2532433003: [inspector] Split V8DebuggerScript implementation for wasm (Closed)
Patch Set: Minor refactoring 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 static std::unique_ptr<V8DebuggerScript> CreateWasm(
47 ~V8DebuggerScript(); 47 v8::Local<v8::DebugInterface::Script> script, String16 id, String16 url,
48 String16 source);
49
50 virtual ~V8DebuggerScript();
48 51
49 const String16& scriptId() const { return m_id; } 52 const String16& scriptId() const { return m_id; }
50 const String16& url() const { return m_url; } 53 const String16& url() const { return m_url; }
51 bool hasSourceURL() const { return !m_sourceURL.isEmpty(); } 54 bool hasSourceURL() const { return !m_sourceURL.isEmpty(); }
52 const String16& sourceURL() const; 55 const String16& sourceURL() const;
53 const String16& sourceMappingURL() const { return m_sourceMappingURL; } 56 virtual const String16& sourceMappingURL() const = 0;
54 String16 source(v8::Isolate*) const; 57 virtual String16 source(v8::Isolate*) const { return m_source; }
55 const String16& hash(v8::Isolate*) const; 58 const String16& hash(v8::Isolate*) const;
56 int startLine() const { return m_startLine; } 59 int startLine() const { return m_startLine; }
57 int startColumn() const { return m_startColumn; } 60 int startColumn() const { return m_startColumn; }
58 int endLine() const { return m_endLine; } 61 int endLine() const { return m_endLine; }
59 int endColumn() const { return m_endColumn; } 62 int endColumn() const { return m_endColumn; }
60 int executionContextId() const { return m_executionContextId; } 63 int executionContextId() const { return m_executionContextId; }
61 const String16& executionContextAuxData() const { 64 virtual const String16& executionContextAuxData() const = 0;
62 return m_executionContextAuxData; 65 virtual bool isLiveEdit() const = 0;
63 }
64 bool isLiveEdit() const { return m_isLiveEdit; }
65 66
66 void setSourceURL(const String16&); 67 void setSourceURL(const String16&);
67 void setSourceMappingURL(const String16&); 68 virtual void setSourceMappingURL(const String16&) {}
kozy 2016/11/30 18:34:37 If sourceMappingUrl getter is abstract, lets make
Clemens Hammacher 2016/12/02 17:44:13 Done.
68 void setSource(v8::Local<v8::String>); 69 virtual void setSource(v8::Local<v8::String>) {}
kozy 2016/11/30 18:34:37 Can we assign new source to m_source here?
Clemens Hammacher 2016/12/02 17:44:13 Done. But note that this requires to include strin
69 70
70 bool getPossibleBreakpoints( 71 virtual bool getPossibleBreakpoints(
71 const v8::DebugInterface::Location& start, 72 const v8::DebugInterface::Location& start,
72 const v8::DebugInterface::Location& end, 73 const v8::DebugInterface::Location& end,
73 std::vector<v8::DebugInterface::Location>* locations); 74 std::vector<v8::DebugInterface::Location>* locations) = 0;
74 75
75 private: 76 protected:
77 V8DebuggerScript(v8::Isolate*, String16 id, String16 url);
78
76 String16 m_id; 79 String16 m_id;
77 String16 m_url; 80 String16 m_url;
78 String16 m_sourceURL; 81 String16 m_sourceURL;
79 String16 m_sourceMappingURL;
80 v8::Global<v8::String> m_sourceObj;
81 String16 m_source; 82 String16 m_source;
82 mutable String16 m_hash; 83 mutable String16 m_hash;
83 int m_startLine = 0; 84 int m_startLine = 0;
84 int m_startColumn = 0; 85 int m_startColumn = 0;
85 int m_endLine = 0; 86 int m_endLine = 0;
86 int m_endColumn = 0; 87 int m_endColumn = 0;
87 int m_executionContextId = 0; 88 int m_executionContextId = 0;
88 String16 m_executionContextAuxData;
89 bool m_isLiveEdit = false;
90 89
91 v8::Isolate* m_isolate; 90 v8::Isolate* m_isolate;
92 v8::Global<v8::DebugInterface::Script> m_script;
93 91
92 private:
94 DISALLOW_COPY_AND_ASSIGN(V8DebuggerScript); 93 DISALLOW_COPY_AND_ASSIGN(V8DebuggerScript);
95 }; 94 };
96 95
97 } // namespace v8_inspector 96 } // namespace v8_inspector
98 97
99 #endif // V8_INSPECTOR_V8DEBUGGERSCRIPT_H_ 98 #endif // V8_INSPECTOR_V8DEBUGGERSCRIPT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698