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

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

Issue 833513002: Revert of replace COMPILE_ASSERT with static_assert in chrome/installer/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « 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 static_assert(kTruncatedInstallerLogFileSize < kMaxInstallerLogFileSize, 27 COMPILE_ASSERT(kTruncatedInstallerLogFileSize < kMaxInstallerLogFileSize,
28 "kTruncatedInstallerLogFileSize should be less than " 28 kTruncatedInstallerLogFileSize_not_lt_kMaxInstallerLogFileSize);
29 "kMaxInstallerLogFileSize");
30 29
31 enum TruncateResult { 30 enum TruncateResult {
32 LOGFILE_UNTOUCHED, 31 LOGFILE_UNTOUCHED,
33 LOGFILE_TRUNCATED, 32 LOGFILE_TRUNCATED,
34 LOGFILE_DELETED, 33 LOGFILE_DELETED,
35 }; 34 };
36 35
37 // Cuts off the _beginning_ of the file at |log_file| down to 36 // Cuts off the _beginning_ of the file at |log_file| down to
38 // kTruncatedInstallerLogFileSize if it exceeds kMaxInstallerLogFileSize bytes. 37 // kTruncatedInstallerLogFileSize if it exceeds kMaxInstallerLogFileSize bytes.
39 // 38 //
40 // If the file is not changed, returns LOGFILE_UNTOUCHED. 39 // If the file is not changed, returns LOGFILE_UNTOUCHED.
41 // If the file is successfully truncated, returns LOGFILE_TRUNCATED. 40 // If the file is successfully truncated, returns LOGFILE_TRUNCATED.
42 // If the file needed truncation, but the truncation failed, the file will be 41 // If the file needed truncation, but the truncation failed, the file will be
43 // deleted and the function returns LOGFILE_DELETED. This is done to prevent 42 // deleted and the function returns LOGFILE_DELETED. This is done to prevent
44 // run-away log files and guard against full disks. 43 // run-away log files and guard against full disks.
45 TruncateResult TruncateLogFileIfNeeded(const base::FilePath& log_file); 44 TruncateResult TruncateLogFileIfNeeded(const base::FilePath& log_file);
46 45
47 // Call to initialize logging for Chrome installer. 46 // Call to initialize logging for Chrome installer.
48 void InitInstallerLogging(const installer::MasterPreferences& prefs); 47 void InitInstallerLogging(const installer::MasterPreferences& prefs);
49 48
50 // Call when done using logging for Chrome installer. 49 // Call when done using logging for Chrome installer.
51 void EndInstallerLogging(); 50 void EndInstallerLogging();
52 51
53 // Returns the full path of the log file. 52 // Returns the full path of the log file.
54 base::FilePath GetLogFilePath(const installer::MasterPreferences& prefs); 53 base::FilePath GetLogFilePath(const installer::MasterPreferences& prefs);
55 54
56 } // namespace installer 55 } // namespace installer
57 56
58 #endif // CHROME_INSTALLER_UTIL_LOGGING_INSTALLER_H_ 57 #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