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

Side by Side Diff: components/feedback/feedback_data.cc

Issue 2867713005: Use constexpr TaskTraits constructor in feedback_data.cc. (Closed)
Patch Set: Created 3 years, 7 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 | « no previous file | 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 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 "components/feedback/feedback_data.h" 5 #include "components/feedback/feedback_data.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 base::Bind(&FeedbackData::OnGetTraceData, this, trace_id_))) { 58 base::Bind(&FeedbackData::OnGetTraceData, this, trace_id_))) {
59 pending_op_count_--; 59 pending_op_count_--;
60 trace_id_ = 0; 60 trace_id_ = 0;
61 } 61 }
62 } 62 }
63 63
64 if (sys_info) { 64 if (sys_info) {
65 ++pending_op_count_; 65 ++pending_op_count_;
66 AddLogs(std::move(sys_info)); 66 AddLogs(std::move(sys_info));
67 base::PostTaskWithTraitsAndReply( 67 base::PostTaskWithTraitsAndReply(
68 FROM_HERE, 68 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND},
69 base::TaskTraits().MayBlock().WithPriority(
70 base::TaskPriority::BACKGROUND),
71 base::Bind(&FeedbackData::CompressLogs, this), 69 base::Bind(&FeedbackData::CompressLogs, this),
72 base::Bind(&FeedbackData::OnCompressComplete, this)); 70 base::Bind(&FeedbackData::OnCompressComplete, this));
73 } 71 }
74 } 72 }
75 73
76 void FeedbackData::SetAndCompressHistograms( 74 void FeedbackData::SetAndCompressHistograms(
77 std::unique_ptr<std::string> histograms) { 75 std::unique_ptr<std::string> histograms) {
78 DCHECK_CURRENTLY_ON(BrowserThread::UI); 76 DCHECK_CURRENTLY_ON(BrowserThread::UI);
79 77
80 if (!histograms) 78 if (!histograms)
81 return; 79 return;
82 ++pending_op_count_; 80 ++pending_op_count_;
83 base::PostTaskWithTraitsAndReply( 81 base::PostTaskWithTraitsAndReply(
84 FROM_HERE, 82 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND},
85 base::TaskTraits().MayBlock().WithPriority(
86 base::TaskPriority::BACKGROUND),
87 base::Bind(&FeedbackData::CompressFile, this, 83 base::Bind(&FeedbackData::CompressFile, this,
88 base::FilePath(kHistogramsFilename), kHistogramsAttachmentName, 84 base::FilePath(kHistogramsFilename), kHistogramsAttachmentName,
89 base::Passed(&histograms)), 85 base::Passed(&histograms)),
90 base::Bind(&FeedbackData::OnCompressComplete, this)); 86 base::Bind(&FeedbackData::OnCompressComplete, this));
91 } 87 }
92 88
93 void FeedbackData::AttachAndCompressFileData( 89 void FeedbackData::AttachAndCompressFileData(
94 std::unique_ptr<std::string> attached_filedata) { 90 std::unique_ptr<std::string> attached_filedata) {
95 DCHECK_CURRENTLY_ON(BrowserThread::UI); 91 DCHECK_CURRENTLY_ON(BrowserThread::UI);
96 92
97 if (!attached_filedata || attached_filedata->empty()) 93 if (!attached_filedata || attached_filedata->empty())
98 return; 94 return;
99 ++pending_op_count_; 95 ++pending_op_count_;
100 base::FilePath attached_file = 96 base::FilePath attached_file =
101 base::FilePath::FromUTF8Unsafe(attached_filename_); 97 base::FilePath::FromUTF8Unsafe(attached_filename_);
102 base::PostTaskWithTraitsAndReply( 98 base::PostTaskWithTraitsAndReply(
103 FROM_HERE, 99 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND},
104 base::TaskTraits().MayBlock().WithPriority(
105 base::TaskPriority::BACKGROUND),
106 base::Bind(&FeedbackData::CompressFile, this, attached_file, 100 base::Bind(&FeedbackData::CompressFile, this, attached_file,
107 std::string(), base::Passed(&attached_filedata)), 101 std::string(), base::Passed(&attached_filedata)),
108 base::Bind(&FeedbackData::OnCompressComplete, this)); 102 base::Bind(&FeedbackData::OnCompressComplete, this));
109 } 103 }
110 104
111 void FeedbackData::OnGetTraceData( 105 void FeedbackData::OnGetTraceData(
112 int trace_id, 106 int trace_id,
113 scoped_refptr<base::RefCountedString> trace_data) { 107 scoped_refptr<base::RefCountedString> trace_data) {
114 DCHECK_CURRENTLY_ON(BrowserThread::UI); 108 DCHECK_CURRENTLY_ON(BrowserThread::UI);
115 TracingManager* manager = TracingManager::Get(); 109 TracingManager* manager = TracingManager::Get();
(...skipping 23 matching lines...) Expand all
139 133
140 void FeedbackData::SendReport() { 134 void FeedbackData::SendReport() {
141 DCHECK_CURRENTLY_ON(BrowserThread::UI); 135 DCHECK_CURRENTLY_ON(BrowserThread::UI);
142 if (IsDataComplete() && !report_sent_) { 136 if (IsDataComplete() && !report_sent_) {
143 report_sent_ = true; 137 report_sent_ = true;
144 send_report_.Run(this); 138 send_report_.Run(this);
145 } 139 }
146 } 140 }
147 141
148 } // namespace feedback 142 } // namespace feedback
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698