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

Side by Side Diff: third_party/WebKit/Source/core/inspector/InjectedScript.h

Issue 1648523002: DevTools: move InjectedScript* to inspector/v8. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
(Empty)
1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 #ifndef InjectedScript_h
32 #define InjectedScript_h
33
34 #include "core/InspectorTypeBuilder.h"
35 #include "core/inspector/InjectedScriptManager.h"
36 #include "core/inspector/InjectedScriptNative.h"
37 #include "wtf/Allocator.h"
38 #include "wtf/Forward.h"
39 #include <v8.h>
40
41 namespace blink {
42
43 class InjectedScriptManager;
44 class JSONValue;
45 class RemoteObjectId;
46 class ScriptFunctionCall;
47 class V8DebuggerClient;
48
49 typedef String ErrorString;
50
51 class InjectedScript final {
52 USING_FAST_MALLOC(InjectedScript);
53 public:
54 ~InjectedScript();
55
56 void evaluate(
57 ErrorString*,
58 const String& expression,
59 const String& objectGroup,
60 bool includeCommandLineAPI,
61 bool returnByValue,
62 bool generatePreview,
63 RefPtr<TypeBuilder::Runtime::RemoteObject>* result,
64 TypeBuilder::OptOutput<bool>* wasThrown,
65 RefPtr<TypeBuilder::Debugger::ExceptionDetails>*);
66 void callFunctionOn(
67 ErrorString*,
68 const String& objectId,
69 const String& expression,
70 const String& arguments,
71 bool returnByValue,
72 bool generatePreview,
73 RefPtr<TypeBuilder::Runtime::RemoteObject>* result,
74 TypeBuilder::OptOutput<bool>* wasThrown);
75 void evaluateOnCallFrame(
76 ErrorString*,
77 v8::Local<v8::Object> callFrames,
78 bool isAsyncCallStack,
79 const String& callFrameId,
80 const String& expression,
81 const String& objectGroup,
82 bool includeCommandLineAPI,
83 bool returnByValue,
84 bool generatePreview,
85 RefPtr<TypeBuilder::Runtime::RemoteObject>* result,
86 TypeBuilder::OptOutput<bool>* wasThrown,
87 RefPtr<TypeBuilder::Debugger::ExceptionDetails>*);
88 void restartFrame(ErrorString*, v8::Local<v8::Object> callFrames, const Stri ng& callFrameId);
89 void getStepInPositions(ErrorString*, v8::Local<v8::Object> callFrames, cons t String& callFrameId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Location >>& positions);
90 void setVariableValue(ErrorString*, v8::Local<v8::Object> callFrames, const String* callFrameIdOpt, const String* functionObjectIdOpt, int scopeNumber, cons t String& variableName, const String& newValueStr);
91 void getFunctionDetails(ErrorString*, const String& functionId, RefPtr<TypeB uilder::Debugger::FunctionDetails>* result);
92 void getGeneratorObjectDetails(ErrorString*, const String& functionId, RefPt r<TypeBuilder::Debugger::GeneratorObjectDetails>* result);
93 void getCollectionEntries(ErrorString*, const String& objectId, RefPtr<TypeB uilder::Array<TypeBuilder::Debugger::CollectionEntry> >* result);
94 void getProperties(ErrorString*, const String& objectId, bool ownProperties, bool accessorPropertiesOnly, bool generatePreview, RefPtr<TypeBuilder::Array<Ty peBuilder::Runtime::PropertyDescriptor>>* result, RefPtr<TypeBuilder::Debugger:: ExceptionDetails>*);
95 void getInternalProperties(ErrorString*, const String& objectId, RefPtr<Type Builder::Array<TypeBuilder::Runtime::InternalPropertyDescriptor>>* result, RefPt r<TypeBuilder::Debugger::ExceptionDetails>*);
96 void releaseObject(const String& objectId);
97
98 PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame>> wrapCallFra mes(v8::Local<v8::Object>, int asyncOrdinal);
99
100 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapObject(v8::Local<v8::Valu e>, const String& groupName, bool generatePreview = false) const;
101 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapTable(v8::Local<v8::Value > table, v8::Local<v8::Value> columns) const;
102 v8::Local<v8::Value> findObject(const RemoteObjectId&) const;
103
104 String objectIdToObjectGroupName(const String& objectId) const;
105 void releaseObjectGroup(const String&);
106
107 void setCustomObjectFormatterEnabled(bool);
108 int contextId() { return m_contextId; }
109
110 v8::Isolate* isolate() { return m_isolate; }
111 v8::Local<v8::Context> context() const;
112 void dispose();
113
114 private:
115 friend InjectedScript* InjectedScriptManager::injectedScriptFor(v8::Local<v8 ::Context>);
116 InjectedScript(InjectedScriptManager*, v8::Local<v8::Context>, v8::Local<v8: :Object>, V8DebuggerClient*, PassRefPtr<InjectedScriptNative>, int contextId);
117
118 bool canAccessInspectedWindow() const;
119 v8::Local<v8::Value> v8Value() const;
120 v8::Local<v8::Value> callFunctionWithEvalEnabled(ScriptFunctionCall&, bool& hadException) const;
121 void makeCall(ScriptFunctionCall&, RefPtr<JSONValue>* result);
122 void makeEvalCall(ErrorString*, ScriptFunctionCall&, RefPtr<TypeBuilder::Run time::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown, RefPtr<Typ eBuilder::Debugger::ExceptionDetails>* = 0);
123 void makeCallWithExceptionDetails(ScriptFunctionCall&, RefPtr<JSONValue>* re sult, RefPtr<TypeBuilder::Debugger::ExceptionDetails>*);
124
125 InjectedScriptManager* m_manager;
126 v8::Isolate* m_isolate;
127 v8::Global<v8::Context> m_context;
128 v8::Global<v8::Value> m_value;
129 V8DebuggerClient* m_client;
130 RefPtr<InjectedScriptNative> m_native;
131 int m_contextId;
132 };
133
134 } // namespace blink
135
136 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698