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

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

Issue 779393002: Turn DocumentParser::pinToMainThread into a cleaner api (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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) 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 newDocument = XMLDocument::createSVG(); 89 newDocument = XMLDocument::createSVG();
90 else if (document().isXHTMLDocument()) 90 else if (document().isXHTMLDocument())
91 newDocument = XMLDocument::createXHTML(); 91 newDocument = XMLDocument::createXHTML();
92 else if (document().isXMLDocument()) 92 else if (document().isXMLDocument())
93 newDocument = XMLDocument::create(); 93 newDocument = XMLDocument::create();
94 94
95 ASSERT(newDocument); 95 ASSERT(newDocument);
96 newDocument->setContextFeatures(document().contextFeatures()); 96 newDocument->setContextFeatures(document().contextFeatures());
97 if (!document().isHTMLDocument()) { 97 if (!document().isHTMLDocument()) {
98 RefPtrWillBeRawPtr<DocumentParser> parser = XMLDocumentParser::create(*n ewDocument, nullptr); 98 RefPtrWillBeRawPtr<DocumentParser> parser = XMLDocumentParser::create(*n ewDocument, nullptr);
99 parser->pinToMainThread();
100 parser->append(markup.impl()); 99 parser->append(markup.impl());
101 parser->finish(); 100 parser->finish();
102 parser->detach(); 101 parser->detach();
103 102
104 // Avoid breakage on non-well-formed documents. 103 // Avoid breakage on non-well-formed documents.
105 if (!static_cast<XMLDocumentParser*>(parser.get())->wellFormed()) 104 if (!static_cast<XMLDocumentParser*>(parser.get())->wellFormed())
106 return; 105 return;
107 } 106 }
108 newDocument->setContent(markup); 107 newDocument->setContent(markup);
109 OwnPtr<Digest> oldInfo = createDigest(document().documentElement(), 0); 108 OwnPtr<Digest> oldInfo = createDigest(document().documentElement(), 0);
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name) 510 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name)
512 { 511 {
513 fprintf(stderr, "\n\n"); 512 fprintf(stderr, "\n\n");
514 for (size_t i = 0; i < map.size(); ++i) 513 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); 514 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 } 515 }
517 #endif 516 #endif
518 517
519 } // namespace blink 518 } // namespace blink
520 519
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698