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 3 // found in the LICENSE file. 4 5 #include "chrome/browser/media/webrtc/webrtc_log_util.h" 6 7 #include <vector> 8 9 #include "base/bind.h" 10 #include "base/task/post_task.h" 11 #include "base/task/thread_pool.h" 12 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile_attributes_entry.h" 15 #include "chrome/browser/profiles/profile_attributes_storage.h" 16 #include "chrome/browser/profiles/profile_manager.h" 17 #include "components/webrtc_logging/browser/log_cleanup.h" 18 #include "components/webrtc_logging/browser/text_log_list.h" 19 #include "content/public/browser/browser_thread.h" 20 21 // static DeleteOldWebRtcLogFilesForAllProfiles()22void WebRtcLogUtil::DeleteOldWebRtcLogFilesForAllProfiles() { 23 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 24 25 std::vector<ProfileAttributesEntry*> entries = 26 g_browser_process->profile_manager()->GetProfileAttributesStorage(). 27 GetAllProfilesAttributes(); 28 for (ProfileAttributesEntry* entry : entries) { 29 base::ThreadPool::PostTask( 30 FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT}, 31 base::BindOnce( 32 &webrtc_logging::DeleteOldWebRtcLogFiles, 33 webrtc_logging::TextLogList:: 34 GetWebRtcLogDirectoryForBrowserContextPath(entry->GetPath()))); 35 } 36 } 37