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

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

Issue 277633002: Convert DocumentParser code to Use more reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Make TextDocument use reference as well Created 6 years, 7 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
« no previous file with comments | « Source/core/html/parser/TextDocumentParser.cpp ('k') | no next file » | 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 newDocument = HTMLDocument::create(); 88 newDocument = HTMLDocument::create();
89 else if (m_document.isXHTMLDocument()) 89 else if (m_document.isXHTMLDocument())
90 newDocument = XMLDocument::createXHTML(); 90 newDocument = XMLDocument::createXHTML();
91 else if (m_document.isXMLDocument()) 91 else if (m_document.isXMLDocument())
92 newDocument = XMLDocument::create(); 92 newDocument = XMLDocument::create();
93 93
94 ASSERT(newDocument); 94 ASSERT(newDocument);
95 newDocument->setContextFeatures(m_document.contextFeatures()); 95 newDocument->setContextFeatures(m_document.contextFeatures());
96 RefPtr<DocumentParser> parser; 96 RefPtr<DocumentParser> parser;
97 if (m_document.isHTMLDocument()) 97 if (m_document.isHTMLDocument())
98 parser = HTMLDocumentParser::create(toHTMLDocument(newDocument.get()), f alse); 98 parser = HTMLDocumentParser::create(toHTMLDocument(*newDocument), false) ;
99 else 99 else
100 parser = XMLDocumentParser::create(*newDocument, 0); 100 parser = XMLDocumentParser::create(*newDocument, 0);
101 parser->insert(markup); // Use insert() so that the parser will not yield. 101 parser->insert(markup); // Use insert() so that the parser will not yield.
102 parser->finish(); 102 parser->finish();
103 parser->detach(); 103 parser->detach();
104 104
105 OwnPtr<Digest> oldInfo = createDigest(m_document.documentElement(), 0); 105 OwnPtr<Digest> oldInfo = createDigest(m_document.documentElement(), 0);
106 OwnPtr<Digest> newInfo = createDigest(newDocument->documentElement(), &m_unu sedNodesMap); 106 OwnPtr<Digest> newInfo = createDigest(newDocument->documentElement(), &m_unu sedNodesMap);
107 107
108 if (!innerPatchNode(oldInfo.get(), newInfo.get(), IGNORE_EXCEPTION)) { 108 if (!innerPatchNode(oldInfo.get(), newInfo.get(), IGNORE_EXCEPTION)) {
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name) 511 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name)
512 { 512 {
513 fprintf(stderr, "\n\n"); 513 fprintf(stderr, "\n\n");
514 for (size_t i = 0; i < map.size(); ++i) 514 for (size_t i = 0; i < map.size(); ++i)
515 fprintf(stderr, "%s[%lu]: %s (%p) - [%lu]\n", name.utf8().data(), i, map [i].first ? nodeName(map[i].first->m_node).utf8().data() : "", map[i].first, map [i].second); 515 fprintf(stderr, "%s[%lu]: %s (%p) - [%lu]\n", name.utf8().data(), i, map [i].first ? nodeName(map[i].first->m_node).utf8().data() : "", map[i].first, map [i].second);
516 } 516 }
517 #endif 517 #endif
518 518
519 } // namespace WebCore 519 } // namespace WebCore
520 520
OLDNEW
« no previous file with comments | « Source/core/html/parser/TextDocumentParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698