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

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

Issue 16519003: Define a LoggingSettings struct to use for InitLogging() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « net/tools/testserver/run_testserver.cc ('k') | ppapi/proxy/plugin_main_nacl.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 (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 29 matching lines...) Expand all
40 fprintf(stderr, "Normalizes and verifies UTF-8 TLD data files\n"); 40 fprintf(stderr, "Normalizes and verifies UTF-8 TLD data files\n");
41 fprintf(stderr, "Usage: %s\n", argv[0]); 41 fprintf(stderr, "Usage: %s\n", argv[0]);
42 return 1; 42 return 1;
43 } 43 }
44 44
45 // Manages the destruction of singletons. 45 // Manages the destruction of singletons.
46 base::AtExitManager exit_manager; 46 base::AtExitManager exit_manager;
47 47
48 // Only use OutputDebugString in debug mode. 48 // Only use OutputDebugString in debug mode.
49 #ifdef NDEBUG 49 #ifdef NDEBUG
50 logging::LoggingDestination destination = logging::LOG_ONLY_TO_FILE; 50 logging::LoggingDestination destination = logging::LOG_TO_FILE;
51 #else 51 #else
52 logging::LoggingDestination destination = 52 logging::LoggingDestination destination =
53 logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG; 53 logging::LOG_TO_ALL;
54 #endif 54 #endif
55 55
56 CommandLine::Init(argc, argv); 56 CommandLine::Init(argc, argv);
57 57
58 base::FilePath log_filename; 58 base::FilePath log_filename;
59 PathService::Get(base::DIR_EXE, &log_filename); 59 PathService::Get(base::DIR_EXE, &log_filename);
60 log_filename = log_filename.AppendASCII("tld_cleanup.log"); 60 log_filename = log_filename.AppendASCII("tld_cleanup.log");
61 logging::InitLogging( 61 logging::LoggingSettings settings;
62 log_filename.value().c_str(), 62 settings.logging_dest = destination;
63 destination, 63 settings.log_file = log_filename.value().c_str();
64 logging::LOCK_LOG_FILE, 64 settings.delete_old = logging::DELETE_OLD_LOG_FILE;
65 logging::DELETE_OLD_LOG_FILE, 65 logging::InitLogging(settings);
66 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS);
67 66
68 icu_util::Initialize(); 67 icu_util::Initialize();
69 68
70 base::FilePath input_file; 69 base::FilePath input_file;
71 PathService::Get(base::DIR_SOURCE_ROOT, &input_file); 70 PathService::Get(base::DIR_SOURCE_ROOT, &input_file);
72 input_file = input_file.Append(FILE_PATH_LITERAL("net")) 71 input_file = input_file.Append(FILE_PATH_LITERAL("net"))
73 .Append(FILE_PATH_LITERAL("base")) 72 .Append(FILE_PATH_LITERAL("base"))
74 .Append(FILE_PATH_LITERAL( 73 .Append(FILE_PATH_LITERAL(
75 "registry_controlled_domains")) 74 "registry_controlled_domains"))
76 .Append(FILE_PATH_LITERAL("effective_tld_names.dat")); 75 .Append(FILE_PATH_LITERAL("effective_tld_names.dat"));
77 base::FilePath output_file; 76 base::FilePath output_file;
78 PathService::Get(base::DIR_SOURCE_ROOT, &output_file); 77 PathService::Get(base::DIR_SOURCE_ROOT, &output_file);
79 output_file = output_file.Append(FILE_PATH_LITERAL("net")) 78 output_file = output_file.Append(FILE_PATH_LITERAL("net"))
80 .Append(FILE_PATH_LITERAL("base")) 79 .Append(FILE_PATH_LITERAL("base"))
81 .Append(FILE_PATH_LITERAL( 80 .Append(FILE_PATH_LITERAL(
82 "registry_controlled_domains")) 81 "registry_controlled_domains"))
83 .Append(FILE_PATH_LITERAL( 82 .Append(FILE_PATH_LITERAL(
84 "effective_tld_names.gperf")); 83 "effective_tld_names.gperf"));
85 net::tld_cleanup::NormalizeResult result = 84 net::tld_cleanup::NormalizeResult result =
86 net::tld_cleanup::NormalizeFile(input_file, output_file); 85 net::tld_cleanup::NormalizeFile(input_file, output_file);
87 if (result != net::tld_cleanup::kSuccess) { 86 if (result != net::tld_cleanup::kSuccess) {
88 fprintf(stderr, 87 fprintf(stderr,
89 "Errors or warnings processing file. See log in tld_cleanup.log."); 88 "Errors or warnings processing file. See log in tld_cleanup.log.");
90 } 89 }
91 90
92 if (result == net::tld_cleanup::kError) 91 if (result == net::tld_cleanup::kError)
93 return 1; 92 return 1;
94 return 0; 93 return 0;
95 } 94 }
OLDNEW
« no previous file with comments | « net/tools/testserver/run_testserver.cc ('k') | ppapi/proxy/plugin_main_nacl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698