Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 else if (document().isXMLDocument()) | 90 else if (document().isXMLDocument()) |
| 91 newDocument = XMLDocument::create(); | 91 newDocument = XMLDocument::create(); |
| 92 | 92 |
| 93 ASSERT(newDocument); | 93 ASSERT(newDocument); |
| 94 newDocument->setContextFeatures(document().contextFeatures()); | 94 newDocument->setContextFeatures(document().contextFeatures()); |
| 95 RefPtrWillBeRawPtr<DocumentParser> parser = nullptr; | 95 RefPtrWillBeRawPtr<DocumentParser> parser = nullptr; |
| 96 if (document().isHTMLDocument()) | 96 if (document().isHTMLDocument()) |
| 97 parser = HTMLDocumentParser::create(toHTMLDocument(*newDocument), false) ; | 97 parser = HTMLDocumentParser::create(toHTMLDocument(*newDocument), false) ; |
| 98 else | 98 else |
| 99 parser = XMLDocumentParser::create(*newDocument, 0); | 99 parser = XMLDocumentParser::create(*newDocument, 0); |
| 100 parser->pinToMainThread(); | |
|
eseidel
2014/09/09 22:18:20
This shouldn't be necessary with insert(), but see
| |
| 100 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. |
| 101 parser->finish(); | 102 parser->finish(); |
| 102 parser->detach(); | 103 parser->detach(); |
| 103 | 104 |
| 104 OwnPtr<Digest> oldInfo = createDigest(document().documentElement(), 0); | 105 OwnPtr<Digest> oldInfo = createDigest(document().documentElement(), 0); |
| 105 OwnPtr<Digest> newInfo = createDigest(newDocument->documentElement(), &m_unu sedNodesMap); | 106 OwnPtr<Digest> newInfo = createDigest(newDocument->documentElement(), &m_unu sedNodesMap); |
| 106 | 107 |
| 107 if (!innerPatchNode(oldInfo.get(), newInfo.get(), IGNORE_EXCEPTION)) { | 108 if (!innerPatchNode(oldInfo.get(), newInfo.get(), IGNORE_EXCEPTION)) { |
| 108 // Fall back to rewrite. | 109 // Fall back to rewrite. |
| 109 document().write(markup); | 110 document().write(markup); |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 506 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name) | 507 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name) |
| 507 { | 508 { |
| 508 fprintf(stderr, "\n\n"); | 509 fprintf(stderr, "\n\n"); |
| 509 for (size_t i = 0; i < map.size(); ++i) | 510 for (size_t i = 0; i < map.size(); ++i) |
| 510 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); | 511 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); |
| 511 } | 512 } |
| 512 #endif | 513 #endif |
| 513 | 514 |
| 514 } // namespace blink | 515 } // namespace blink |
| 515 | 516 |
| OLD | NEW |