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

Side by Side Diff: src/inspector/injected-script.cc

Issue 2523743003: Roll third_party/inspector_protocol to 73028acaa3646789fd2a3bfd0d79eb2d91b696b3 (Closed)
Patch Set: addressed comments Created 4 years, 1 month 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
« no previous file with comments | « src/inspector/BUILD.gn ('k') | src/inspector/injected-script-native.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 int contextGroupId = inspectedContext->contextGroupId(); 98 int contextGroupId = inspectedContext->contextGroupId();
99 int contextId = inspectedContext->contextId(); 99 int contextId = inspectedContext->contextId();
100 V8InspectorImpl* inspector = inspectedContext->inspector(); 100 V8InspectorImpl* inspector = inspectedContext->inspector();
101 v8::Local<v8::Value> injectedScriptValue; 101 v8::Local<v8::Value> injectedScriptValue;
102 if (!function->Call(context, windowGlobal, arraysize(info), info) 102 if (!function->Call(context, windowGlobal, arraysize(info), info)
103 .ToLocal(&injectedScriptValue)) 103 .ToLocal(&injectedScriptValue))
104 return nullptr; 104 return nullptr;
105 if (inspector->getContext(contextGroupId, contextId) != inspectedContext) 105 if (inspector->getContext(contextGroupId, contextId) != inspectedContext)
106 return nullptr; 106 return nullptr;
107 if (!injectedScriptValue->IsObject()) return nullptr; 107 if (!injectedScriptValue->IsObject()) return nullptr;
108 return wrapUnique(new InjectedScript(inspectedContext, 108 return std::unique_ptr<InjectedScript>(
109 injectedScriptValue.As<v8::Object>(), 109 new InjectedScript(inspectedContext, injectedScriptValue.As<v8::Object>(),
110 std::move(injectedScriptNative))); 110 std::move(injectedScriptNative)));
111 } 111 }
112 112
113 InjectedScript::InjectedScript( 113 InjectedScript::InjectedScript(
114 InspectedContext* context, v8::Local<v8::Object> object, 114 InspectedContext* context, v8::Local<v8::Object> object,
115 std::unique_ptr<InjectedScriptNative> injectedScriptNative) 115 std::unique_ptr<InjectedScriptNative> injectedScriptNative)
116 : m_context(context), 116 : m_context(context),
117 m_value(context->isolate(), object), 117 m_value(context->isolate(), object),
118 m_native(std::move(injectedScriptNative)) {} 118 m_native(std::move(injectedScriptNative)) {}
119 119
120 InjectedScript::~InjectedScript() {} 120 InjectedScript::~InjectedScript() {}
(...skipping 30 matching lines...) Expand all
151 protocol::ErrorSupport errors; 151 protocol::ErrorSupport errors;
152 std::unique_ptr<Array<PropertyDescriptor>> result = 152 std::unique_ptr<Array<PropertyDescriptor>> result =
153 Array<PropertyDescriptor>::parse(protocolValue.get(), &errors); 153 Array<PropertyDescriptor>::parse(protocolValue.get(), &errors);
154 if (errors.hasErrors()) return Response::Error(errors.errors()); 154 if (errors.hasErrors()) return Response::Error(errors.errors());
155 *properties = std::move(result); 155 *properties = std::move(result);
156 return Response::OK(); 156 return Response::OK();
157 } 157 }
158 158
159 void InjectedScript::releaseObject(const String16& objectId) { 159 void InjectedScript::releaseObject(const String16& objectId) {
160 std::unique_ptr<protocol::Value> parsedObjectId = 160 std::unique_ptr<protocol::Value> parsedObjectId =
161 protocol::parseJSON(objectId); 161 protocol::StringUtil::parseJSON(objectId);
162 if (!parsedObjectId) return; 162 if (!parsedObjectId) return;
163 protocol::DictionaryValue* object = 163 protocol::DictionaryValue* object =
164 protocol::DictionaryValue::cast(parsedObjectId.get()); 164 protocol::DictionaryValue::cast(parsedObjectId.get());
165 if (!object) return; 165 if (!object) return;
166 int boundId = 0; 166 int boundId = 0;
167 if (!object->getInteger("id", &boundId)) return; 167 if (!object->getInteger("id", &boundId)) return;
168 m_native->unbind(boundId); 168 m_native->unbind(boundId);
169 } 169 }
170 170
171 Response InjectedScript::wrapObject( 171 Response InjectedScript::wrapObject(
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 Response InjectedScript::CallFrameScope::findInjectedScript( 533 Response InjectedScript::CallFrameScope::findInjectedScript(
534 V8InspectorSessionImpl* session) { 534 V8InspectorSessionImpl* session) {
535 std::unique_ptr<RemoteCallFrameId> remoteId; 535 std::unique_ptr<RemoteCallFrameId> remoteId;
536 Response response = RemoteCallFrameId::parse(m_remoteCallFrameId, &remoteId); 536 Response response = RemoteCallFrameId::parse(m_remoteCallFrameId, &remoteId);
537 if (!response.isSuccess()) return response; 537 if (!response.isSuccess()) return response;
538 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); 538 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal());
539 return session->findInjectedScript(remoteId.get(), m_injectedScript); 539 return session->findInjectedScript(remoteId.get(), m_injectedScript);
540 } 540 }
541 541
542 } // namespace v8_inspector 542 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/inspector/BUILD.gn ('k') | src/inspector/injected-script-native.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698