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

Side by Side Diff: third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp

Issue 2251343003: [DevTools] Generate separate copies of inspector_protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win compile Created 4 years, 3 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) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 highlightConfig->contentOutline = parseColor(outlineColor.fromMaybe(nullptr) ); 1159 highlightConfig->contentOutline = parseColor(outlineColor.fromMaybe(nullptr) );
1160 if (m_client) 1160 if (m_client)
1161 m_client->highlightQuad(std::move(quad), *highlightConfig); 1161 m_client->highlightQuad(std::move(quad), *highlightConfig);
1162 } 1162 }
1163 1163
1164 Node* InspectorDOMAgent::nodeForRemoteId(ErrorString* errorString, const String& objectId) 1164 Node* InspectorDOMAgent::nodeForRemoteId(ErrorString* errorString, const String& objectId)
1165 { 1165 {
1166 v8::HandleScope handles(m_isolate); 1166 v8::HandleScope handles(m_isolate);
1167 v8::Local<v8::Value> value; 1167 v8::Local<v8::Value> value;
1168 v8::Local<v8::Context> context; 1168 v8::Local<v8::Context> context;
1169 if (!m_v8Session->unwrapObject(errorString, toV8InspectorStringView(objectId ), &value, &context, nullptr)) 1169 std::unique_ptr<v8_inspector::StringBuffer> error;
1170 if (!m_v8Session->unwrapObject(&error, toV8InspectorStringView(objectId), &v alue, &context, nullptr)) {
1171 *errorString = toCoreString(std::move(error));
1170 return nullptr; 1172 return nullptr;
1173 }
1171 if (!V8Node::hasInstance(value, m_isolate)) { 1174 if (!V8Node::hasInstance(value, m_isolate)) {
1172 *errorString = "Object id doesn't reference a Node"; 1175 *errorString = "Object id doesn't reference a Node";
1173 return nullptr; 1176 return nullptr;
1174 } 1177 }
1175 Node* node = V8Node::toImpl(v8::Local<v8::Object>::Cast(value)); 1178 Node* node = V8Node::toImpl(v8::Local<v8::Object>::Cast(value));
1176 if (!node) 1179 if (!node)
1177 *errorString = "Couldn't convert object with given objectId to Node"; 1180 *errorString = "Couldn't convert object with given objectId to Node";
1178 return node; 1181 return node;
1179 } 1182 }
1180 1183
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 Node* node = result.innerPossiblyPseudoNode(); 1359 Node* node = result.innerPossiblyPseudoNode();
1357 while (node && node->getNodeType() == Node::kTextNode) 1360 while (node && node->getNodeType() == Node::kTextNode)
1358 node = node->parentNode(); 1361 node = node->parentNode();
1359 if (!node) { 1362 if (!node) {
1360 *errorString = "No node found at given location"; 1363 *errorString = "No node found at given location";
1361 return; 1364 return;
1362 } 1365 }
1363 *nodeId = pushNodePathToFrontend(node); 1366 *nodeId = pushNodePathToFrontend(node);
1364 } 1367 }
1365 1368
1366 void InspectorDOMAgent::resolveNode(ErrorString* errorString, int nodeId, const Maybe<String>& objectGroup, std::unique_ptr<protocol::Runtime::API::RemoteObject >* result) 1369 void InspectorDOMAgent::resolveNode(ErrorString* errorString, int nodeId, const Maybe<String>& objectGroup, std::unique_ptr<v8_inspector::protocol::Runtime::API ::RemoteObject>* result)
1367 { 1370 {
1368 String objectGroupName = objectGroup.fromMaybe(""); 1371 String objectGroupName = objectGroup.fromMaybe("");
1369 Node* node = nodeForId(nodeId); 1372 Node* node = nodeForId(nodeId);
1370 if (!node) { 1373 if (!node) {
1371 *errorString = "No node with given id found"; 1374 *errorString = "No node with given id found";
1372 return; 1375 return;
1373 } 1376 }
1374 *result = resolveNode(node, objectGroupName); 1377 *result = resolveNode(node, objectGroupName);
1375 if (!*result) 1378 if (!*result)
1376 *errorString = "Node with given id does not belong to the document"; 1379 *errorString = "Node with given id does not belong to the document";
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
2033 2036
2034 void InspectorDOMAgent::getHighlightObjectForTest(ErrorString* errorString, int nodeId, std::unique_ptr<protocol::DictionaryValue>* result) 2037 void InspectorDOMAgent::getHighlightObjectForTest(ErrorString* errorString, int nodeId, std::unique_ptr<protocol::DictionaryValue>* result)
2035 { 2038 {
2036 Node* node = assertNode(errorString, nodeId); 2039 Node* node = assertNode(errorString, nodeId);
2037 if (!node) 2040 if (!node)
2038 return; 2041 return;
2039 InspectorHighlight highlight(node, InspectorHighlight::defaultConfig(), true ); 2042 InspectorHighlight highlight(node, InspectorHighlight::defaultConfig(), true );
2040 *result = highlight.asProtocolValue(); 2043 *result = highlight.asProtocolValue();
2041 } 2044 }
2042 2045
2043 std::unique_ptr<protocol::Runtime::API::RemoteObject> InspectorDOMAgent::resolve Node(Node* node, const String& objectGroup) 2046 std::unique_ptr<v8_inspector::protocol::Runtime::API::RemoteObject> InspectorDOM Agent::resolveNode(Node* node, const String& objectGroup)
2044 { 2047 {
2045 Document* document = node->isDocumentNode() ? &node->document() : node->owne rDocument(); 2048 Document* document = node->isDocumentNode() ? &node->document() : node->owne rDocument();
2046 LocalFrame* frame = document ? document->frame() : nullptr; 2049 LocalFrame* frame = document ? document->frame() : nullptr;
2047 if (!frame) 2050 if (!frame)
2048 return nullptr; 2051 return nullptr;
2049 2052
2050 ScriptState* scriptState = ScriptState::forMainWorld(frame); 2053 ScriptState* scriptState = ScriptState::forMainWorld(frame);
2051 if (!scriptState) 2054 if (!scriptState)
2052 return nullptr; 2055 return nullptr;
2053 2056
(...skipping 21 matching lines...) Expand all
2075 visitor->trace(m_idToNodesMap); 2078 visitor->trace(m_idToNodesMap);
2076 visitor->trace(m_document); 2079 visitor->trace(m_document);
2077 visitor->trace(m_revalidateTask); 2080 visitor->trace(m_revalidateTask);
2078 visitor->trace(m_searchResults); 2081 visitor->trace(m_searchResults);
2079 visitor->trace(m_history); 2082 visitor->trace(m_history);
2080 visitor->trace(m_domEditor); 2083 visitor->trace(m_domEditor);
2081 InspectorBaseAgent::trace(visitor); 2084 InspectorBaseAgent::trace(visitor);
2082 } 2085 }
2083 2086
2084 } // namespace blink 2087 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698