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

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

Issue 2800133003: Avoid duplicate functions: one AddStringToDigestor is enough (Closed)
Patch Set: Avoid duplicate functions/code: one AddStringToDigestor is enough. Created 3 years, 5 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 25 matching lines...) Expand all
36 #include "core/dom/ContextFeatures.h" 36 #include "core/dom/ContextFeatures.h"
37 #include "core/dom/Document.h" 37 #include "core/dom/Document.h"
38 #include "core/dom/DocumentFragment.h" 38 #include "core/dom/DocumentFragment.h"
39 #include "core/dom/Node.h" 39 #include "core/dom/Node.h"
40 #include "core/dom/NodeTraversal.h" 40 #include "core/dom/NodeTraversal.h"
41 #include "core/dom/XMLDocument.h" 41 #include "core/dom/XMLDocument.h"
42 #include "core/html/HTMLBodyElement.h" 42 #include "core/html/HTMLBodyElement.h"
43 #include "core/html/HTMLDocument.h" 43 #include "core/html/HTMLDocument.h"
44 #include "core/html/HTMLHeadElement.h" 44 #include "core/html/HTMLHeadElement.h"
45 #include "core/html/parser/HTMLDocumentParser.h" 45 #include "core/html/parser/HTMLDocumentParser.h"
46 #include "core/inspector/AddStringToDigestor.h"
46 #include "core/inspector/DOMEditor.h" 47 #include "core/inspector/DOMEditor.h"
47 #include "core/inspector/InspectorHistory.h" 48 #include "core/inspector/InspectorHistory.h"
48 #include "core/xml/parser/XMLDocumentParser.h" 49 #include "core/xml/parser/XMLDocumentParser.h"
49 #include "platform/Crypto.h" 50 #include "platform/Crypto.h"
50 #include "platform/wtf/Deque.h" 51 #include "platform/wtf/Deque.h"
51 #include "platform/wtf/HashTraits.h" 52 #include "platform/wtf/HashTraits.h"
52 #include "platform/wtf/RefPtr.h" 53 #include "platform/wtf/RefPtr.h"
53 #include "platform/wtf/text/Base64.h" 54 #include "platform/wtf/text/Base64.h"
54 #include "platform/wtf/text/CString.h" 55 #include "platform/wtf/text/CString.h"
55 #include "public/platform/Platform.h" 56 #include "public/platform/Platform.h"
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 continue; 428 continue;
428 } 429 }
429 430
430 if (!dom_editor_->InsertBefore(parent_node, node, anchor_node, 431 if (!dom_editor_->InsertBefore(parent_node, node, anchor_node,
431 exception_state)) 432 exception_state))
432 return false; 433 return false;
433 } 434 }
434 return true; 435 return true;
435 } 436 }
436 437
437 static void AddStringToDigestor(WebCryptoDigestor* digestor,
438 const String& string) {
439 digestor->Consume(
440 reinterpret_cast<const unsigned char*>(string.Utf8().data()),
441 string.length());
442 }
443
444 DOMPatchSupport::Digest* DOMPatchSupport::CreateDigest( 438 DOMPatchSupport::Digest* DOMPatchSupport::CreateDigest(
445 Node* node, 439 Node* node,
446 UnusedNodesMap* unused_nodes_map) { 440 UnusedNodesMap* unused_nodes_map) {
447 Digest* digest = new Digest(node); 441 Digest* digest = new Digest(node);
448 442
449 std::unique_ptr<WebCryptoDigestor> digestor = 443 std::unique_ptr<WebCryptoDigestor> digestor =
450 CreateDigestor(kHashAlgorithmSha1); 444 CreateDigestor(kHashAlgorithmSha1);
451 DigestValue digest_result; 445 DigestValue digest_result;
452 446
453 Node::NodeType node_type = node->getNodeType(); 447 Node::NodeType node_type = node->getNodeType();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 queue.push_back(first->children_[i].Get()); 540 queue.push_back(first->children_[i].Get());
547 } 541 }
548 } 542 }
549 543
550 DEFINE_TRACE(DOMPatchSupport::Digest) { 544 DEFINE_TRACE(DOMPatchSupport::Digest) {
551 visitor->Trace(node_); 545 visitor->Trace(node_);
552 visitor->Trace(children_); 546 visitor->Trace(children_);
553 } 547 }
554 548
555 } // namespace blink 549 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698