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

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

Issue 2004313003: DevTools: migrate from OwnPtr to std::unique_ptr for inspector protocol classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaselined Created 4 years, 6 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 namespace blink { 62 namespace blink {
63 63
64 static bool hasInternalError(ErrorString* errorString, bool hasError) 64 static bool hasInternalError(ErrorString* errorString, bool hasError)
65 { 65 {
66 if (hasError) 66 if (hasError)
67 *errorString = "Internal error"; 67 *errorString = "Internal error";
68 return hasError; 68 return hasError;
69 } 69 }
70 70
71 PassOwnPtr<InjectedScript> InjectedScript::create(InspectedContext* inspectedCon text) 71 std::unique_ptr<InjectedScript> InjectedScript::create(InspectedContext* inspect edContext)
72 { 72 {
73 v8::Isolate* isolate = inspectedContext->isolate(); 73 v8::Isolate* isolate = inspectedContext->isolate();
74 v8::HandleScope handles(isolate); 74 v8::HandleScope handles(isolate);
75 v8::Local<v8::Context> context = inspectedContext->context(); 75 v8::Local<v8::Context> context = inspectedContext->context();
76 v8::Context::Scope scope(context); 76 v8::Context::Scope scope(context);
77 77
78 OwnPtr<InjectedScriptNative> injectedScriptNative = adoptPtr(new InjectedScr iptNative(isolate)); 78 std::unique_ptr<InjectedScriptNative> injectedScriptNative(new InjectedScrip tNative(isolate));
79 v8::Local<v8::Object> scriptHostWrapper = V8InjectedScriptHost::create(conte xt, inspectedContext->debugger()); 79 v8::Local<v8::Object> scriptHostWrapper = V8InjectedScriptHost::create(conte xt, inspectedContext->debugger());
80 injectedScriptNative->setOnInjectedScriptHost(scriptHostWrapper); 80 injectedScriptNative->setOnInjectedScriptHost(scriptHostWrapper);
81 81
82 // Inject javascript into the context. The compiled script is supposed to ev aluate into 82 // Inject javascript into the context. The compiled script is supposed to ev aluate into
83 // a single anonymous function(it's anonymous to avoid cluttering the global object with 83 // a single anonymous function(it's anonymous to avoid cluttering the global object with
84 // inspector's stuff) the function is called a few lines below with Injected ScriptHost wrapper, 84 // inspector's stuff) the function is called a few lines below with Injected ScriptHost wrapper,
85 // injected script id and explicit reference to the inspected global object. The function is expected 85 // injected script id and explicit reference to the inspected global object. The function is expected
86 // to create and configure InjectedScript instance that is going to be used by the inspector. 86 // to create and configure InjectedScript instance that is going to be used by the inspector.
87 String16 injectedScriptSource(reinterpret_cast<const char*>(InjectedScriptSo urce_js), sizeof(InjectedScriptSource_js)); 87 String16 injectedScriptSource(reinterpret_cast<const char*>(InjectedScriptSo urce_js), sizeof(InjectedScriptSource_js));
88 v8::Local<v8::Value> value; 88 v8::Local<v8::Value> value;
89 if (!inspectedContext->debugger()->compileAndRunInternalScript(context, toV8 String(isolate, injectedScriptSource)).ToLocal(&value)) 89 if (!inspectedContext->debugger()->compileAndRunInternalScript(context, toV8 String(isolate, injectedScriptSource)).ToLocal(&value))
90 return nullptr; 90 return nullptr;
91 DCHECK(value->IsFunction()); 91 DCHECK(value->IsFunction());
92 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value); 92 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value);
93 v8::Local<v8::Object> windowGlobal = context->Global(); 93 v8::Local<v8::Object> windowGlobal = context->Global();
94 v8::Local<v8::Value> info[] = { scriptHostWrapper, windowGlobal, v8::Number: :New(isolate, inspectedContext->contextId()) }; 94 v8::Local<v8::Value> info[] = { scriptHostWrapper, windowGlobal, v8::Number: :New(isolate, inspectedContext->contextId()) };
95 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunM icrotasks); 95 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunM icrotasks);
96 v8::Local<v8::Value> injectedScriptValue; 96 v8::Local<v8::Value> injectedScriptValue;
97 if (!function->Call(context, windowGlobal, WTF_ARRAY_LENGTH(info), info).ToL ocal(&injectedScriptValue)) 97 if (!function->Call(context, windowGlobal, WTF_ARRAY_LENGTH(info), info).ToL ocal(&injectedScriptValue))
98 return nullptr; 98 return nullptr;
99 if (!injectedScriptValue->IsObject()) 99 if (!injectedScriptValue->IsObject())
100 return nullptr; 100 return nullptr;
101 return adoptPtr(new InjectedScript(inspectedContext, injectedScriptValue.As< v8::Object>(), std::move(injectedScriptNative))); 101 return wrapUnique(new InjectedScript(inspectedContext, injectedScriptValue.A s<v8::Object>(), std::move(injectedScriptNative)));
102 } 102 }
103 103
104 InjectedScript::InjectedScript(InspectedContext* context, v8::Local<v8::Object> object, PassOwnPtr<InjectedScriptNative> injectedScriptNative) 104 InjectedScript::InjectedScript(InspectedContext* context, v8::Local<v8::Object> object, std::unique_ptr<InjectedScriptNative> injectedScriptNative)
105 : m_context(context) 105 : m_context(context)
106 , m_value(context->isolate(), object) 106 , m_value(context->isolate(), object)
107 , m_native(std::move(injectedScriptNative)) 107 , m_native(std::move(injectedScriptNative))
108 { 108 {
109 } 109 }
110 110
111 InjectedScript::~InjectedScript() 111 InjectedScript::~InjectedScript()
112 { 112 {
113 } 113 }
114 114
115 void InjectedScript::getProperties(ErrorString* errorString, v8::Local<v8::Objec t> object, const String16& groupName, bool ownProperties, bool accessorPropertie sOnly, bool generatePreview, OwnPtr<Array<PropertyDescriptor>>* properties, Mayb e<protocol::Runtime::ExceptionDetails>* exceptionDetails) 115 void InjectedScript::getProperties(ErrorString* errorString, v8::Local<v8::Objec t> object, const String16& groupName, bool ownProperties, bool accessorPropertie sOnly, bool generatePreview, std::unique_ptr<Array<PropertyDescriptor>>* propert ies, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails)
116 { 116 {
117 v8::HandleScope handles(m_context->isolate()); 117 v8::HandleScope handles(m_context->isolate());
118 V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value (), "getProperties"); 118 V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value (), "getProperties");
119 function.appendArgument(object); 119 function.appendArgument(object);
120 function.appendArgument(groupName); 120 function.appendArgument(groupName);
121 function.appendArgument(ownProperties); 121 function.appendArgument(ownProperties);
122 function.appendArgument(accessorPropertiesOnly); 122 function.appendArgument(accessorPropertiesOnly);
123 function.appendArgument(generatePreview); 123 function.appendArgument(generatePreview);
124 124
125 v8::TryCatch tryCatch(m_context->isolate()); 125 v8::TryCatch tryCatch(m_context->isolate());
126 v8::Local<v8::Value> resultValue = function.callWithoutExceptionHandling(); 126 v8::Local<v8::Value> resultValue = function.callWithoutExceptionHandling();
127 if (tryCatch.HasCaught()) { 127 if (tryCatch.HasCaught()) {
128 *exceptionDetails = createExceptionDetails(tryCatch.Message()); 128 *exceptionDetails = createExceptionDetails(tryCatch.Message());
129 // FIXME: make properties optional 129 // FIXME: make properties optional
130 *properties = Array<PropertyDescriptor>::create(); 130 *properties = Array<PropertyDescriptor>::create();
131 return; 131 return;
132 } 132 }
133 133
134 OwnPtr<protocol::Value> protocolValue = toProtocolValue(function.context(), resultValue); 134 std::unique_ptr<protocol::Value> protocolValue = toProtocolValue(function.co ntext(), resultValue);
135 if (hasInternalError(errorString, !protocolValue)) 135 if (hasInternalError(errorString, !protocolValue))
136 return; 136 return;
137 protocol::ErrorSupport errors(errorString); 137 protocol::ErrorSupport errors(errorString);
138 OwnPtr<Array<PropertyDescriptor>> result = Array<PropertyDescriptor>::parse( protocolValue.get(), &errors); 138 std::unique_ptr<Array<PropertyDescriptor>> result = Array<PropertyDescriptor >::parse(protocolValue.get(), &errors);
139 if (!hasInternalError(errorString, errors.hasErrors())) 139 if (!hasInternalError(errorString, errors.hasErrors()))
140 *properties = std::move(result); 140 *properties = std::move(result);
141 } 141 }
142 142
143 void InjectedScript::releaseObject(const String16& objectId) 143 void InjectedScript::releaseObject(const String16& objectId)
144 { 144 {
145 OwnPtr<protocol::Value> parsedObjectId = protocol::parseJSON(objectId); 145 std::unique_ptr<protocol::Value> parsedObjectId = protocol::parseJSON(object Id);
146 if (!parsedObjectId) 146 if (!parsedObjectId)
147 return; 147 return;
148 protocol::DictionaryValue* object = protocol::DictionaryValue::cast(parsedOb jectId.get()); 148 protocol::DictionaryValue* object = protocol::DictionaryValue::cast(parsedOb jectId.get());
149 if (!object) 149 if (!object)
150 return; 150 return;
151 int boundId = 0; 151 int boundId = 0;
152 if (!object->getNumber("id", &boundId)) 152 if (!object->getNumber("id", &boundId))
153 return; 153 return;
154 m_native->unbind(boundId); 154 m_native->unbind(boundId);
155 } 155 }
156 156
157 PassOwnPtr<protocol::Runtime::RemoteObject> InjectedScript::wrapObject(ErrorStri ng* errorString, v8::Local<v8::Value> value, const String16& groupName, bool for ceValueType, bool generatePreview) const 157 std::unique_ptr<protocol::Runtime::RemoteObject> InjectedScript::wrapObject(Erro rString* errorString, v8::Local<v8::Value> value, const String16& groupName, boo l forceValueType, bool generatePreview) const
158 { 158 {
159 v8::HandleScope handles(m_context->isolate()); 159 v8::HandleScope handles(m_context->isolate());
160 v8::Local<v8::Value> wrappedObject; 160 v8::Local<v8::Value> wrappedObject;
161 if (!wrapValue(errorString, value, groupName, forceValueType, generatePrevie w).ToLocal(&wrappedObject)) 161 if (!wrapValue(errorString, value, groupName, forceValueType, generatePrevie w).ToLocal(&wrappedObject))
162 return nullptr; 162 return nullptr;
163 protocol::ErrorSupport errors; 163 protocol::ErrorSupport errors;
164 OwnPtr<protocol::Runtime::RemoteObject> remoteObject = protocol::Runtime::Re moteObject::parse(toProtocolValue(m_context->context(), wrappedObject).get(), &e rrors); 164 std::unique_ptr<protocol::Runtime::RemoteObject> remoteObject = protocol::Ru ntime::RemoteObject::parse(toProtocolValue(m_context->context(), wrappedObject). get(), &errors);
165 if (!remoteObject) 165 if (!remoteObject)
166 *errorString = "Object has too long reference chain"; 166 *errorString = "Object has too long reference chain";
167 return remoteObject; 167 return remoteObject;
168 } 168 }
169 169
170 bool InjectedScript::wrapObjectProperty(ErrorString* errorString, v8::Local<v8:: Object> object, v8::Local<v8::Value> key, const String16& groupName, bool forceV alueType, bool generatePreview) const 170 bool InjectedScript::wrapObjectProperty(ErrorString* errorString, v8::Local<v8:: Object> object, v8::Local<v8::Value> key, const String16& groupName, bool forceV alueType, bool generatePreview) const
171 { 171 {
172 v8::Local<v8::Value> property; 172 v8::Local<v8::Value> property;
173 if (hasInternalError(errorString, !object->Get(m_context->context(), key).To Local(&property))) 173 if (hasInternalError(errorString, !object->Get(m_context->context(), key).To Local(&property)))
174 return false; 174 return false;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 function.appendArgument(canAccessInspectedWindow()); 216 function.appendArgument(canAccessInspectedWindow());
217 function.appendArgument(forceValueType); 217 function.appendArgument(forceValueType);
218 function.appendArgument(generatePreview); 218 function.appendArgument(generatePreview);
219 bool hadException = false; 219 bool hadException = false;
220 v8::Local<v8::Value> r = function.call(hadException); 220 v8::Local<v8::Value> r = function.call(hadException);
221 if (hasInternalError(errorString, hadException || r.IsEmpty())) 221 if (hasInternalError(errorString, hadException || r.IsEmpty()))
222 return v8::MaybeLocal<v8::Value>(); 222 return v8::MaybeLocal<v8::Value>();
223 return r; 223 return r;
224 } 224 }
225 225
226 PassOwnPtr<protocol::Runtime::RemoteObject> InjectedScript::wrapTable(v8::Local< v8::Value> table, v8::Local<v8::Value> columns) const 226 std::unique_ptr<protocol::Runtime::RemoteObject> InjectedScript::wrapTable(v8::L ocal<v8::Value> table, v8::Local<v8::Value> columns) const
227 { 227 {
228 v8::HandleScope handles(m_context->isolate()); 228 v8::HandleScope handles(m_context->isolate());
229 V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value (), "wrapTable"); 229 V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value (), "wrapTable");
230 function.appendArgument(canAccessInspectedWindow()); 230 function.appendArgument(canAccessInspectedWindow());
231 function.appendArgument(table); 231 function.appendArgument(table);
232 if (columns.IsEmpty()) 232 if (columns.IsEmpty())
233 function.appendArgument(false); 233 function.appendArgument(false);
234 else 234 else
235 function.appendArgument(columns); 235 function.appendArgument(columns);
236 bool hadException = false; 236 bool hadException = false;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 v8::Local<v8::Value> InjectedScript::lastEvaluationResult() const 287 v8::Local<v8::Value> InjectedScript::lastEvaluationResult() const
288 { 288 {
289 if (m_lastEvaluationResult.IsEmpty()) 289 if (m_lastEvaluationResult.IsEmpty())
290 return v8::Undefined(m_context->isolate()); 290 return v8::Undefined(m_context->isolate());
291 return m_lastEvaluationResult.Get(m_context->isolate()); 291 return m_lastEvaluationResult.Get(m_context->isolate());
292 } 292 }
293 293
294 v8::MaybeLocal<v8::Value> InjectedScript::resolveCallArgument(ErrorString* error String, protocol::Runtime::CallArgument* callArgument) 294 v8::MaybeLocal<v8::Value> InjectedScript::resolveCallArgument(ErrorString* error String, protocol::Runtime::CallArgument* callArgument)
295 { 295 {
296 if (callArgument->hasObjectId()) { 296 if (callArgument->hasObjectId()) {
297 OwnPtr<RemoteObjectId> remoteObjectId = RemoteObjectId::parse(errorStrin g, callArgument->getObjectId("")); 297 std::unique_ptr<RemoteObjectId> remoteObjectId = RemoteObjectId::parse(e rrorString, callArgument->getObjectId(""));
298 if (!remoteObjectId) 298 if (!remoteObjectId)
299 return v8::MaybeLocal<v8::Value>(); 299 return v8::MaybeLocal<v8::Value>();
300 if (remoteObjectId->contextId() != m_context->contextId()) { 300 if (remoteObjectId->contextId() != m_context->contextId()) {
301 *errorString = "Argument should belong to the same JavaScript world as target object"; 301 *errorString = "Argument should belong to the same JavaScript world as target object";
302 return v8::MaybeLocal<v8::Value>(); 302 return v8::MaybeLocal<v8::Value>();
303 } 303 }
304 v8::Local<v8::Value> object; 304 v8::Local<v8::Value> object;
305 if (!findObject(errorString, *remoteObjectId, &object)) 305 if (!findObject(errorString, *remoteObjectId, &object))
306 return v8::MaybeLocal<v8::Value>(); 306 return v8::MaybeLocal<v8::Value>();
307 return object; 307 return object;
308 } 308 }
309 if (callArgument->hasValue()) { 309 if (callArgument->hasValue()) {
310 String16 value = callArgument->getValue(nullptr)->toJSONString(); 310 String16 value = callArgument->getValue(nullptr)->toJSONString();
311 if (callArgument->getType(String16()) == "number") 311 if (callArgument->getType(String16()) == "number")
312 value = "Number(" + value + ")"; 312 value = "Number(" + value + ")";
313 v8::Local<v8::Value> object; 313 v8::Local<v8::Value> object;
314 if (!m_context->debugger()->compileAndRunInternalScript(m_context->conte xt(), toV8String(m_context->isolate(), value)).ToLocal(&object)) { 314 if (!m_context->debugger()->compileAndRunInternalScript(m_context->conte xt(), toV8String(m_context->isolate(), value)).ToLocal(&object)) {
315 *errorString = "Couldn't parse value object in call argument"; 315 *errorString = "Couldn't parse value object in call argument";
316 return v8::MaybeLocal<v8::Value>(); 316 return v8::MaybeLocal<v8::Value>();
317 } 317 }
318 return object; 318 return object;
319 } 319 }
320 return v8::Undefined(m_context->isolate()); 320 return v8::Undefined(m_context->isolate());
321 } 321 }
322 322
323 PassOwnPtr<protocol::Runtime::ExceptionDetails> InjectedScript::createExceptionD etails(v8::Local<v8::Message> message) 323 std::unique_ptr<protocol::Runtime::ExceptionDetails> InjectedScript::createExcep tionDetails(v8::Local<v8::Message> message)
324 { 324 {
325 OwnPtr<protocol::Runtime::ExceptionDetails> exceptionDetailsObject = protoco l::Runtime::ExceptionDetails::create().setText(toProtocolString(message->Get())) .build(); 325 std::unique_ptr<protocol::Runtime::ExceptionDetails> exceptionDetailsObject = protocol::Runtime::ExceptionDetails::create().setText(toProtocolString(message ->Get())).build();
326 exceptionDetailsObject->setUrl(toProtocolStringWithTypeCheck(message->GetScr iptResourceName())); 326 exceptionDetailsObject->setUrl(toProtocolStringWithTypeCheck(message->GetScr iptResourceName()));
327 exceptionDetailsObject->setScriptId(String16::number(message->GetScriptOrigi n().ScriptID()->Value())); 327 exceptionDetailsObject->setScriptId(String16::number(message->GetScriptOrigi n().ScriptID()->Value()));
328 328
329 v8::Maybe<int> lineNumber = message->GetLineNumber(m_context->context()); 329 v8::Maybe<int> lineNumber = message->GetLineNumber(m_context->context());
330 if (lineNumber.IsJust()) 330 if (lineNumber.IsJust())
331 exceptionDetailsObject->setLine(lineNumber.FromJust()); 331 exceptionDetailsObject->setLine(lineNumber.FromJust());
332 v8::Maybe<int> columnNumber = message->GetStartColumn(m_context->context()); 332 v8::Maybe<int> columnNumber = message->GetStartColumn(m_context->context());
333 if (columnNumber.IsJust()) 333 if (columnNumber.IsJust())
334 exceptionDetailsObject->setColumn(columnNumber.FromJust()); 334 exceptionDetailsObject->setColumn(columnNumber.FromJust());
335 335
336 v8::Local<v8::StackTrace> stackTrace = message->GetStackTrace(); 336 v8::Local<v8::StackTrace> stackTrace = message->GetStackTrace();
337 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) 337 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0)
338 exceptionDetailsObject->setStack(m_context->debugger()->createStackTrace (stackTrace, stackTrace->GetFrameCount())->buildInspectorObject()); 338 exceptionDetailsObject->setStack(m_context->debugger()->createStackTrace (stackTrace, stackTrace->GetFrameCount())->buildInspectorObject());
339 return exceptionDetailsObject; 339 return exceptionDetailsObject;
340 } 340 }
341 341
342 void InjectedScript::wrapEvaluateResult(ErrorString* errorString, v8::MaybeLocal <v8::Value> maybeResultValue, const v8::TryCatch& tryCatch, const String16& obje ctGroup, bool returnByValue, bool generatePreview, OwnPtr<protocol::Runtime::Rem oteObject>* result, Maybe<bool>* wasThrown, Maybe<protocol::Runtime::ExceptionDe tails>* exceptionDetails) 342 void InjectedScript::wrapEvaluateResult(ErrorString* errorString, v8::MaybeLocal <v8::Value> maybeResultValue, const v8::TryCatch& tryCatch, const String16& obje ctGroup, bool returnByValue, bool generatePreview, std::unique_ptr<protocol::Run time::RemoteObject>* result, Maybe<bool>* wasThrown, Maybe<protocol::Runtime::Ex ceptionDetails>* exceptionDetails)
343 { 343 {
344 v8::Local<v8::Value> resultValue; 344 v8::Local<v8::Value> resultValue;
345 if (!tryCatch.HasCaught()) { 345 if (!tryCatch.HasCaught()) {
346 if (hasInternalError(errorString, !maybeResultValue.ToLocal(&resultValue ))) 346 if (hasInternalError(errorString, !maybeResultValue.ToLocal(&resultValue )))
347 return; 347 return;
348 OwnPtr<RemoteObject> remoteObject = wrapObject(errorString, resultValue, objectGroup, returnByValue, generatePreview); 348 std::unique_ptr<RemoteObject> remoteObject = wrapObject(errorString, res ultValue, objectGroup, returnByValue, generatePreview);
349 if (!remoteObject) 349 if (!remoteObject)
350 return; 350 return;
351 if (objectGroup == "console") 351 if (objectGroup == "console")
352 m_lastEvaluationResult.Reset(m_context->isolate(), resultValue); 352 m_lastEvaluationResult.Reset(m_context->isolate(), resultValue);
353 *result = std::move(remoteObject); 353 *result = std::move(remoteObject);
354 if (wasThrown) 354 if (wasThrown)
355 *wasThrown = false; 355 *wasThrown = false;
356 } else { 356 } else {
357 v8::Local<v8::Value> exception = tryCatch.Exception(); 357 v8::Local<v8::Value> exception = tryCatch.Exception();
358 OwnPtr<RemoteObject> remoteObject = wrapObject(errorString, exception, o bjectGroup, false, generatePreview && !exception->IsNativeError()); 358 std::unique_ptr<RemoteObject> remoteObject = wrapObject(errorString, exc eption, objectGroup, false, generatePreview && !exception->IsNativeError());
359 if (!remoteObject) 359 if (!remoteObject)
360 return; 360 return;
361 *result = std::move(remoteObject); 361 *result = std::move(remoteObject);
362 if (exceptionDetails) 362 if (exceptionDetails)
363 *exceptionDetails = createExceptionDetails(tryCatch.Message()); 363 *exceptionDetails = createExceptionDetails(tryCatch.Message());
364 if (wasThrown) 364 if (wasThrown)
365 *wasThrown = true; 365 *wasThrown = true;
366 } 366 }
367 } 367 }
368 368
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 , m_remoteObjectId(remoteObjectId) 486 , m_remoteObjectId(remoteObjectId)
487 { 487 {
488 } 488 }
489 489
490 InjectedScript::ObjectScope::~ObjectScope() 490 InjectedScript::ObjectScope::~ObjectScope()
491 { 491 {
492 } 492 }
493 493
494 void InjectedScript::ObjectScope::findInjectedScript(V8InspectorSessionImpl* ses sion) 494 void InjectedScript::ObjectScope::findInjectedScript(V8InspectorSessionImpl* ses sion)
495 { 495 {
496 OwnPtr<RemoteObjectId> remoteId = RemoteObjectId::parse(m_errorString, m_rem oteObjectId); 496 std::unique_ptr<RemoteObjectId> remoteId = RemoteObjectId::parse(m_errorStri ng, m_remoteObjectId);
497 if (!remoteId) 497 if (!remoteId)
498 return; 498 return;
499 InjectedScript* injectedScript = session->findInjectedScript(m_errorString, remoteId.get()); 499 InjectedScript* injectedScript = session->findInjectedScript(m_errorString, remoteId.get());
500 if (!injectedScript) 500 if (!injectedScript)
501 return; 501 return;
502 m_objectGroupName = injectedScript->objectGroupName(*remoteId); 502 m_objectGroupName = injectedScript->objectGroupName(*remoteId);
503 if (!injectedScript->findObject(m_errorString, *remoteId, &m_object)) 503 if (!injectedScript->findObject(m_errorString, *remoteId, &m_object))
504 return; 504 return;
505 m_injectedScript = injectedScript; 505 m_injectedScript = injectedScript;
506 } 506 }
507 507
508 InjectedScript::CallFrameScope::CallFrameScope(ErrorString* errorString, V8Debug gerImpl* debugger, int contextGroupId, const String16& remoteObjectId) 508 InjectedScript::CallFrameScope::CallFrameScope(ErrorString* errorString, V8Debug gerImpl* debugger, int contextGroupId, const String16& remoteObjectId)
509 : InjectedScript::Scope(errorString, debugger, contextGroupId) 509 : InjectedScript::Scope(errorString, debugger, contextGroupId)
510 , m_remoteCallFrameId(remoteObjectId) 510 , m_remoteCallFrameId(remoteObjectId)
511 { 511 {
512 } 512 }
513 513
514 InjectedScript::CallFrameScope::~CallFrameScope() 514 InjectedScript::CallFrameScope::~CallFrameScope()
515 { 515 {
516 } 516 }
517 517
518 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl* session) 518 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl* session)
519 { 519 {
520 OwnPtr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_errorString, m_remoteCallFrameId); 520 std::unique_ptr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_err orString, m_remoteCallFrameId);
521 if (!remoteId) 521 if (!remoteId)
522 return; 522 return;
523 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); 523 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal());
524 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get() ); 524 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get() );
525 } 525 }
526 526
527 } // namespace blink 527 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698