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

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

Issue 9065009: Hook up the SequencedWorkerPool to the browser thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 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 | Annotate | Revision Log
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/bind.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 21 matching lines...) Expand all
32 #else 32 #else
33 return new CrashUploadList(delegate); 33 return new CrashUploadList(delegate);
34 #endif 34 #endif
35 } 35 }
36 36
37 CrashUploadList::CrashUploadList(Delegate* delegate) : delegate_(delegate) {} 37 CrashUploadList::CrashUploadList(Delegate* delegate) : delegate_(delegate) {}
38 38
39 CrashUploadList::~CrashUploadList() {} 39 CrashUploadList::~CrashUploadList() {}
40 40
41 void CrashUploadList::LoadCrashListAsynchronously() { 41 void CrashUploadList::LoadCrashListAsynchronously() {
42 BrowserThread::PostTask( 42 BrowserThread::PostBlockingPoolTask(
43 BrowserThread::FILE,
44 FROM_HERE, 43 FROM_HERE,
45 base::Bind(&CrashUploadList::LoadCrashListAndInformDelegateOfCompletion, 44 base::Bind(&CrashUploadList::LoadCrashListAndInformDelegateOfCompletion,
46 this)); 45 this));
47 } 46 }
48 47
49 void CrashUploadList::ClearDelegate() { 48 void CrashUploadList::ClearDelegate() {
50 delegate_ = NULL; 49 delegate_ = NULL;
51 } 50 }
52 51
53 52
54 void CrashUploadList::LoadCrashListAndInformDelegateOfCompletion() { 53 void CrashUploadList::LoadCrashListAndInformDelegateOfCompletion() {
55 LoadCrashList(); 54 LoadCrashList();
56 BrowserThread::PostTask( 55 BrowserThread::PostTask(
57 BrowserThread::UI, 56 BrowserThread::UI,
58 FROM_HERE, 57 FROM_HERE,
59 base::Bind(&CrashUploadList::InformDelegateOfCompletion, this)); 58 base::Bind(&CrashUploadList::InformDelegateOfCompletion, this));
60 } 59 }
61 60
62 void CrashUploadList::LoadCrashList() { 61 void CrashUploadList::LoadCrashList() {
63 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
64 FilePath crash_dir_path; 62 FilePath crash_dir_path;
65 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dir_path); 63 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dir_path);
66 FilePath upload_log_path = crash_dir_path.AppendASCII("uploads.log"); 64 FilePath upload_log_path = crash_dir_path.AppendASCII("uploads.log");
67 if (file_util::PathExists(upload_log_path)) { 65 if (file_util::PathExists(upload_log_path)) {
68 std::string contents; 66 std::string contents;
69 file_util::ReadFileToString(upload_log_path, &contents); 67 file_util::ReadFileToString(upload_log_path, &contents);
70 std::vector<std::string> log_entries; 68 std::vector<std::string> log_entries;
71 base::SplitStringAlongWhitespace(contents, &log_entries); 69 base::SplitStringAlongWhitespace(contents, &log_entries);
72 ParseLogEntries(log_entries); 70 ParseLogEntries(log_entries);
73 } 71 }
(...skipping 25 matching lines...) Expand all
99 void CrashUploadList::GetUploadedCrashes(unsigned int max_count, 97 void CrashUploadList::GetUploadedCrashes(unsigned int max_count,
100 std::vector<CrashInfo>* crashes) { 98 std::vector<CrashInfo>* crashes) {
101 std::copy(crashes_.begin(), 99 std::copy(crashes_.begin(),
102 crashes_.begin() + std::min<size_t>(crashes_.size(), max_count), 100 crashes_.begin() + std::min<size_t>(crashes_.size(), max_count),
103 std::back_inserter(*crashes)); 101 std::back_inserter(*crashes));
104 } 102 }
105 103
106 std::vector<CrashUploadList::CrashInfo>& CrashUploadList::crashes() { 104 std::vector<CrashUploadList::CrashInfo>& CrashUploadList::crashes() {
107 return crashes_; 105 return crashes_;
108 } 106 }
OLDNEW
« no previous file with comments | « base/threading/sequenced_worker_pool.cc ('k') | chrome/browser/visitedlink/visitedlink_master.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698