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

Side by Side Diff: components/policy/core/common/schema.cc

Issue 1441543002: Make vector_as_array use std::vector::data and switch a few directories. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mark comment Created 5 years, 1 month 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 | « components/policy/core/common/preg_parser_win.cc ('k') | crypto/hmac_openssl.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/policy/core/common/schema.h" 5 #include "components/policy/core/common/schema.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <climits> 8 #include <climits>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 sizes.string_enums != storage->string_enums_.size()) { 323 sizes.string_enums != storage->string_enums_.size()) {
324 *error = "Failed to parse the schema due to a Chrome bug. Please file a " 324 *error = "Failed to parse the schema due to a Chrome bug. Please file a "
325 "new issue at http://crbug.com"; 325 "new issue at http://crbug.com";
326 return NULL; 326 return NULL;
327 } 327 }
328 328
329 if (!ResolveReferences(id_map, reference_list, error)) 329 if (!ResolveReferences(id_map, reference_list, error))
330 return NULL; 330 return NULL;
331 331
332 SchemaData* data = &storage->schema_data_; 332 SchemaData* data = &storage->schema_data_;
333 data->schema_nodes = vector_as_array(&storage->schema_nodes_); 333 data->schema_nodes = storage->schema_nodes_.data();
334 data->property_nodes = vector_as_array(&storage->property_nodes_); 334 data->property_nodes = storage->property_nodes_.data();
335 data->properties_nodes = vector_as_array(&storage->properties_nodes_); 335 data->properties_nodes = storage->properties_nodes_.data();
336 data->restriction_nodes = vector_as_array(&storage->restriction_nodes_); 336 data->restriction_nodes = storage->restriction_nodes_.data();
337 data->int_enums = vector_as_array(&storage->int_enums_); 337 data->int_enums = storage->int_enums_.data();
338 data->string_enums = vector_as_array(&storage->string_enums_); 338 data->string_enums = storage->string_enums_.data();
339 return storage; 339 return storage;
340 } 340 }
341 341
342 re2::RE2* Schema::InternalStorage::CompileRegex( 342 re2::RE2* Schema::InternalStorage::CompileRegex(
343 const std::string& pattern) const { 343 const std::string& pattern) const {
344 base::ScopedPtrMap<std::string, scoped_ptr<re2::RE2>>::const_iterator it = 344 base::ScopedPtrMap<std::string, scoped_ptr<re2::RE2>>::const_iterator it =
345 regex_cache_.find(pattern); 345 regex_cache_.find(pattern);
346 if (it == regex_cache_.end()) { 346 if (it == regex_cache_.end()) {
347 scoped_ptr<re2::RE2> compiled(new re2::RE2(pattern)); 347 scoped_ptr<re2::RE2> compiled(new re2::RE2(pattern));
348 re2::RE2* compiled_ptr = compiled.get(); 348 re2::RE2* compiled_ptr = compiled.get();
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 return false; 1100 return false;
1101 } else { 1101 } else {
1102 int index = rnode->string_pattern_restriction.pattern_index; 1102 int index = rnode->string_pattern_restriction.pattern_index;
1103 DCHECK(index == rnode->string_pattern_restriction.pattern_index_backup); 1103 DCHECK(index == rnode->string_pattern_restriction.pattern_index_backup);
1104 re2::RE2* regex = storage_->CompileRegex(*storage_->string_enums(index)); 1104 re2::RE2* regex = storage_->CompileRegex(*storage_->string_enums(index));
1105 return re2::RE2::PartialMatch(str, *regex); 1105 return re2::RE2::PartialMatch(str, *regex);
1106 } 1106 }
1107 } 1107 }
1108 1108
1109 } // namespace policy 1109 } // namespace policy
OLDNEW
« no previous file with comments | « components/policy/core/common/preg_parser_win.cc ('k') | crypto/hmac_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698