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

Side by Side Diff: net/tools/tld_cleanup/tld_cleanup.cc

Issue 594603003: Infrastructure for reading V8's initial snapshot from external files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Properly override v8_use_external_snapshot in v8 Created 6 years, 3 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
« gin/public/isolate_holder.h ('K') | « mojo/apps/js/main.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This command-line program converts an effective-TLD data file in UTF-8 from 5 // This command-line program converts an effective-TLD data file in UTF-8 from
6 // the format provided by Mozilla to the format expected by Chrome. This 6 // the format provided by Mozilla to the format expected by Chrome. This
7 // program generates an intermediate file which is then used by gperf to 7 // program generates an intermediate file which is then used by gperf to
8 // generate a perfect hash map. The benefit of this approach is that no time is 8 // generate a perfect hash map. The benefit of this approach is that no time is
9 // spent on program initialization to generate the map of this data. 9 // spent on program initialization to generate the map of this data.
10 // 10 //
(...skipping 10 matching lines...) Expand all
21 // * Logs a warning if GURL reports a rule as invalid, but keeps the rule. 21 // * Logs a warning if GURL reports a rule as invalid, but keeps the rule.
22 // * Canonicalizes each rule's domain by converting it to a GURL and back. 22 // * Canonicalizes each rule's domain by converting it to a GURL and back.
23 // * Adds explicit rules for true TLDs found in any rule. 23 // * Adds explicit rules for true TLDs found in any rule.
24 // * Marks entries in the file between "// ===BEGIN PRIVATE DOMAINS===" 24 // * Marks entries in the file between "// ===BEGIN PRIVATE DOMAINS==="
25 // and "// ===END PRIVATE DOMAINS===" as private. 25 // and "// ===END PRIVATE DOMAINS===" as private.
26 26
27 #include "base/at_exit.h" 27 #include "base/at_exit.h"
28 #include "base/command_line.h" 28 #include "base/command_line.h"
29 #include "base/files/file_path.h" 29 #include "base/files/file_path.h"
30 #include "base/files/file_util.h" 30 #include "base/files/file_util.h"
31 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
32 #include "gin/public/isolate_holder.h"
33 #endif // V8_USE_EXTERNAL_STARTUP_DATA
31 #include "base/i18n/icu_util.h" 34 #include "base/i18n/icu_util.h"
32 #include "base/logging.h" 35 #include "base/logging.h"
33 #include "base/path_service.h" 36 #include "base/path_service.h"
34 #include "base/process/memory.h" 37 #include "base/process/memory.h"
35 #include "net/tools/tld_cleanup/tld_cleanup_util.h" 38 #include "net/tools/tld_cleanup/tld_cleanup_util.h"
36 39
37 int main(int argc, const char* argv[]) { 40 int main(int argc, const char* argv[]) {
38 base::EnableTerminationOnHeapCorruption(); 41 base::EnableTerminationOnHeapCorruption();
39 if (argc != 1) { 42 if (argc != 1) {
40 fprintf(stderr, "Normalizes and verifies UTF-8 TLD data files\n"); 43 fprintf(stderr, "Normalizes and verifies UTF-8 TLD data files\n");
(...skipping 18 matching lines...) Expand all
59 PathService::Get(base::DIR_EXE, &log_filename); 62 PathService::Get(base::DIR_EXE, &log_filename);
60 log_filename = log_filename.AppendASCII("tld_cleanup.log"); 63 log_filename = log_filename.AppendASCII("tld_cleanup.log");
61 logging::LoggingSettings settings; 64 logging::LoggingSettings settings;
62 settings.logging_dest = destination; 65 settings.logging_dest = destination;
63 settings.log_file = log_filename.value().c_str(); 66 settings.log_file = log_filename.value().c_str();
64 settings.delete_old = logging::DELETE_OLD_LOG_FILE; 67 settings.delete_old = logging::DELETE_OLD_LOG_FILE;
65 logging::InitLogging(settings); 68 logging::InitLogging(settings);
66 69
67 base::i18n::InitializeICU(); 70 base::i18n::InitializeICU();
68 71
72 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
73 gin::IsolateHolder::LoadV8Snapshot();
74 #endif // V8_USE_EXTERNAL_STARTUP_DATA
75
69 base::FilePath input_file; 76 base::FilePath input_file;
70 PathService::Get(base::DIR_SOURCE_ROOT, &input_file); 77 PathService::Get(base::DIR_SOURCE_ROOT, &input_file);
71 input_file = input_file.Append(FILE_PATH_LITERAL("net")) 78 input_file = input_file.Append(FILE_PATH_LITERAL("net"))
72 .Append(FILE_PATH_LITERAL("base")) 79 .Append(FILE_PATH_LITERAL("base"))
73 .Append(FILE_PATH_LITERAL( 80 .Append(FILE_PATH_LITERAL(
74 "registry_controlled_domains")) 81 "registry_controlled_domains"))
75 .Append(FILE_PATH_LITERAL("effective_tld_names.dat")); 82 .Append(FILE_PATH_LITERAL("effective_tld_names.dat"));
76 base::FilePath output_file; 83 base::FilePath output_file;
77 PathService::Get(base::DIR_SOURCE_ROOT, &output_file); 84 PathService::Get(base::DIR_SOURCE_ROOT, &output_file);
78 output_file = output_file.Append(FILE_PATH_LITERAL("net")) 85 output_file = output_file.Append(FILE_PATH_LITERAL("net"))
79 .Append(FILE_PATH_LITERAL("base")) 86 .Append(FILE_PATH_LITERAL("base"))
80 .Append(FILE_PATH_LITERAL( 87 .Append(FILE_PATH_LITERAL(
81 "registry_controlled_domains")) 88 "registry_controlled_domains"))
82 .Append(FILE_PATH_LITERAL( 89 .Append(FILE_PATH_LITERAL(
83 "effective_tld_names.gperf")); 90 "effective_tld_names.gperf"));
84 net::tld_cleanup::NormalizeResult result = 91 net::tld_cleanup::NormalizeResult result =
85 net::tld_cleanup::NormalizeFile(input_file, output_file); 92 net::tld_cleanup::NormalizeFile(input_file, output_file);
86 if (result != net::tld_cleanup::kSuccess) { 93 if (result != net::tld_cleanup::kSuccess) {
87 fprintf(stderr, 94 fprintf(stderr,
88 "Errors or warnings processing file. See log in tld_cleanup.log."); 95 "Errors or warnings processing file. See log in tld_cleanup.log.");
89 } 96 }
90 97
91 if (result == net::tld_cleanup::kError) 98 if (result == net::tld_cleanup::kError)
92 return 1; 99 return 1;
93 return 0; 100 return 0;
94 } 101 }
OLDNEW
« gin/public/isolate_holder.h ('K') | « mojo/apps/js/main.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698