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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/InjectedScript.h

Issue 1730383003: DevTools: consistently use Maybe for optional values in the protocol generator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed Created 4 years, 9 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 30 matching lines...) Expand all
41 namespace blink { 41 namespace blink {
42 42
43 class InjectedScriptManager; 43 class InjectedScriptManager;
44 class JSONValue; 44 class JSONValue;
45 class RemoteObjectId; 45 class RemoteObjectId;
46 class V8FunctionCall; 46 class V8FunctionCall;
47 class V8DebuggerClient; 47 class V8DebuggerClient;
48 48
49 typedef String ErrorString; 49 typedef String ErrorString;
50 50
51 using protocol::OptionalValue; 51 using protocol::Maybe;
52 52
53 class InjectedScript final { 53 class InjectedScript final {
54 USING_FAST_MALLOC(InjectedScript); 54 USING_FAST_MALLOC(InjectedScript);
55 public: 55 public:
56 ~InjectedScript(); 56 ~InjectedScript();
57 57
58 void evaluate( 58 void evaluate(
59 ErrorString*, 59 ErrorString*,
60 const String& expression, 60 const String& expression,
61 const String& objectGroup, 61 const String& objectGroup,
62 bool includeCommandLineAPI, 62 bool includeCommandLineAPI,
63 bool returnByValue, 63 bool returnByValue,
64 bool generatePreview, 64 bool generatePreview,
65 OwnPtr<protocol::Runtime::RemoteObject>* result, 65 OwnPtr<protocol::Runtime::RemoteObject>* result,
66 OptionalValue<bool>* wasThrown, 66 Maybe<bool>* wasThrown,
67 OwnPtr<protocol::Runtime::ExceptionDetails>*); 67 Maybe<protocol::Runtime::ExceptionDetails>*);
68 void callFunctionOn( 68 void callFunctionOn(
69 ErrorString*, 69 ErrorString*,
70 const String& objectId, 70 const String& objectId,
71 const String& expression, 71 const String& expression,
72 const String& arguments, 72 const String& arguments,
73 bool returnByValue, 73 bool returnByValue,
74 bool generatePreview, 74 bool generatePreview,
75 OwnPtr<protocol::Runtime::RemoteObject>* result, 75 OwnPtr<protocol::Runtime::RemoteObject>* result,
76 OptionalValue<bool>* wasThrown); 76 Maybe<bool>* wasThrown);
77 void evaluateOnCallFrame( 77 void evaluateOnCallFrame(
78 ErrorString*, 78 ErrorString*,
79 v8::Local<v8::Object> callFrames, 79 v8::Local<v8::Object> callFrames,
80 bool isAsyncCallStack, 80 bool isAsyncCallStack,
81 const String& callFrameId, 81 const String& callFrameId,
82 const String& expression, 82 const String& expression,
83 const String& objectGroup, 83 const String& objectGroup,
84 bool includeCommandLineAPI, 84 bool includeCommandLineAPI,
85 bool returnByValue, 85 bool returnByValue,
86 bool generatePreview, 86 bool generatePreview,
87 OwnPtr<protocol::Runtime::RemoteObject>* result, 87 OwnPtr<protocol::Runtime::RemoteObject>* result,
88 OptionalValue<bool>* wasThrown, 88 Maybe<bool>* wasThrown,
89 OwnPtr<protocol::Runtime::ExceptionDetails>*); 89 Maybe<protocol::Runtime::ExceptionDetails>*);
90 void restartFrame(ErrorString*, v8::Local<v8::Object> callFrames, const Stri ng& callFrameId); 90 void restartFrame(ErrorString*, v8::Local<v8::Object> callFrames, const Stri ng& callFrameId);
91 void getStepInPositions(ErrorString*, v8::Local<v8::Object> callFrames, cons t String& callFrameId, OwnPtr<protocol::Array<protocol::Debugger::Location>>* po sitions); 91 void getStepInPositions(ErrorString*, v8::Local<v8::Object> callFrames, cons t String& callFrameId, Maybe<protocol::Array<protocol::Debugger::Location>>* pos itions);
92 void setVariableValue(ErrorString*, v8::Local<v8::Object> callFrames, const OptionalValue<String>& callFrameIdOpt, const OptionalValue<String>& functionObje ctIdOpt, int scopeNumber, const String& variableName, const String& newValueStr) ; 92 void setVariableValue(ErrorString*, v8::Local<v8::Object> callFrames, const Maybe<String>& callFrameIdOpt, const Maybe<String>& functionObjectIdOpt, int sco peNumber, const String& variableName, const String& newValueStr);
93 void getFunctionDetails(ErrorString*, const String& functionId, OwnPtr<proto col::Debugger::FunctionDetails>* result); 93 void getFunctionDetails(ErrorString*, const String& functionId, OwnPtr<proto col::Debugger::FunctionDetails>* result);
94 void getGeneratorObjectDetails(ErrorString*, const String& functionId, OwnPt r<protocol::Debugger::GeneratorObjectDetails>* result); 94 void getGeneratorObjectDetails(ErrorString*, const String& functionId, OwnPt r<protocol::Debugger::GeneratorObjectDetails>* result);
95 void getCollectionEntries(ErrorString*, const String& objectId, OwnPtr<proto col::Array<protocol::Debugger::CollectionEntry>>* result); 95 void getCollectionEntries(ErrorString*, const String& objectId, OwnPtr<proto col::Array<protocol::Debugger::CollectionEntry>>* result);
96 void getProperties(ErrorString*, const String& objectId, bool ownProperties, bool accessorPropertiesOnly, bool generatePreview, OwnPtr<protocol::Array<proto col::Runtime::PropertyDescriptor>>* result, OwnPtr<protocol::Runtime::ExceptionD etails>*); 96 void getProperties(ErrorString*, const String& objectId, bool ownProperties, bool accessorPropertiesOnly, bool generatePreview, OwnPtr<protocol::Array<proto col::Runtime::PropertyDescriptor>>* result, Maybe<protocol::Runtime::ExceptionDe tails>*);
97 void getInternalProperties(ErrorString*, const String& objectId, OwnPtr<prot ocol::Array<protocol::Runtime::InternalPropertyDescriptor>>* result, OwnPtr<prot ocol::Runtime::ExceptionDetails>*); 97 void getInternalProperties(ErrorString*, const String& objectId, Maybe<proto col::Array<protocol::Runtime::InternalPropertyDescriptor>>* result, Maybe<protoc ol::Runtime::ExceptionDetails>*);
98 void releaseObject(const String& objectId); 98 void releaseObject(const String& objectId);
99 v8::MaybeLocal<v8::Value> runCompiledScript(v8::Local<v8::Script>, bool incl udeCommandLineAPI); 99 v8::MaybeLocal<v8::Value> runCompiledScript(v8::Local<v8::Script>, bool incl udeCommandLineAPI);
100 100
101 PassOwnPtr<protocol::Array<protocol::Debugger::CallFrame>> wrapCallFrames(v8 ::Local<v8::Object>, int asyncOrdinal); 101 PassOwnPtr<protocol::Array<protocol::Debugger::CallFrame>> wrapCallFrames(v8 ::Local<v8::Object>, int asyncOrdinal);
102 102
103 PassOwnPtr<protocol::Runtime::RemoteObject> wrapObject(v8::Local<v8::Value>, const String& groupName, bool generatePreview = false) const; 103 PassOwnPtr<protocol::Runtime::RemoteObject> wrapObject(v8::Local<v8::Value>, const String& groupName, bool generatePreview = false) const;
104 PassOwnPtr<protocol::Runtime::RemoteObject> wrapTable(v8::Local<v8::Value> t able, v8::Local<v8::Value> columns) const; 104 PassOwnPtr<protocol::Runtime::RemoteObject> wrapTable(v8::Local<v8::Value> t able, v8::Local<v8::Value> columns) const;
105 v8::Local<v8::Value> findObject(const RemoteObjectId&) const; 105 v8::Local<v8::Value> findObject(const RemoteObjectId&) const;
106 String objectGroupName(const RemoteObjectId&) const; 106 String objectGroupName(const RemoteObjectId&) const;
107 void releaseObjectGroup(const String&); 107 void releaseObjectGroup(const String&);
108 108
109 void setCustomObjectFormatterEnabled(bool); 109 void setCustomObjectFormatterEnabled(bool);
110 int contextId() { return m_contextId; } 110 int contextId() { return m_contextId; }
111 String origin() const { return m_origin; } 111 String origin() const { return m_origin; }
112 void setOrigin(const String& origin) { m_origin = origin; } 112 void setOrigin(const String& origin) { m_origin = origin; }
113 113
114 v8::Isolate* isolate() { return m_isolate; } 114 v8::Isolate* isolate() { return m_isolate; }
115 v8::Local<v8::Context> context() const; 115 v8::Local<v8::Context> context() const;
116 void dispose(); 116 void dispose();
117 117
118 private: 118 private:
119 friend InjectedScript* InjectedScriptManager::injectedScriptFor(v8::Local<v8 ::Context>); 119 friend InjectedScript* InjectedScriptManager::injectedScriptFor(v8::Local<v8 ::Context>);
120 InjectedScript(InjectedScriptManager*, v8::Local<v8::Context>, v8::Local<v8: :Object>, V8DebuggerClient*, PassRefPtr<InjectedScriptNative>, int contextId); 120 InjectedScript(InjectedScriptManager*, v8::Local<v8::Context>, v8::Local<v8: :Object>, V8DebuggerClient*, PassRefPtr<InjectedScriptNative>, int contextId);
121 121
122 bool canAccessInspectedWindow() const; 122 bool canAccessInspectedWindow() const;
123 v8::Local<v8::Value> v8Value() const; 123 v8::Local<v8::Value> v8Value() const;
124 v8::Local<v8::Value> callFunctionWithEvalEnabled(V8FunctionCall&, bool& hadE xception) const; 124 v8::Local<v8::Value> callFunctionWithEvalEnabled(V8FunctionCall&, bool& hadE xception) const;
125 void makeCall(V8FunctionCall&, RefPtr<JSONValue>* result); 125 void makeCall(V8FunctionCall&, RefPtr<JSONValue>* result);
126 void makeEvalCall(ErrorString*, V8FunctionCall&, OwnPtr<protocol::Runtime::R emoteObject>* result, OptionalValue<bool>* wasThrown, OwnPtr<protocol::Runtime:: ExceptionDetails>* = 0); 126 void makeEvalCall(ErrorString*, V8FunctionCall&, OwnPtr<protocol::Runtime::R emoteObject>* result, Maybe<bool>* wasThrown, Maybe<protocol::Runtime::Exception Details>* = 0);
127 void makeCallWithExceptionDetails(V8FunctionCall&, RefPtr<JSONValue>* result , OwnPtr<protocol::Runtime::ExceptionDetails>*); 127 void makeCallWithExceptionDetails(V8FunctionCall&, RefPtr<JSONValue>* result , Maybe<protocol::Runtime::ExceptionDetails>*);
128 128
129 InjectedScriptManager* m_manager; 129 InjectedScriptManager* m_manager;
130 v8::Isolate* m_isolate; 130 v8::Isolate* m_isolate;
131 v8::Global<v8::Context> m_context; 131 v8::Global<v8::Context> m_context;
132 v8::Global<v8::Value> m_value; 132 v8::Global<v8::Value> m_value;
133 V8DebuggerClient* m_client; 133 V8DebuggerClient* m_client;
134 RefPtr<InjectedScriptNative> m_native; 134 RefPtr<InjectedScriptNative> m_native;
135 int m_contextId; 135 int m_contextId;
136 String m_origin; 136 String m_origin;
137 }; 137 };
138 138
139 } // namespace blink 139 } // namespace blink
140 140
141 #endif 141 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698