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

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

Issue 2800133003: Avoid duplicate functions: one AddStringToDigestor is enough (Closed)
Patch Set: Adding spacer lines 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 continue; 421 continue;
421 } 422 }
422 423
423 if (!dom_editor_->InsertBefore(parent_node, node, anchor_node, 424 if (!dom_editor_->InsertBefore(parent_node, node, anchor_node,
424 exception_state)) 425 exception_state))
425 return false; 426 return false;
426 } 427 }
427 return true; 428 return true;
428 } 429 }
429 430
430 static void AddStringToDigestor(WebCryptoDigestor* digestor,
431 const String& string) {
432 digestor->Consume(
433 reinterpret_cast<const unsigned char*>(string.Utf8().data()),
434 string.length());
435 }
436
437 DOMPatchSupport::Digest* DOMPatchSupport::CreateDigest( 431 DOMPatchSupport::Digest* DOMPatchSupport::CreateDigest(
438 Node* node, 432 Node* node,
439 UnusedNodesMap* unused_nodes_map) { 433 UnusedNodesMap* unused_nodes_map) {
440 Digest* digest = new Digest(node); 434 Digest* digest = new Digest(node);
441 435
442 std::unique_ptr<WebCryptoDigestor> digestor = 436 std::unique_ptr<WebCryptoDigestor> digestor =
443 CreateDigestor(kHashAlgorithmSha1); 437 CreateDigestor(kHashAlgorithmSha1);
444 DigestValue digest_result; 438 DigestValue digest_result;
445 439
446 Node::NodeType node_type = node->getNodeType(); 440 Node::NodeType node_type = node->getNodeType();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 queue.push_back(first->children_[i].Get()); 533 queue.push_back(first->children_[i].Get());
540 } 534 }
541 } 535 }
542 536
543 DEFINE_TRACE(DOMPatchSupport::Digest) { 537 DEFINE_TRACE(DOMPatchSupport::Digest) {
544 visitor->Trace(node_); 538 visitor->Trace(node_);
545 visitor->Trace(children_); 539 visitor->Trace(children_);
546 } 540 }
547 541
548 } // namespace blink 542 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698