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

Side by Side Diff: extensions/browser/content_hash_tree.cc

Issue 2236443003: extensions: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't add braces Created 4 years, 4 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
« no previous file with comments | « extensions/browser/computed_hashes.cc ('k') | extensions/browser/content_hash_tree_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "extensions/browser/content_hash_tree.h" 5 #include "extensions/browser/content_hash_tree.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "crypto/secure_hash.h" 10 #include "crypto/secure_hash.h"
(...skipping 24 matching lines...) Expand all
35 while (i != current->end()) { 35 while (i != current->end()) {
36 std::unique_ptr<crypto::SecureHash> hash( 36 std::unique_ptr<crypto::SecureHash> hash(
37 crypto::SecureHash::Create(crypto::SecureHash::SHA256)); 37 crypto::SecureHash::Create(crypto::SecureHash::SHA256));
38 for (int j = 0; j < branch_factor && i != current->end(); j++) { 38 for (int j = 0; j < branch_factor && i != current->end(); j++) {
39 DCHECK_EQ(i->size(), crypto::kSHA256Length); 39 DCHECK_EQ(i->size(), crypto::kSHA256Length);
40 hash->Update(i->data(), i->size()); 40 hash->Update(i->data(), i->size());
41 ++i; 41 ++i;
42 } 42 }
43 parent_nodes.push_back(std::string(crypto::kSHA256Length, 0)); 43 parent_nodes.push_back(std::string(crypto::kSHA256Length, 0));
44 std::string* output = &(parent_nodes.back()); 44 std::string* output = &(parent_nodes.back());
45 hash->Finish(string_as_array(output), output->size()); 45 hash->Finish(base::string_as_array(output), output->size());
46 } 46 }
47 current_nodes.swap(parent_nodes); 47 current_nodes.swap(parent_nodes);
48 parent_nodes.clear(); 48 parent_nodes.clear();
49 current = &current_nodes; 49 current = &current_nodes;
50 } 50 }
51 DCHECK_EQ(1u, current->size()); 51 DCHECK_EQ(1u, current->size());
52 return (*current)[0]; 52 return (*current)[0];
53 } 53 }
54 54
55 } // namespace extensions 55 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/computed_hashes.cc ('k') | extensions/browser/content_hash_tree_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698