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

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

Issue 170603003: Use nullptr_t for RefPtr, PassRefPtr and RawPtr. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Final rebase Created 6 years, 10 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 | Annotate | Revision Log
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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 268
269 m_frontend = 0; 269 m_frontend = 0;
270 m_instrumentingAgents->setInspectorDOMAgent(0); 270 m_instrumentingAgents->setInspectorDOMAgent(0);
271 m_state->setBoolean(DOMAgentState::documentRequested, false); 271 m_state->setBoolean(DOMAgentState::documentRequested, false);
272 reset(); 272 reset();
273 } 273 }
274 274
275 void InspectorDOMAgent::restore() 275 void InspectorDOMAgent::restore()
276 { 276 {
277 // Reset document to avoid early return from setDocument. 277 // Reset document to avoid early return from setDocument.
278 m_document = 0; 278 m_document = nullptr;
279 setDocument(m_pageAgent->mainFrame()->document()); 279 setDocument(m_pageAgent->mainFrame()->document());
280 } 280 }
281 281
282 Vector<Document*> InspectorDOMAgent::documents() 282 Vector<Document*> InspectorDOMAgent::documents()
283 { 283 {
284 Vector<Document*> result; 284 Vector<Document*> result;
285 for (Frame* frame = m_document->frame(); frame; frame = frame->tree().traver seNext()) { 285 for (Frame* frame = m_document->frame(); frame; frame = frame->tree().traver seNext()) {
286 Document* document = frame->document(); 286 Document* document = frame->document();
287 if (!document) 287 if (!document)
288 continue; 288 continue;
289 result.append(document); 289 result.append(document);
290 } 290 }
291 return result; 291 return result;
292 } 292 }
293 293
294 void InspectorDOMAgent::reset() 294 void InspectorDOMAgent::reset()
295 { 295 {
296 discardFrontendBindings(); 296 discardFrontendBindings();
297 discardBackendBindings(); 297 discardBackendBindings();
298 m_document = 0; 298 m_document = nullptr;
299 } 299 }
300 300
301 void InspectorDOMAgent::setDOMListener(DOMListener* listener) 301 void InspectorDOMAgent::setDOMListener(DOMListener* listener)
302 { 302 {
303 m_domListener = listener; 303 m_domListener = listener;
304 } 304 }
305 305
306 void InspectorDOMAgent::setDocument(Document* doc) 306 void InspectorDOMAgent::setDocument(Document* doc)
307 { 307 {
308 if (doc == m_document.get()) 308 if (doc == m_document.get())
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 default: 1002 default:
1003 break; 1003 break;
1004 } 1004 }
1005 } 1005 }
1006 1006
1007 // XPath evaluation 1007 // XPath evaluation
1008 for (Vector<Document*>::iterator it = docs.begin(); it != docs.end(); ++ it) { 1008 for (Vector<Document*>::iterator it = docs.begin(); it != docs.end(); ++ it) {
1009 Document* document = *it; 1009 Document* document = *it;
1010 ASSERT(document); 1010 ASSERT(document);
1011 TrackExceptionState exceptionState; 1011 TrackExceptionState exceptionState;
1012 RefPtrWillBeRawPtr<XPathResult> result = DocumentXPathEvaluator::eva luate(*document, whitespaceTrimmedQuery, document, 0, XPathResult::ORDERED_NODE_ SNAPSHOT_TYPE, 0, exceptionState); 1012 RefPtrWillBeRawPtr<XPathResult> result = DocumentXPathEvaluator::eva luate(*document, whitespaceTrimmedQuery, document, nullptr, XPathResult::ORDERED _NODE_SNAPSHOT_TYPE, 0, exceptionState);
1013 if (exceptionState.hadException() || !result) 1013 if (exceptionState.hadException() || !result)
1014 continue; 1014 continue;
1015 1015
1016 unsigned long size = result->snapshotLength(exceptionState); 1016 unsigned long size = result->snapshotLength(exceptionState);
1017 for (unsigned long i = 0; !exceptionState.hadException() && i < size ; ++i) { 1017 for (unsigned long i = 0; !exceptionState.hadException() && i < size ; ++i) {
1018 Node* node = result->snapshotItem(i, exceptionState); 1018 Node* node = result->snapshotItem(i, exceptionState);
1019 if (exceptionState.hadException()) 1019 if (exceptionState.hadException())
1020 break; 1020 break;
1021 1021
1022 if (node->nodeType() == Node::ATTRIBUTE_NODE) 1022 if (node->nodeType() == Node::ATTRIBUTE_NODE)
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
1611 return children.release(); 1611 return children.release();
1612 } 1612 }
1613 1613
1614 PassRefPtr<TypeBuilder::DOM::EventListener> InspectorDOMAgent::buildObjectForEve ntListener(const RegisteredEventListener& registeredEventListener, const AtomicS tring& eventType, Node* node, const String* objectGroupId) 1614 PassRefPtr<TypeBuilder::DOM::EventListener> InspectorDOMAgent::buildObjectForEve ntListener(const RegisteredEventListener& registeredEventListener, const AtomicS tring& eventType, Node* node, const String* objectGroupId)
1615 { 1615 {
1616 RefPtr<EventListener> eventListener = registeredEventListener.listener; 1616 RefPtr<EventListener> eventListener = registeredEventListener.listener;
1617 String sourceName; 1617 String sourceName;
1618 String scriptId; 1618 String scriptId;
1619 int lineNumber; 1619 int lineNumber;
1620 if (!eventListenerHandlerLocation(&node->document(), eventListener.get(), so urceName, scriptId, lineNumber)) 1620 if (!eventListenerHandlerLocation(&node->document(), eventListener.get(), so urceName, scriptId, lineNumber))
1621 return 0; 1621 return nullptr;
1622 1622
1623 Document& document = node->document(); 1623 Document& document = node->document();
1624 RefPtr<TypeBuilder::Debugger::Location> location = TypeBuilder::Debugger::Lo cation::create() 1624 RefPtr<TypeBuilder::Debugger::Location> location = TypeBuilder::Debugger::Lo cation::create()
1625 .setScriptId(scriptId) 1625 .setScriptId(scriptId)
1626 .setLineNumber(lineNumber); 1626 .setLineNumber(lineNumber);
1627 RefPtr<TypeBuilder::DOM::EventListener> value = TypeBuilder::DOM::EventListe ner::create() 1627 RefPtr<TypeBuilder::DOM::EventListener> value = TypeBuilder::DOM::EventListe ner::create()
1628 .setType(eventType) 1628 .setType(eventType)
1629 .setUseCapture(registeredEventListener.useCapture) 1629 .setUseCapture(registeredEventListener.useCapture)
1630 .setIsAttribute(eventListener->isAttribute()) 1630 .setIsAttribute(eventListener->isAttribute())
1631 .setNodeId(pushNodePathToFrontend(node)) 1631 .setNodeId(pushNodePathToFrontend(node))
(...skipping 16 matching lines...) Expand all
1648 } 1648 }
1649 } 1649 }
1650 if (!sourceName.isEmpty()) 1650 if (!sourceName.isEmpty())
1651 value->setSourceName(sourceName); 1651 value->setSourceName(sourceName);
1652 return value.release(); 1652 return value.release();
1653 } 1653 }
1654 1654
1655 PassRefPtr<TypeBuilder::Array<TypeBuilder::DOM::Node> > InspectorDOMAgent::build ArrayForPseudoElements(Element* element, NodeToIdMap* nodesMap) 1655 PassRefPtr<TypeBuilder::Array<TypeBuilder::DOM::Node> > InspectorDOMAgent::build ArrayForPseudoElements(Element* element, NodeToIdMap* nodesMap)
1656 { 1656 {
1657 if (!element->pseudoElement(BEFORE) && !element->pseudoElement(AFTER)) 1657 if (!element->pseudoElement(BEFORE) && !element->pseudoElement(AFTER))
1658 return 0; 1658 return nullptr;
1659 1659
1660 RefPtr<TypeBuilder::Array<TypeBuilder::DOM::Node> > pseudoElements = TypeBui lder::Array<TypeBuilder::DOM::Node>::create(); 1660 RefPtr<TypeBuilder::Array<TypeBuilder::DOM::Node> > pseudoElements = TypeBui lder::Array<TypeBuilder::DOM::Node>::create();
1661 if (element->pseudoElement(BEFORE)) 1661 if (element->pseudoElement(BEFORE))
1662 pseudoElements->addItem(buildObjectForNode(element->pseudoElement(BEFORE ), 0, nodesMap)); 1662 pseudoElements->addItem(buildObjectForNode(element->pseudoElement(BEFORE ), 0, nodesMap));
1663 if (element->pseudoElement(AFTER)) 1663 if (element->pseudoElement(AFTER))
1664 pseudoElements->addItem(buildObjectForNode(element->pseudoElement(AFTER) , 0, nodesMap)); 1664 pseudoElements->addItem(buildObjectForNode(element->pseudoElement(AFTER) , 0, nodesMap));
1665 return pseudoElements.release(); 1665 return pseudoElements.release();
1666 } 1666 }
1667 1667
1668 Node* InspectorDOMAgent::innerFirstChild(Node* node) 1668 Node* InspectorDOMAgent::innerFirstChild(Node* node)
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 renderer = renderer->container(); 2030 renderer = renderer->container();
2031 Node* resultNode = renderer ? renderer->generatingNode() : node->ownerDocume nt(); 2031 Node* resultNode = renderer ? renderer->generatingNode() : node->ownerDocume nt();
2032 *relayoutBoundaryNodeId = pushNodePathToFrontend(resultNode); 2032 *relayoutBoundaryNodeId = pushNodePathToFrontend(resultNode);
2033 } 2033 }
2034 2034
2035 PassRefPtr<TypeBuilder::Runtime::RemoteObject> InspectorDOMAgent::resolveNode(No de* node, const String& objectGroup) 2035 PassRefPtr<TypeBuilder::Runtime::RemoteObject> InspectorDOMAgent::resolveNode(No de* node, const String& objectGroup)
2036 { 2036 {
2037 Document* document = node->isDocumentNode() ? &node->document() : node->owne rDocument(); 2037 Document* document = node->isDocumentNode() ? &node->document() : node->owne rDocument();
2038 Frame* frame = document ? document->frame() : 0; 2038 Frame* frame = document ? document->frame() : 0;
2039 if (!frame) 2039 if (!frame)
2040 return 0; 2040 return nullptr;
2041 2041
2042 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m ainWorldScriptState(frame)); 2042 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m ainWorldScriptState(frame));
2043 if (injectedScript.hasNoValue()) 2043 if (injectedScript.hasNoValue())
2044 return 0; 2044 return nullptr;
2045 2045
2046 return injectedScript.wrapNode(node, objectGroup); 2046 return injectedScript.wrapNode(node, objectGroup);
2047 } 2047 }
2048 2048
2049 bool InspectorDOMAgent::pushDocumentUponHandlelessOperation(ErrorString* errorSt ring) 2049 bool InspectorDOMAgent::pushDocumentUponHandlelessOperation(ErrorString* errorSt ring)
2050 { 2050 {
2051 if (!m_documentNodeToIdMap.contains(m_document)) { 2051 if (!m_documentNodeToIdMap.contains(m_document)) {
2052 RefPtr<TypeBuilder::DOM::Node> root; 2052 RefPtr<TypeBuilder::DOM::Node> root;
2053 getDocument(errorString, root); 2053 getDocument(errorString, root);
2054 return errorString->isEmpty(); 2054 return errorString->isEmpty();
2055 } 2055 }
2056 return true; 2056 return true;
2057 } 2057 }
2058 2058
2059 } // namespace WebCore 2059 } // namespace WebCore
2060 2060
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorCSSAgent.cpp ('k') | Source/core/inspector/InspectorDOMDebuggerAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698