OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 void InspectorRuntimeAgent::restore() | 77 void InspectorRuntimeAgent::restore() |
78 { | 78 { |
79 if (!m_state->booleanProperty(InspectorRuntimeAgentState::runtimeEnabled, fa
lse)) | 79 if (!m_state->booleanProperty(InspectorRuntimeAgentState::runtimeEnabled, fa
lse)) |
80 return; | 80 return; |
81 m_v8RuntimeAgent->restore(); | 81 m_v8RuntimeAgent->restore(); |
82 ErrorString errorString; | 82 ErrorString errorString; |
83 enable(&errorString); | 83 enable(&errorString); |
84 } | 84 } |
85 | 85 |
86 void InspectorRuntimeAgent::evaluate(ErrorString* errorString, | 86 void InspectorRuntimeAgent::evaluate(ErrorString* errorString, |
87 const String& expression, | 87 const String16& expression, |
88 const Maybe<String>& objectGroup, | 88 const Maybe<String16>& objectGroup, |
89 const Maybe<bool>& includeCommandLineAPI, | 89 const Maybe<bool>& includeCommandLineAPI, |
90 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole, | 90 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole, |
91 const Maybe<int>& optExecutionContextId, | 91 const Maybe<int>& optExecutionContextId, |
92 const Maybe<bool>& returnByValue, | 92 const Maybe<bool>& returnByValue, |
93 const Maybe<bool>& generatePreview, | 93 const Maybe<bool>& generatePreview, |
94 OwnPtr<protocol::Runtime::RemoteObject>* result, | 94 OwnPtr<protocol::Runtime::RemoteObject>* result, |
95 Maybe<bool>* wasThrown, | 95 Maybe<bool>* wasThrown, |
96 Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) | 96 Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) |
97 { | 97 { |
98 int executionContextId; | 98 int executionContextId; |
99 if (optExecutionContextId.isJust()) { | 99 if (optExecutionContextId.isJust()) { |
100 executionContextId = optExecutionContextId.fromJust(); | 100 executionContextId = optExecutionContextId.fromJust(); |
101 } else { | 101 } else { |
102 v8::HandleScope handles(defaultScriptState()->isolate()); | 102 v8::HandleScope handles(defaultScriptState()->isolate()); |
103 executionContextId = m_v8RuntimeAgent->ensureDefaultContextAvailable(def
aultScriptState()->context()); | 103 executionContextId = m_v8RuntimeAgent->ensureDefaultContextAvailable(def
aultScriptState()->context()); |
104 } | 104 } |
105 MuteConsoleScope<InspectorRuntimeAgent> muteScope; | 105 MuteConsoleScope<InspectorRuntimeAgent> muteScope; |
106 if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false)) | 106 if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false)) |
107 muteScope.enter(this); | 107 muteScope.enter(this); |
108 m_v8RuntimeAgent->evaluate(errorString, expression, objectGroup, includeComm
andLineAPI, doNotPauseOnExceptionsAndMuteConsole, executionContextId, returnByVa
lue, generatePreview, result, wasThrown, exceptionDetails); | 108 m_v8RuntimeAgent->evaluate(errorString, expression, objectGroup, includeComm
andLineAPI, doNotPauseOnExceptionsAndMuteConsole, executionContextId, returnByVa
lue, generatePreview, result, wasThrown, exceptionDetails); |
109 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data(
)); | 109 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data(
)); |
110 } | 110 } |
111 | 111 |
112 void InspectorRuntimeAgent::callFunctionOn(ErrorString* errorString, | 112 void InspectorRuntimeAgent::callFunctionOn(ErrorString* errorString, |
113 const String& objectId, | 113 const String16& objectId, |
114 const String& expression, | 114 const String16& expression, |
115 const Maybe<protocol::Array<protocol::Runtime::CallArgument>>& optionalArgum
ents, | 115 const Maybe<protocol::Array<protocol::Runtime::CallArgument>>& optionalArgum
ents, |
116 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole, | 116 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole, |
117 const Maybe<bool>& returnByValue, | 117 const Maybe<bool>& returnByValue, |
118 const Maybe<bool>& generatePreview, | 118 const Maybe<bool>& generatePreview, |
119 OwnPtr<protocol::Runtime::RemoteObject>* result, | 119 OwnPtr<protocol::Runtime::RemoteObject>* result, |
120 Maybe<bool>* wasThrown) | 120 Maybe<bool>* wasThrown) |
121 { | 121 { |
122 MuteConsoleScope<InspectorRuntimeAgent> muteScope; | 122 MuteConsoleScope<InspectorRuntimeAgent> muteScope; |
123 if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false)) | 123 if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false)) |
124 muteScope.enter(this); | 124 muteScope.enter(this); |
125 m_v8RuntimeAgent->callFunctionOn(errorString, objectId, expression, optional
Arguments, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview,
result, wasThrown); | 125 m_v8RuntimeAgent->callFunctionOn(errorString, objectId, expression, optional
Arguments, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview,
result, wasThrown); |
126 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data(
)); | 126 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data(
)); |
127 } | 127 } |
128 | 128 |
129 void InspectorRuntimeAgent::getProperties(ErrorString* errorString, | 129 void InspectorRuntimeAgent::getProperties(ErrorString* errorString, |
130 const String& objectId, | 130 const String16& objectId, |
131 const Maybe<bool>& ownProperties, | 131 const Maybe<bool>& ownProperties, |
132 const Maybe<bool>& accessorPropertiesOnly, | 132 const Maybe<bool>& accessorPropertiesOnly, |
133 const Maybe<bool>& generatePreview, | 133 const Maybe<bool>& generatePreview, |
134 OwnPtr<protocol::Array<protocol::Runtime::PropertyDescriptor>>* result, | 134 OwnPtr<protocol::Array<protocol::Runtime::PropertyDescriptor>>* result, |
135 Maybe<protocol::Array<protocol::Runtime::InternalPropertyDescriptor>>* inter
nalProperties, | 135 Maybe<protocol::Array<protocol::Runtime::InternalPropertyDescriptor>>* inter
nalProperties, |
136 Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) | 136 Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) |
137 { | 137 { |
138 MuteConsoleScope<InspectorRuntimeAgent> muteScope(this); | 138 MuteConsoleScope<InspectorRuntimeAgent> muteScope(this); |
139 m_v8RuntimeAgent->getProperties(errorString, objectId, ownProperties, access
orPropertiesOnly, generatePreview, result, internalProperties, exceptionDetails)
; | 139 m_v8RuntimeAgent->getProperties(errorString, objectId, ownProperties, access
orPropertiesOnly, generatePreview, result, internalProperties, exceptionDetails)
; |
140 } | 140 } |
141 | 141 |
142 void InspectorRuntimeAgent::releaseObject(ErrorString* errorString, const String
& objectId) | 142 void InspectorRuntimeAgent::releaseObject(ErrorString* errorString, const String
16& objectId) |
143 { | 143 { |
144 m_v8RuntimeAgent->releaseObject(errorString, objectId); | 144 m_v8RuntimeAgent->releaseObject(errorString, objectId); |
145 } | 145 } |
146 | 146 |
147 void InspectorRuntimeAgent::releaseObjectGroup(ErrorString* errorString, const S
tring& objectGroup) | 147 void InspectorRuntimeAgent::releaseObjectGroup(ErrorString* errorString, const S
tring16& objectGroup) |
148 { | 148 { |
149 m_v8RuntimeAgent->releaseObjectGroup(errorString, objectGroup); | 149 m_v8RuntimeAgent->releaseObjectGroup(errorString, objectGroup); |
150 } | 150 } |
151 | 151 |
152 void InspectorRuntimeAgent::run(ErrorString* errorString) | 152 void InspectorRuntimeAgent::run(ErrorString* errorString) |
153 { | 153 { |
154 m_client->resumeStartup(); | 154 m_client->resumeStartup(); |
155 } | 155 } |
156 | 156 |
157 void InspectorRuntimeAgent::setCustomObjectFormatterEnabled(ErrorString* errorSt
ring, bool enabled) | 157 void InspectorRuntimeAgent::setCustomObjectFormatterEnabled(ErrorString* errorSt
ring, bool enabled) |
158 { | 158 { |
159 m_v8RuntimeAgent->setCustomObjectFormatterEnabled(errorString, enabled); | 159 m_v8RuntimeAgent->setCustomObjectFormatterEnabled(errorString, enabled); |
160 } | 160 } |
161 | 161 |
162 void InspectorRuntimeAgent::compileScript(ErrorString* errorString, | 162 void InspectorRuntimeAgent::compileScript(ErrorString* errorString, |
163 const String& inExpression, | 163 const String16& inExpression, |
164 const String& inSourceURL, | 164 const String16& inSourceURL, |
165 bool inPersistScript, | 165 bool inPersistScript, |
166 int inExecutionContextId, | 166 int inExecutionContextId, |
167 Maybe<protocol::Runtime::ScriptId>* optOutScriptId, | 167 Maybe<protocol::Runtime::ScriptId>* optOutScriptId, |
168 Maybe<protocol::Runtime::ExceptionDetails>* optOutExceptionDetails) | 168 Maybe<protocol::Runtime::ExceptionDetails>* optOutExceptionDetails) |
169 { | 169 { |
170 m_v8RuntimeAgent->compileScript(errorString, inExpression, inSourceURL, inPe
rsistScript, inExecutionContextId, optOutScriptId, optOutExceptionDetails); | 170 m_v8RuntimeAgent->compileScript(errorString, inExpression, inSourceURL, inPe
rsistScript, inExecutionContextId, optOutScriptId, optOutExceptionDetails); |
171 } | 171 } |
172 | 172 |
173 void InspectorRuntimeAgent::runScript(ErrorString* errorString, | 173 void InspectorRuntimeAgent::runScript(ErrorString* errorString, |
174 const String& inScriptId, | 174 const String16& inScriptId, |
175 int inExecutionContextId, | 175 int inExecutionContextId, |
176 const Maybe<String>& inObjectGroup, | 176 const Maybe<String16>& inObjectGroup, |
177 const Maybe<bool>& inDoNotPauseOnExceptionsAndMuteConsole, | 177 const Maybe<bool>& inDoNotPauseOnExceptionsAndMuteConsole, |
178 const Maybe<bool>& includeCommandLineAPI, | 178 const Maybe<bool>& includeCommandLineAPI, |
179 OwnPtr<protocol::Runtime::RemoteObject>* outResult, | 179 OwnPtr<protocol::Runtime::RemoteObject>* outResult, |
180 Maybe<protocol::Runtime::ExceptionDetails>* optOutExceptionDetails) | 180 Maybe<protocol::Runtime::ExceptionDetails>* optOutExceptionDetails) |
181 { | 181 { |
182 MuteConsoleScope<InspectorRuntimeAgent> muteScope; | 182 MuteConsoleScope<InspectorRuntimeAgent> muteScope; |
183 if (inDoNotPauseOnExceptionsAndMuteConsole.fromMaybe(false)) | 183 if (inDoNotPauseOnExceptionsAndMuteConsole.fromMaybe(false)) |
184 muteScope.enter(this); | 184 muteScope.enter(this); |
185 m_v8RuntimeAgent->runScript(errorString, inScriptId, inExecutionContextId, i
nObjectGroup, inDoNotPauseOnExceptionsAndMuteConsole, includeCommandLineAPI, out
Result, optOutExceptionDetails); | 185 m_v8RuntimeAgent->runScript(errorString, inScriptId, inExecutionContextId, i
nObjectGroup, inDoNotPauseOnExceptionsAndMuteConsole, includeCommandLineAPI, out
Result, optOutExceptionDetails); |
186 } | 186 } |
(...skipping 11 matching lines...) Expand all Loading... |
198 void InspectorRuntimeAgent::disable(ErrorString* errorString) | 198 void InspectorRuntimeAgent::disable(ErrorString* errorString) |
199 { | 199 { |
200 if (!m_enabled) | 200 if (!m_enabled) |
201 return; | 201 return; |
202 | 202 |
203 m_enabled = false; | 203 m_enabled = false; |
204 m_state->setBoolean(InspectorRuntimeAgentState::runtimeEnabled, false); | 204 m_state->setBoolean(InspectorRuntimeAgentState::runtimeEnabled, false); |
205 m_v8RuntimeAgent->disable(errorString); | 205 m_v8RuntimeAgent->disable(errorString); |
206 } | 206 } |
207 | 207 |
208 void InspectorRuntimeAgent::reportExecutionContextCreated(ScriptState* scriptSta
te, const String& type, const String& origin, const String& humanReadableName, c
onst String& frameId) | 208 void InspectorRuntimeAgent::reportExecutionContextCreated(ScriptState* scriptSta
te, const String16& type, const String16& origin, const String16& humanReadableN
ame, const String16& frameId) |
209 { | 209 { |
210 v8::HandleScope handles(scriptState->isolate()); | 210 v8::HandleScope handles(scriptState->isolate()); |
211 m_v8RuntimeAgent->reportExecutionContextCreated(scriptState->context(), type
, origin, humanReadableName, frameId); | 211 m_v8RuntimeAgent->reportExecutionContextCreated(scriptState->context(), type
, origin, humanReadableName, frameId); |
212 } | 212 } |
213 | 213 |
214 void InspectorRuntimeAgent::reportExecutionContextDestroyed(ScriptState* scriptS
tate) | 214 void InspectorRuntimeAgent::reportExecutionContextDestroyed(ScriptState* scriptS
tate) |
215 { | 215 { |
216 v8::HandleScope handles(scriptState->isolate()); | 216 v8::HandleScope handles(scriptState->isolate()); |
217 m_v8RuntimeAgent->reportExecutionContextDestroyed(scriptState->context()); | 217 m_v8RuntimeAgent->reportExecutionContextDestroyed(scriptState->context()); |
218 } | 218 } |
219 | 219 |
220 } // namespace blink | 220 } // namespace blink |
OLD | NEW |