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

Side by Side Diff: chrome/browser/crash_upload_list.cc

Issue 8536055: base::Bind() conversion for crash handler/uploader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | « chrome/browser/crash_handler_host_linux.cc ('k') | no next file » | 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 #include "chrome/browser/crash_upload_list.h" 5 #include "chrome/browser/crash_upload_list.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/bind.h"
9 #include "base/file_path.h" 10 #include "base/file_path.h"
10 #include "base/file_util.h" 11 #include "base/file_util.h"
11 #include "base/path_service.h" 12 #include "base/path_service.h"
12 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
13 #include "base/string_split.h" 14 #include "base/string_split.h"
14 #if defined(OS_WIN) 15 #if defined(OS_WIN)
15 #include "chrome/browser/crash_upload_list_win.h" 16 #include "chrome/browser/crash_upload_list_win.h"
16 #endif 17 #endif
17 #include "chrome/common/chrome_paths.h" 18 #include "chrome/common/chrome_paths.h"
18 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
(...skipping 12 matching lines...) Expand all
31 #else 32 #else
32 return new CrashUploadList(delegate); 33 return new CrashUploadList(delegate);
33 #endif 34 #endif
34 } 35 }
35 36
36 CrashUploadList::CrashUploadList(Delegate* delegate) : delegate_(delegate) {} 37 CrashUploadList::CrashUploadList(Delegate* delegate) : delegate_(delegate) {}
37 38
38 CrashUploadList::~CrashUploadList() {} 39 CrashUploadList::~CrashUploadList() {}
39 40
40 void CrashUploadList::LoadCrashListAsynchronously() { 41 void CrashUploadList::LoadCrashListAsynchronously() {
41 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 42 BrowserThread::PostTask(
42 NewRunnableMethod(this, 43 BrowserThread::FILE,
43 &CrashUploadList::LoadCrashListAndInformDelegateOfCompletion)); 44 FROM_HERE,
45 base::Bind(&CrashUploadList::LoadCrashListAndInformDelegateOfCompletion,
46 this));
44 } 47 }
45 48
46 void CrashUploadList::ClearDelegate() { 49 void CrashUploadList::ClearDelegate() {
47 delegate_ = NULL; 50 delegate_ = NULL;
48 } 51 }
49 52
50 53
51 void CrashUploadList::LoadCrashListAndInformDelegateOfCompletion() { 54 void CrashUploadList::LoadCrashListAndInformDelegateOfCompletion() {
52 LoadCrashList(); 55 LoadCrashList();
53 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 56 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
54 NewRunnableMethod(this, &CrashUploadList::InformDelegateOfCompletion)); 57 base::Bind(&CrashUploadList::InformDelegateOfCompletion, this));
stuartmorgan 2011/11/21 08:36:16 If you are going to change the style above, you sh
dcheng 2011/11/21 17:15:50 Done.
55 } 58 }
56 59
57 void CrashUploadList::LoadCrashList() { 60 void CrashUploadList::LoadCrashList() {
58 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
59 FilePath crash_dir_path; 62 FilePath crash_dir_path;
60 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dir_path); 63 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dir_path);
61 FilePath upload_log_path = crash_dir_path.AppendASCII("uploads.log"); 64 FilePath upload_log_path = crash_dir_path.AppendASCII("uploads.log");
62 if (file_util::PathExists(upload_log_path)) { 65 if (file_util::PathExists(upload_log_path)) {
63 std::string contents; 66 std::string contents;
64 file_util::ReadFileToString(upload_log_path, &contents); 67 file_util::ReadFileToString(upload_log_path, &contents);
(...skipping 29 matching lines...) Expand all
94 void CrashUploadList::GetUploadedCrashes(unsigned int max_count, 97 void CrashUploadList::GetUploadedCrashes(unsigned int max_count,
95 std::vector<CrashInfo>* crashes) { 98 std::vector<CrashInfo>* crashes) {
96 std::copy(crashes_.begin(), 99 std::copy(crashes_.begin(),
97 crashes_.begin() + std::min<size_t>(crashes_.size(), max_count), 100 crashes_.begin() + std::min<size_t>(crashes_.size(), max_count),
98 std::back_inserter(*crashes)); 101 std::back_inserter(*crashes));
99 } 102 }
100 103
101 std::vector<CrashUploadList::CrashInfo>& CrashUploadList::crashes() { 104 std::vector<CrashUploadList::CrashInfo>& CrashUploadList::crashes() {
102 return crashes_; 105 return crashes_;
103 } 106 }
OLDNEW
« no previous file with comments | « chrome/browser/crash_handler_host_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698