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

Side by Side Diff: chrome/browser/media/webrtc_log_util.cc

Issue 1099803003: [chrome/browser/media] favor DCHECK_CURRENTLY_ON for better logs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed build issue Created 5 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/media/webrtc_log_util.h" 5 #include "chrome/browser/media/webrtc_log_util.h"
6 6
7 #include "base/files/file_enumerator.h" 7 #include "base/files/file_enumerator.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 26 matching lines...) Expand all
37 37
38 // static 38 // static
39 void WebRtcLogUtil::DeleteOldWebRtcLogFiles(const base::FilePath& log_dir) { 39 void WebRtcLogUtil::DeleteOldWebRtcLogFiles(const base::FilePath& log_dir) {
40 DeleteOldAndRecentWebRtcLogFiles(log_dir, base::Time::Max()); 40 DeleteOldAndRecentWebRtcLogFiles(log_dir, base::Time::Max());
41 } 41 }
42 42
43 // static 43 // static
44 void WebRtcLogUtil::DeleteOldAndRecentWebRtcLogFiles( 44 void WebRtcLogUtil::DeleteOldAndRecentWebRtcLogFiles(
45 const base::FilePath& log_dir, 45 const base::FilePath& log_dir,
46 const base::Time& delete_begin_time) { 46 const base::Time& delete_begin_time) {
47 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 47 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
48 48
49 if (!base::PathExists(log_dir)) { 49 if (!base::PathExists(log_dir)) {
50 // This will happen if no logs have been stored or uploaded. 50 // This will happen if no logs have been stored or uploaded.
51 DVLOG(3) << "Could not find directory: " << log_dir.value(); 51 DVLOG(3) << "Could not find directory: " << log_dir.value();
52 return; 52 return;
53 } 53 }
54 54
55 const base::Time now = base::Time::Now(); 55 const base::Time now = base::Time::Now();
56 const base::TimeDelta time_to_keep_logs = 56 const base::TimeDelta time_to_keep_logs =
57 base::TimeDelta::FromDays(kDaysToKeepLogs); 57 base::TimeDelta::FromDays(kDaysToKeepLogs);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 RemoveEmptyEntriesInLogList(&log_list); 95 RemoveEmptyEntriesInLogList(&log_list);
96 96
97 if (update_log_list) { 97 if (update_log_list) {
98 int written = base::WriteFile(log_list_path, &log_list[0], log_list.size()); 98 int written = base::WriteFile(log_list_path, &log_list[0], log_list.size());
99 DPCHECK(written == static_cast<int>(log_list.size())); 99 DPCHECK(written == static_cast<int>(log_list.size()));
100 } 100 }
101 } 101 }
102 102
103 // static 103 // static
104 void WebRtcLogUtil::DeleteOldWebRtcLogFilesForAllProfiles() { 104 void WebRtcLogUtil::DeleteOldWebRtcLogFilesForAllProfiles() {
105 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 105 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
106 106
107 ProfileInfoCache& profile_cache = 107 ProfileInfoCache& profile_cache =
108 g_browser_process->profile_manager()->GetProfileInfoCache(); 108 g_browser_process->profile_manager()->GetProfileInfoCache();
109 size_t profiles_count = profile_cache.GetNumberOfProfiles(); 109 size_t profiles_count = profile_cache.GetNumberOfProfiles();
110 for (size_t i = 0; i < profiles_count; ++i) { 110 for (size_t i = 0; i < profiles_count; ++i) {
111 content::BrowserThread::PostTask( 111 content::BrowserThread::PostTask(
112 content::BrowserThread::FILE, 112 content::BrowserThread::FILE,
113 FROM_HERE, 113 FROM_HERE,
114 base::Bind(&DeleteOldWebRtcLogFiles, 114 base::Bind(&DeleteOldWebRtcLogFiles,
115 WebRtcLogList::GetWebRtcLogDirectoryForProfile( 115 WebRtcLogList::GetWebRtcLogDirectoryForProfile(
116 profile_cache.GetPathOfProfileAtIndex(i)))); 116 profile_cache.GetPathOfProfileAtIndex(i))));
117 } 117 }
118 } 118 }
OLDNEW
« no previous file with comments | « chrome/browser/media/media_stream_devices_controller.cc ('k') | chrome/browser/media/webrtc_logging_handler_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698