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

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

Issue 1111173002: Removing blink::prefix (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Incorporating Review Comments Created 5 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
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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 continue; 393 continue;
394 if (isHTMLBodyElement(*node) || isHTMLHeadElement(*node)) 394 if (isHTMLBodyElement(*node) || isHTMLHeadElement(*node))
395 continue; // Never move head or body, move the rest of the nodes aro und them. 395 continue; // Never move head or body, move the rest of the nodes aro und them.
396 396
397 if (!m_domEditor->insertBefore(parentNode, node.release(), anchorNode, e xceptionState)) 397 if (!m_domEditor->insertBefore(parentNode, node.release(), anchorNode, e xceptionState))
398 return false; 398 return false;
399 } 399 }
400 return true; 400 return true;
401 } 401 }
402 402
403 static void addStringToDigestor(blink::WebCryptoDigestor* digestor, const String & string) 403 static void addStringToDigestor(WebCryptoDigestor* digestor, const String& strin g)
404 { 404 {
405 digestor->consume(reinterpret_cast<const unsigned char*>(string.utf8().data( )), string.length()); 405 digestor->consume(reinterpret_cast<const unsigned char*>(string.utf8().data( )), string.length());
406 } 406 }
407 407
408 PassOwnPtr<DOMPatchSupport::Digest> DOMPatchSupport::createDigest(Node* node, Un usedNodesMap* unusedNodesMap) 408 PassOwnPtr<DOMPatchSupport::Digest> DOMPatchSupport::createDigest(Node* node, Un usedNodesMap* unusedNodesMap)
409 { 409 {
410 Digest* digest = new Digest(node); 410 Digest* digest = new Digest(node);
411 411
412 OwnPtr<blink::WebCryptoDigestor> digestor = createDigestor(HashAlgorithmSha1 ); 412 OwnPtr<WebCryptoDigestor> digestor = createDigestor(HashAlgorithmSha1);
413 DigestValue digestResult; 413 DigestValue digestResult;
414 414
415 Node::NodeType nodeType = node->nodeType(); 415 Node::NodeType nodeType = node->nodeType();
416 digestor->consume(reinterpret_cast<const unsigned char*>(&nodeType), sizeof( nodeType)); 416 digestor->consume(reinterpret_cast<const unsigned char*>(&nodeType), sizeof( nodeType));
417 addStringToDigestor(digestor.get(), node->nodeName()); 417 addStringToDigestor(digestor.get(), node->nodeName());
418 addStringToDigestor(digestor.get(), node->nodeValue()); 418 addStringToDigestor(digestor.get(), node->nodeValue());
419 419
420 if (node->isElementNode()) { 420 if (node->isElementNode()) {
421 Element& element = toElement(*node); 421 Element& element = toElement(*node);
422 Node* child = element.firstChild(); 422 Node* child = element.firstChild();
423 while (child) { 423 while (child) {
424 OwnPtr<Digest> childInfo = createDigest(child, unusedNodesMap); 424 OwnPtr<Digest> childInfo = createDigest(child, unusedNodesMap);
425 addStringToDigestor(digestor.get(), childInfo->m_sha1); 425 addStringToDigestor(digestor.get(), childInfo->m_sha1);
426 child = child->nextSibling(); 426 child = child->nextSibling();
427 digest->m_children.append(childInfo.release()); 427 digest->m_children.append(childInfo.release());
428 } 428 }
429 429
430 AttributeCollection attributes = element.attributesWithoutUpdate(); 430 AttributeCollection attributes = element.attributesWithoutUpdate();
431 if (!attributes.isEmpty()) { 431 if (!attributes.isEmpty()) {
432 OwnPtr<blink::WebCryptoDigestor> attrsDigestor = createDigestor(Hash AlgorithmSha1); 432 OwnPtr<WebCryptoDigestor> attrsDigestor = createDigestor(HashAlgorit hmSha1);
433 for (auto& attribute : attributes) { 433 for (auto& attribute : attributes) {
434 addStringToDigestor(attrsDigestor.get(), attribute.name().toStri ng()); 434 addStringToDigestor(attrsDigestor.get(), attribute.name().toStri ng());
435 addStringToDigestor(attrsDigestor.get(), attribute.value().strin g()); 435 addStringToDigestor(attrsDigestor.get(), attribute.value().strin g());
436 } 436 }
437 finishDigestor(attrsDigestor.get(), digestResult); 437 finishDigestor(attrsDigestor.get(), digestResult);
438 digest->m_attrsSHA1 = base64Encode(reinterpret_cast<const char*>(dig estResult.data()), 10); 438 digest->m_attrsSHA1 = base64Encode(reinterpret_cast<const char*>(dig estResult.data()), 10);
439 addStringToDigestor(digestor.get(), digest->m_attrsSHA1); 439 addStringToDigestor(digestor.get(), digest->m_attrsSHA1);
440 digestResult.clear(); 440 digestResult.clear();
441 } 441 }
442 } 442 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name) 507 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name)
508 { 508 {
509 fprintf(stderr, "\n\n"); 509 fprintf(stderr, "\n\n");
510 for (size_t i = 0; i < map.size(); ++i) 510 for (size_t i = 0; i < map.size(); ++i)
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 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);
512 } 512 }
513 #endif 513 #endif
514 514
515 } // namespace blink 515 } // namespace blink
516 516
OLDNEW
« no previous file with comments | « Source/core/imagebitmap/ImageBitmapFactories.cpp ('k') | Source/core/inspector/InjectedScriptManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698