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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp

Issue 1767883002: DevTools: generate string16-based handlers for v8_inspector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for landing 2 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) 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 , m_enabled(false) 64 , m_enabled(false)
65 { 65 {
66 } 66 }
67 67
68 V8RuntimeAgentImpl::~V8RuntimeAgentImpl() 68 V8RuntimeAgentImpl::~V8RuntimeAgentImpl()
69 { 69 {
70 } 70 }
71 71
72 void V8RuntimeAgentImpl::evaluate( 72 void V8RuntimeAgentImpl::evaluate(
73 ErrorString* errorString, 73 ErrorString* errorString,
74 const String& expression, 74 const String16& expression,
75 const Maybe<String>& objectGroup, 75 const Maybe<String16>& objectGroup,
76 const Maybe<bool>& includeCommandLineAPI, 76 const Maybe<bool>& includeCommandLineAPI,
77 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole, 77 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole,
78 const Maybe<int>& executionContextId, 78 const Maybe<int>& executionContextId,
79 const Maybe<bool>& returnByValue, 79 const Maybe<bool>& returnByValue,
80 const Maybe<bool>& generatePreview, 80 const Maybe<bool>& generatePreview,
81 OwnPtr<RemoteObject>* result, 81 OwnPtr<RemoteObject>* result,
82 Maybe<bool>* wasThrown, 82 Maybe<bool>* wasThrown,
83 Maybe<ExceptionDetails>* exceptionDetails) 83 Maybe<ExceptionDetails>* exceptionDetails)
84 { 84 {
85 if (!executionContextId.isJust()) { 85 if (!executionContextId.isJust()) {
86 *errorString = "Cannot find default execution context"; 86 *errorString = "Cannot find default execution context";
87 return; 87 return;
88 } 88 }
89 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (executionContextId.fromJust()); 89 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (executionContextId.fromJust());
90 if (!injectedScript) { 90 if (!injectedScript) {
91 *errorString = "Cannot find execution context with given id"; 91 *errorString = "Cannot find execution context with given id";
92 return; 92 return;
93 } 93 }
94 IgnoreExceptionsScope ignoreExceptionsScope(doNotPauseOnExceptionsAndMuteCon sole.fromMaybe(false) ? m_debugger : nullptr); 94 IgnoreExceptionsScope ignoreExceptionsScope(doNotPauseOnExceptionsAndMuteCon sole.fromMaybe(false) ? m_debugger : nullptr);
95 injectedScript->evaluate(errorString, expression, objectGroup.fromMaybe(""), includeCommandLineAPI.fromMaybe(false), returnByValue.fromMaybe(false), generat ePreview.fromMaybe(false), result, wasThrown, exceptionDetails); 95 injectedScript->evaluate(errorString, expression, objectGroup.fromMaybe(""), includeCommandLineAPI.fromMaybe(false), returnByValue.fromMaybe(false), generat ePreview.fromMaybe(false), result, wasThrown, exceptionDetails);
96 } 96 }
97 97
98 void V8RuntimeAgentImpl::callFunctionOn(ErrorString* errorString, 98 void V8RuntimeAgentImpl::callFunctionOn(ErrorString* errorString,
99 const String& objectId, 99 const String16& objectId,
100 const String& expression, 100 const String16& expression,
101 const Maybe<protocol::Array<protocol::Runtime::CallArgument>>& optionalArgum ents, 101 const Maybe<protocol::Array<protocol::Runtime::CallArgument>>& optionalArgum ents,
102 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole, 102 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole,
103 const Maybe<bool>& returnByValue, 103 const Maybe<bool>& returnByValue,
104 const Maybe<bool>& generatePreview, 104 const Maybe<bool>& generatePreview,
105 OwnPtr<RemoteObject>* result, 105 OwnPtr<RemoteObject>* result,
106 Maybe<bool>* wasThrown) 106 Maybe<bool>* wasThrown)
107 { 107 {
108 OwnPtr<RemoteObjectId> remoteId = RemoteObjectId::parse(objectId); 108 OwnPtr<RemoteObjectId> remoteId = RemoteObjectId::parse(objectId);
109 if (!remoteId) { 109 if (!remoteId) {
110 *errorString = "Invalid object id"; 110 *errorString = "Invalid object id";
111 return; 111 return;
112 } 112 }
113 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (remoteId.get()); 113 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (remoteId.get());
114 if (!injectedScript) { 114 if (!injectedScript) {
115 *errorString = "Inspected frame has gone"; 115 *errorString = "Inspected frame has gone";
116 return; 116 return;
117 } 117 }
118 String arguments; 118 String16 arguments;
119 if (optionalArguments.isJust()) 119 if (optionalArguments.isJust())
120 arguments = protocol::toValue(optionalArguments.fromJust())->toJSONStrin g(); 120 arguments = protocol::toValue(optionalArguments.fromJust())->toJSONStrin g();
121 121
122 IgnoreExceptionsScope ignoreExceptionsScope(doNotPauseOnExceptionsAndMuteCon sole.fromMaybe(false) ? m_debugger : nullptr); 122 IgnoreExceptionsScope ignoreExceptionsScope(doNotPauseOnExceptionsAndMuteCon sole.fromMaybe(false) ? m_debugger : nullptr);
123 injectedScript->callFunctionOn(errorString, objectId, expression, arguments, returnByValue.fromMaybe(false), generatePreview.fromMaybe(false), result, wasTh rown); 123 injectedScript->callFunctionOn(errorString, objectId, expression, arguments, returnByValue.fromMaybe(false), generatePreview.fromMaybe(false), result, wasTh rown);
124 } 124 }
125 125
126 void V8RuntimeAgentImpl::getProperties( 126 void V8RuntimeAgentImpl::getProperties(
127 ErrorString* errorString, 127 ErrorString* errorString,
128 const String& objectId, 128 const String16& objectId,
129 const Maybe<bool>& ownProperties, 129 const Maybe<bool>& ownProperties,
130 const Maybe<bool>& accessorPropertiesOnly, 130 const Maybe<bool>& accessorPropertiesOnly,
131 const Maybe<bool>& generatePreview, 131 const Maybe<bool>& generatePreview,
132 OwnPtr<protocol::Array<protocol::Runtime::PropertyDescriptor>>* result, 132 OwnPtr<protocol::Array<protocol::Runtime::PropertyDescriptor>>* result,
133 Maybe<protocol::Array<protocol::Runtime::InternalPropertyDescriptor>>* inter nalProperties, 133 Maybe<protocol::Array<protocol::Runtime::InternalPropertyDescriptor>>* inter nalProperties,
134 Maybe<ExceptionDetails>* exceptionDetails) 134 Maybe<ExceptionDetails>* exceptionDetails)
135 { 135 {
136 OwnPtr<RemoteObjectId> remoteId = RemoteObjectId::parse(objectId); 136 OwnPtr<RemoteObjectId> remoteId = RemoteObjectId::parse(objectId);
137 if (!remoteId) { 137 if (!remoteId) {
138 *errorString = "Invalid object id"; 138 *errorString = "Invalid object id";
139 return; 139 return;
140 } 140 }
141 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (remoteId.get()); 141 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (remoteId.get());
142 if (!injectedScript) { 142 if (!injectedScript) {
143 *errorString = "Inspected frame has gone"; 143 *errorString = "Inspected frame has gone";
144 return; 144 return;
145 } 145 }
146 146
147 IgnoreExceptionsScope ignoreExceptionsScope(m_debugger); 147 IgnoreExceptionsScope ignoreExceptionsScope(m_debugger);
148 148
149 injectedScript->getProperties(errorString, objectId, ownProperties.fromMaybe (false), accessorPropertiesOnly.fromMaybe(false), generatePreview.fromMaybe(fals e), result, exceptionDetails); 149 injectedScript->getProperties(errorString, objectId, ownProperties.fromMaybe (false), accessorPropertiesOnly.fromMaybe(false), generatePreview.fromMaybe(fals e), result, exceptionDetails);
150 150
151 if (errorString->isEmpty() && !exceptionDetails->isJust() && !accessorProper tiesOnly.fromMaybe(false)) 151 if (errorString->isEmpty() && !exceptionDetails->isJust() && !accessorProper tiesOnly.fromMaybe(false))
152 injectedScript->getInternalProperties(errorString, objectId, internalPro perties, exceptionDetails); 152 injectedScript->getInternalProperties(errorString, objectId, internalPro perties, exceptionDetails);
153 } 153 }
154 154
155 void V8RuntimeAgentImpl::releaseObject(ErrorString* errorString, const String& o bjectId) 155 void V8RuntimeAgentImpl::releaseObject(ErrorString* errorString, const String16& objectId)
156 { 156 {
157 OwnPtr<RemoteObjectId> remoteId = RemoteObjectId::parse(objectId); 157 OwnPtr<RemoteObjectId> remoteId = RemoteObjectId::parse(objectId);
158 if (!remoteId) { 158 if (!remoteId) {
159 *errorString = "Invalid object id"; 159 *errorString = "Invalid object id";
160 return; 160 return;
161 } 161 }
162 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (remoteId.get()); 162 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (remoteId.get());
163 if (!injectedScript) 163 if (!injectedScript)
164 return; 164 return;
165 bool pausingOnNextStatement = m_debugger->pausingOnNextStatement(); 165 bool pausingOnNextStatement = m_debugger->pausingOnNextStatement();
166 if (pausingOnNextStatement) 166 if (pausingOnNextStatement)
167 m_debugger->setPauseOnNextStatement(false); 167 m_debugger->setPauseOnNextStatement(false);
168 injectedScript->releaseObject(objectId); 168 injectedScript->releaseObject(objectId);
169 if (pausingOnNextStatement) 169 if (pausingOnNextStatement)
170 m_debugger->setPauseOnNextStatement(true); 170 m_debugger->setPauseOnNextStatement(true);
171 } 171 }
172 172
173 void V8RuntimeAgentImpl::releaseObjectGroup(ErrorString*, const String& objectGr oup) 173 void V8RuntimeAgentImpl::releaseObjectGroup(ErrorString*, const String16& object Group)
174 { 174 {
175 bool pausingOnNextStatement = m_debugger->pausingOnNextStatement(); 175 bool pausingOnNextStatement = m_debugger->pausingOnNextStatement();
176 if (pausingOnNextStatement) 176 if (pausingOnNextStatement)
177 m_debugger->setPauseOnNextStatement(false); 177 m_debugger->setPauseOnNextStatement(false);
178 m_injectedScriptManager->releaseObjectGroup(objectGroup); 178 m_injectedScriptManager->releaseObjectGroup(objectGroup);
179 if (pausingOnNextStatement) 179 if (pausingOnNextStatement)
180 m_debugger->setPauseOnNextStatement(true); 180 m_debugger->setPauseOnNextStatement(true);
181 } 181 }
182 182
183 void V8RuntimeAgentImpl::run(ErrorString* errorString) 183 void V8RuntimeAgentImpl::run(ErrorString* errorString)
184 { 184 {
185 *errorString = "Not paused"; 185 *errorString = "Not paused";
186 } 186 }
187 187
188 void V8RuntimeAgentImpl::setCustomObjectFormatterEnabled(ErrorString*, bool enab led) 188 void V8RuntimeAgentImpl::setCustomObjectFormatterEnabled(ErrorString*, bool enab led)
189 { 189 {
190 m_state->setBoolean(V8RuntimeAgentImplState::customObjectFormatterEnabled, e nabled); 190 m_state->setBoolean(V8RuntimeAgentImplState::customObjectFormatterEnabled, e nabled);
191 m_injectedScriptManager->setCustomObjectFormatterEnabled(enabled); 191 m_injectedScriptManager->setCustomObjectFormatterEnabled(enabled);
192 } 192 }
193 193
194 void V8RuntimeAgentImpl::compileScript(ErrorString* errorString, 194 void V8RuntimeAgentImpl::compileScript(ErrorString* errorString,
195 const String& expression, 195 const String16& expression,
196 const String& sourceURL, 196 const String16& sourceURL,
197 bool persistScript, 197 bool persistScript,
198 int executionContextId, 198 int executionContextId,
199 Maybe<protocol::Runtime::ScriptId>* scriptId, 199 Maybe<String16>* scriptId,
200 Maybe<ExceptionDetails>* exceptionDetails) 200 Maybe<ExceptionDetails>* exceptionDetails)
201 { 201 {
202 if (!m_enabled) { 202 if (!m_enabled) {
203 *errorString = "Runtime agent is not enabled"; 203 *errorString = "Runtime agent is not enabled";
204 return; 204 return;
205 } 205 }
206 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (executionContextId); 206 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (executionContextId);
207 if (!injectedScript) { 207 if (!injectedScript) {
208 *errorString = "Inspected frame has gone"; 208 *errorString = "Inspected frame has gone";
209 return; 209 return;
210 } 210 }
211 211
212 v8::Isolate* isolate = injectedScript->isolate(); 212 v8::Isolate* isolate = injectedScript->isolate();
213 v8::HandleScope handles(isolate); 213 v8::HandleScope handles(isolate);
214 v8::Context::Scope scope(injectedScript->context()); 214 v8::Context::Scope scope(injectedScript->context());
215 v8::TryCatch tryCatch(isolate); 215 v8::TryCatch tryCatch(isolate);
216 v8::Local<v8::Script> script = m_debugger->compileInternalScript(injectedScr ipt->context(), toV8String(isolate, expression), sourceURL); 216 v8::Local<v8::Script> script = m_debugger->compileInternalScript(injectedScr ipt->context(), toV8String(isolate, expression), sourceURL);
217 if (script.IsEmpty()) { 217 if (script.IsEmpty()) {
218 v8::Local<v8::Message> message = tryCatch.Message(); 218 v8::Local<v8::Message> message = tryCatch.Message();
219 if (!message.IsEmpty()) 219 if (!message.IsEmpty())
220 *exceptionDetails = createExceptionDetails(isolate, message); 220 *exceptionDetails = createExceptionDetails(isolate, message);
221 else 221 else
222 *errorString = "Script compilation failed"; 222 *errorString = "Script compilation failed";
223 return; 223 return;
224 } 224 }
225 225
226 if (!persistScript) 226 if (!persistScript)
227 return; 227 return;
228 228
229 String scriptValueId = String::number(script->GetUnboundScript()->GetId()); 229 String16 scriptValueId = String16::number(script->GetUnboundScript()->GetId( ));
230 OwnPtr<v8::Global<v8::Script>> global = adoptPtr(new v8::Global<v8::Script>( isolate, script)); 230 OwnPtr<v8::Global<v8::Script>> global = adoptPtr(new v8::Global<v8::Script>( isolate, script));
231 m_compiledScripts.set(scriptValueId, global.release()); 231 m_compiledScripts.set(scriptValueId, global.release());
232 *scriptId = scriptValueId; 232 *scriptId = scriptValueId;
233 } 233 }
234 234
235 void V8RuntimeAgentImpl::runScript(ErrorString* errorString, 235 void V8RuntimeAgentImpl::runScript(ErrorString* errorString,
236 const protocol::Runtime::ScriptId& scriptId, 236 const String16& scriptId,
237 int executionContextId, 237 int executionContextId,
238 const Maybe<String>& objectGroup, 238 const Maybe<String16>& objectGroup,
239 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole, 239 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole,
240 const Maybe<bool>& includeCommandLineAPI, 240 const Maybe<bool>& includeCommandLineAPI,
241 OwnPtr<RemoteObject>* result, 241 OwnPtr<RemoteObject>* result,
242 Maybe<ExceptionDetails>* exceptionDetails) 242 Maybe<ExceptionDetails>* exceptionDetails)
243 { 243 {
244 if (!m_enabled) { 244 if (!m_enabled) {
245 *errorString = "Runtime agent is not enabled"; 245 *errorString = "Runtime agent is not enabled";
246 return; 246 return;
247 } 247 }
248 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (executionContextId); 248 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (executionContextId);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 { 304 {
305 ErrorString error; 305 ErrorString error;
306 disable(&error); 306 disable(&error);
307 ASSERT(m_frontend); 307 ASSERT(m_frontend);
308 m_frontend = nullptr; 308 m_frontend = nullptr;
309 } 309 }
310 310
311 void V8RuntimeAgentImpl::restore() 311 void V8RuntimeAgentImpl::restore()
312 { 312 {
313 m_frontend->executionContextsCleared(); 313 m_frontend->executionContextsCleared();
314 String error; 314 ErrorString error;
315 enable(&error); 315 enable(&error);
316 if (m_state->booleanProperty(V8RuntimeAgentImplState::customObjectFormatterE nabled, false)) 316 if (m_state->booleanProperty(V8RuntimeAgentImplState::customObjectFormatterE nabled, false))
317 m_injectedScriptManager->setCustomObjectFormatterEnabled(true); 317 m_injectedScriptManager->setCustomObjectFormatterEnabled(true);
318 } 318 }
319 319
320 void V8RuntimeAgentImpl::enable(ErrorString* errorString) 320 void V8RuntimeAgentImpl::enable(ErrorString* errorString)
321 { 321 {
322 m_enabled = true; 322 m_enabled = true;
323 m_client->reportExecutionContexts(); 323 m_client->reportExecutionContexts();
324 } 324 }
(...skipping 15 matching lines...) Expand all
340 void V8RuntimeAgentImpl::setClearConsoleCallback(PassOwnPtr<V8RuntimeAgent::Clea rConsoleCallback> callback) 340 void V8RuntimeAgentImpl::setClearConsoleCallback(PassOwnPtr<V8RuntimeAgent::Clea rConsoleCallback> callback)
341 { 341 {
342 m_injectedScriptManager->injectedScriptHost()->setClearConsoleCallback(callb ack); 342 m_injectedScriptManager->injectedScriptHost()->setClearConsoleCallback(callb ack);
343 } 343 }
344 344
345 void V8RuntimeAgentImpl::setInspectObjectCallback(PassOwnPtr<V8RuntimeAgent::Ins pectCallback> callback) 345 void V8RuntimeAgentImpl::setInspectObjectCallback(PassOwnPtr<V8RuntimeAgent::Ins pectCallback> callback)
346 { 346 {
347 m_injectedScriptManager->injectedScriptHost()->setInspectObjectCallback(call back); 347 m_injectedScriptManager->injectedScriptHost()->setInspectObjectCallback(call back);
348 } 348 }
349 349
350 PassOwnPtr<RemoteObject> V8RuntimeAgentImpl::wrapObject(v8::Local<v8::Context> c ontext, v8::Local<v8::Value> value, const String& groupName, bool generatePrevie w) 350 PassOwnPtr<RemoteObject> V8RuntimeAgentImpl::wrapObject(v8::Local<v8::Context> c ontext, v8::Local<v8::Value> value, const String16& groupName, bool generatePrev iew)
351 { 351 {
352 InjectedScript* injectedScript = m_injectedScriptManager->injectedScriptFor( context); 352 InjectedScript* injectedScript = m_injectedScriptManager->injectedScriptFor( context);
353 if (!injectedScript) 353 if (!injectedScript)
354 return nullptr; 354 return nullptr;
355 return injectedScript->wrapObject(value, groupName, generatePreview); 355 return injectedScript->wrapObject(value, groupName, generatePreview);
356 } 356 }
357 357
358 PassOwnPtr<RemoteObject> V8RuntimeAgentImpl::wrapTable(v8::Local<v8::Context> co ntext, v8::Local<v8::Value> table, v8::Local<v8::Value> columns) 358 PassOwnPtr<RemoteObject> V8RuntimeAgentImpl::wrapTable(v8::Local<v8::Context> co ntext, v8::Local<v8::Value> table, v8::Local<v8::Value> columns)
359 { 359 {
360 InjectedScript* injectedScript = m_injectedScriptManager->injectedScriptFor( context); 360 InjectedScript* injectedScript = m_injectedScriptManager->injectedScriptFor( context);
361 if (!injectedScript) 361 if (!injectedScript)
362 return nullptr; 362 return nullptr;
363 return injectedScript->wrapTable(table, columns); 363 return injectedScript->wrapTable(table, columns);
364 } 364 }
365 365
366 void V8RuntimeAgentImpl::disposeObjectGroup(const String& groupName) 366 void V8RuntimeAgentImpl::disposeObjectGroup(const String16& groupName)
367 { 367 {
368 m_injectedScriptManager->releaseObjectGroup(groupName); 368 m_injectedScriptManager->releaseObjectGroup(groupName);
369 } 369 }
370 370
371 v8::Local<v8::Value> V8RuntimeAgentImpl::findObject(const String& objectId, v8:: Local<v8::Context>* context, String* groupName) 371 v8::Local<v8::Value> V8RuntimeAgentImpl::findObject(const String16& objectId, v8 ::Local<v8::Context>* context, String16* groupName)
372 { 372 {
373 OwnPtr<RemoteObjectId> remoteId = RemoteObjectId::parse(objectId); 373 OwnPtr<RemoteObjectId> remoteId = RemoteObjectId::parse(objectId);
374 if (!remoteId) 374 if (!remoteId)
375 return v8::Local<v8::Value>(); 375 return v8::Local<v8::Value>();
376 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (remoteId->contextId()); 376 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (remoteId->contextId());
377 if (!injectedScript) 377 if (!injectedScript)
378 return v8::Local<v8::Value>(); 378 return v8::Local<v8::Value>();
379 if (context) 379 if (context)
380 *context = injectedScript->context(); 380 *context = injectedScript->context();
381 if (groupName) 381 if (groupName)
382 *groupName = injectedScript->objectGroupName(*remoteId); 382 *groupName = injectedScript->objectGroupName(*remoteId);
383 return injectedScript->findObject(*remoteId); 383 return injectedScript->findObject(*remoteId);
384 } 384 }
385 385
386 void V8RuntimeAgentImpl::addInspectedObject(PassOwnPtr<Inspectable> inspectable) 386 void V8RuntimeAgentImpl::addInspectedObject(PassOwnPtr<Inspectable> inspectable)
387 { 387 {
388 m_injectedScriptManager->injectedScriptHost()->addInspectedObject(inspectabl e); 388 m_injectedScriptManager->injectedScriptHost()->addInspectedObject(inspectabl e);
389 } 389 }
390 390
391 void V8RuntimeAgentImpl::clearInspectedObjects() 391 void V8RuntimeAgentImpl::clearInspectedObjects()
392 { 392 {
393 m_injectedScriptManager->injectedScriptHost()->clearInspectedObjects(); 393 m_injectedScriptManager->injectedScriptHost()->clearInspectedObjects();
394 } 394 }
395 395
396 void V8RuntimeAgentImpl::reportExecutionContextCreated(v8::Local<v8::Context> co ntext, const String& type, const String& origin, const String& humanReadableName , const String& frameId) 396 void V8RuntimeAgentImpl::reportExecutionContextCreated(v8::Local<v8::Context> co ntext, const String16& type, const String16& origin, const String16& humanReadab leName, const String16& frameId)
397 { 397 {
398 if (!m_enabled) 398 if (!m_enabled)
399 return; 399 return;
400 InjectedScript* injectedScript = m_injectedScriptManager->injectedScriptFor( context); 400 InjectedScript* injectedScript = m_injectedScriptManager->injectedScriptFor( context);
401 if (!injectedScript) 401 if (!injectedScript)
402 return; 402 return;
403 int contextId = injectedScript->contextId(); 403 int contextId = injectedScript->contextId();
404 injectedScript->setOrigin(origin); 404 injectedScript->setOrigin(origin);
405 OwnPtr<protocol::Runtime::ExecutionContextDescription> description = protoco l::Runtime::ExecutionContextDescription::create() 405 OwnPtr<protocol::Runtime::ExecutionContextDescription> description = protoco l::Runtime::ExecutionContextDescription::create()
406 .setId(contextId) 406 .setId(contextId)
407 .setName(humanReadableName) 407 .setName(humanReadableName)
408 .setOrigin(origin) 408 .setOrigin(origin)
409 .setFrameId(frameId).build(); 409 .setFrameId(frameId).build();
410 if (!type.isEmpty()) 410 if (!type.isEmpty())
411 description->setType(type); 411 description->setType(type);
412 m_frontend->executionContextCreated(description.release()); 412 m_frontend->executionContextCreated(description.release());
413 } 413 }
414 414
415 void V8RuntimeAgentImpl::reportExecutionContextDestroyed(v8::Local<v8::Context> context) 415 void V8RuntimeAgentImpl::reportExecutionContextDestroyed(v8::Local<v8::Context> context)
416 { 416 {
417 int contextId = m_injectedScriptManager->discardInjectedScriptFor(context); 417 int contextId = m_injectedScriptManager->discardInjectedScriptFor(context);
418 if (!m_enabled) 418 if (!m_enabled)
419 return; 419 return;
420 m_frontend->executionContextDestroyed(contextId); 420 m_frontend->executionContextDestroyed(contextId);
421 } 421 }
422 422
423 PassOwnPtr<ExceptionDetails> V8RuntimeAgentImpl::createExceptionDetails(v8::Isol ate* isolate, v8::Local<v8::Message> message) 423 PassOwnPtr<ExceptionDetails> V8RuntimeAgentImpl::createExceptionDetails(v8::Isol ate* isolate, v8::Local<v8::Message> message)
424 { 424 {
425 OwnPtr<ExceptionDetails> exceptionDetails = ExceptionDetails::create().setTe xt(toWTFStringWithTypeCheck(message->Get())).build(); 425 OwnPtr<ExceptionDetails> exceptionDetails = ExceptionDetails::create().setTe xt(toProtocolStringWithTypeCheck(message->Get())).build();
426 exceptionDetails->setLine(message->GetLineNumber()); 426 exceptionDetails->setLine(message->GetLineNumber());
427 exceptionDetails->setColumn(message->GetStartColumn()); 427 exceptionDetails->setColumn(message->GetStartColumn());
428 v8::Local<v8::StackTrace> messageStackTrace = message->GetStackTrace(); 428 v8::Local<v8::StackTrace> messageStackTrace = message->GetStackTrace();
429 if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount() > 0) 429 if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount() > 0)
430 exceptionDetails->setStack(m_debugger->createStackTrace(messageStackTrac e, messageStackTrace->GetFrameCount())->buildInspectorObject()); 430 exceptionDetails->setStack(m_debugger->createStackTrace(messageStackTrac e, messageStackTrace->GetFrameCount())->buildInspectorObject());
431 return exceptionDetails.release(); 431 return exceptionDetails.release();
432 } 432 }
433 433
434 } // namespace blink 434 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698