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

Side by Side Diff: third_party/WebKit/Source/core/frame/SubresourceIntegrity.cpp

Issue 2883353002: Replace ASSERT with DCHECK_LE/GE/GT/LT/NE as appropriate (Closed)
Patch Set: DCHECK in BluetoothCharacteristicProperties.cpp Created 3 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/frame/SubresourceIntegrity.h" 5 #include "core/frame/SubresourceIntegrity.h"
6 6
7 #include "core/HTMLNames.h" 7 #include "core/HTMLNames.h"
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/Element.h" 9 #include "core/dom/Element.h"
10 #include "core/dom/ExecutionContext.h" 10 #include "core/dom/ExecutionContext.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 digest.size(), kBase64DoNotInsertLFs); 63 digest.size(), kBase64DoNotInsertLFs);
64 } 64 }
65 65
66 HashAlgorithm SubresourceIntegrity::GetPrioritizedHashFunction( 66 HashAlgorithm SubresourceIntegrity::GetPrioritizedHashFunction(
67 HashAlgorithm algorithm1, 67 HashAlgorithm algorithm1,
68 HashAlgorithm algorithm2) { 68 HashAlgorithm algorithm2) {
69 const HashAlgorithm kWeakerThanSha384[] = {kHashAlgorithmSha256}; 69 const HashAlgorithm kWeakerThanSha384[] = {kHashAlgorithmSha256};
70 const HashAlgorithm kWeakerThanSha512[] = {kHashAlgorithmSha256, 70 const HashAlgorithm kWeakerThanSha512[] = {kHashAlgorithmSha256,
71 kHashAlgorithmSha384}; 71 kHashAlgorithmSha384};
72 72
73 ASSERT(algorithm1 != kHashAlgorithmSha1); 73 DCHECK_NE(algorithm1, kHashAlgorithmSha1);
74 ASSERT(algorithm2 != kHashAlgorithmSha1); 74 DCHECK_NE(algorithm2, kHashAlgorithmSha1);
75 75
76 if (algorithm1 == algorithm2) 76 if (algorithm1 == algorithm2)
77 return algorithm1; 77 return algorithm1;
78 78
79 const HashAlgorithm* weaker_algorithms = 0; 79 const HashAlgorithm* weaker_algorithms = 0;
80 size_t length = 0; 80 size_t length = 0;
81 switch (algorithm1) { 81 switch (algorithm1) {
82 case kHashAlgorithmSha256: 82 case kHashAlgorithmSha256:
83 break; 83 break;
84 case kHashAlgorithmSha384: 84 case kHashAlgorithmSha384:
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 metadata_set.insert(integrity_metadata.ToPair()); 417 metadata_set.insert(integrity_metadata.ToPair());
418 } 418 }
419 419
420 if (metadata_set.size() == 0 && error) 420 if (metadata_set.size() == 0 && error)
421 return kIntegrityParseNoValidResult; 421 return kIntegrityParseNoValidResult;
422 422
423 return kIntegrityParseValidResult; 423 return kIntegrityParseValidResult;
424 } 424 }
425 425
426 } // namespace blink 426 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698