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

Side by Side Diff: chrome/installer/util/logging_installer.h

Issue 821673004: replace COMPILE_ASSERT with static_assert in chrome/installer/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 | « chrome/installer/util/installer_state.cc ('k') | chrome/installer/util/shell_util.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_INSTALLER_UTIL_LOGGING_INSTALLER_H_ 5 #ifndef CHROME_INSTALLER_UTIL_LOGGING_INSTALLER_H_
6 #define CHROME_INSTALLER_UTIL_LOGGING_INSTALLER_H_ 6 #define CHROME_INSTALLER_UTIL_LOGGING_INSTALLER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 9
10 namespace base { 10 namespace base {
11 class FilePath; 11 class FilePath;
12 } 12 }
13 13
14 namespace installer { 14 namespace installer {
15 15
16 class MasterPreferences; 16 class MasterPreferences;
17 17
18 // Verbose installer runs clock in at around 50K, non-verbose much less than 18 // Verbose installer runs clock in at around 50K, non-verbose much less than
19 // that. Some installer operations span multiple setup.exe runs, so we try 19 // that. Some installer operations span multiple setup.exe runs, so we try
20 // to keep enough for at least 10 runs or so at any given time. 20 // to keep enough for at least 10 runs or so at any given time.
21 const int kMaxInstallerLogFileSize = 1024 * 1024; 21 const int kMaxInstallerLogFileSize = 1024 * 1024;
22 22
23 // Truncate the file down to half of the max, such that we don't incur 23 // Truncate the file down to half of the max, such that we don't incur
24 // truncation on every update. 24 // truncation on every update.
25 const int kTruncatedInstallerLogFileSize = kMaxInstallerLogFileSize / 2; 25 const int kTruncatedInstallerLogFileSize = kMaxInstallerLogFileSize / 2;
26 26
27 COMPILE_ASSERT(kTruncatedInstallerLogFileSize < kMaxInstallerLogFileSize, 27 static_assert(kTruncatedInstallerLogFileSize < kMaxInstallerLogFileSize,
28 kTruncatedInstallerLogFileSize_not_lt_kMaxInstallerLogFileSize); 28 "kTruncatedInstallerLogFileSize should be less than "
29 "kMaxInstallerLogFileSize");
29 30
30 enum TruncateResult { 31 enum TruncateResult {
31 LOGFILE_UNTOUCHED, 32 LOGFILE_UNTOUCHED,
32 LOGFILE_TRUNCATED, 33 LOGFILE_TRUNCATED,
33 LOGFILE_DELETED, 34 LOGFILE_DELETED,
34 }; 35 };
35 36
36 // Cuts off the _beginning_ of the file at |log_file| down to 37 // Cuts off the _beginning_ of the file at |log_file| down to
37 // kTruncatedInstallerLogFileSize if it exceeds kMaxInstallerLogFileSize bytes. 38 // kTruncatedInstallerLogFileSize if it exceeds kMaxInstallerLogFileSize bytes.
38 // 39 //
39 // If the file is not changed, returns LOGFILE_UNTOUCHED. 40 // If the file is not changed, returns LOGFILE_UNTOUCHED.
40 // If the file is successfully truncated, returns LOGFILE_TRUNCATED. 41 // If the file is successfully truncated, returns LOGFILE_TRUNCATED.
41 // If the file needed truncation, but the truncation failed, the file will be 42 // If the file needed truncation, but the truncation failed, the file will be
42 // deleted and the function returns LOGFILE_DELETED. This is done to prevent 43 // deleted and the function returns LOGFILE_DELETED. This is done to prevent
43 // run-away log files and guard against full disks. 44 // run-away log files and guard against full disks.
44 TruncateResult TruncateLogFileIfNeeded(const base::FilePath& log_file); 45 TruncateResult TruncateLogFileIfNeeded(const base::FilePath& log_file);
45 46
46 // Call to initialize logging for Chrome installer. 47 // Call to initialize logging for Chrome installer.
47 void InitInstallerLogging(const installer::MasterPreferences& prefs); 48 void InitInstallerLogging(const installer::MasterPreferences& prefs);
48 49
49 // Call when done using logging for Chrome installer. 50 // Call when done using logging for Chrome installer.
50 void EndInstallerLogging(); 51 void EndInstallerLogging();
51 52
52 // Returns the full path of the log file. 53 // Returns the full path of the log file.
53 base::FilePath GetLogFilePath(const installer::MasterPreferences& prefs); 54 base::FilePath GetLogFilePath(const installer::MasterPreferences& prefs);
54 55
55 } // namespace installer 56 } // namespace installer
56 57
57 #endif // CHROME_INSTALLER_UTIL_LOGGING_INSTALLER_H_ 58 #endif // CHROME_INSTALLER_UTIL_LOGGING_INSTALLER_H_
OLDNEW
« no previous file with comments | « chrome/installer/util/installer_state.cc ('k') | chrome/installer/util/shell_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698