Skip to content

Commit beded4d

Browse files
thomasgalesRebase bot
authored andcommitted
[forensics] Delete CrashReporter::File
fuchsia.feedback/CrashReporter::File was marked removed in F12. F12 is no longer supported so this function can be deleted. Fixed: b/42073371 Test: `fx test //src/developer/forensics` Test: `fx shell crasher` @ daf95b989056649b Change-Id: Iaa3a705c0199e3be28eb9aea57e6dffdca67454f Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/968113 Reviewed-by: Christopher Johnson <crjohns@google.com> Reviewed-by: Alex Pankhurst <pankhurst@google.com> Reviewed-by: Chris Suter <csuter@google.com> Reviewed-by: James Sullivan <jfsulliv@google.com> API-Review: Chris Suter <csuter@google.com> Reviewed-by: Étienne J. Membrives <etiennej@google.com> Commit-Queue: Thomas Gales <tgales@google.com>
1 parent 2a36076 commit beded4d

File tree

15 files changed

+1
-168
lines changed

15 files changed

+1
-168
lines changed

sdk/fidl/fuchsia.feedback/crash_reporter.fidl

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,6 @@ using zx;
99
/// Provides the ability to file crash reports.
1010
@discoverable
1111
closed protocol CrashReporter {
12-
/// Files a crash `report`.
13-
///
14-
/// This could mean generating a crash report in a local crash report database or uploading the
15-
/// crash report to a remote crash server depending on the FIDL server's configuration.
16-
///
17-
/// # Deprecation
18-
///
19-
/// This method returns an immediate acknowledgement that the request was
20-
/// received. In practice this acknowledgement isn't used and only returns
21-
/// an error if the program name is blank. By F12, FileReport should be
22-
/// used instead. FileReport will provide a useful status once the report
23-
/// has been successfully or unsuccessfully filed.
24-
// TODO(https://fxbug.dev/122422): delete File once F12 is out of support window.
25-
@available(deprecated=11, removed=12, legacy=true, note="use FileReport")
26-
strict File(resource struct {
27-
report CrashReport;
28-
}) -> () error zx.Status;
29-
3012
/// Files a crash `report` and gives the final result of the operation.
3113
///
3214
/// This could mean generating a crash report in a local crash report
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"fidl/fuchsia.feedback": "83c2d9fdd458d45f3c04d35ef2b2fe48"
2+
"fidl/fuchsia.feedback": "a7f935274ba8eb263147ea661b3727a9"
33
}

src/developer/forensics/crash_reports/crash_reporter.cc

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -154,22 +154,6 @@ void CrashReporter::PersistAllCrashReports() {
154154
snapshot_collector_.Shutdown();
155155
}
156156

157-
void CrashReporter::File(fuchsia::feedback::CrashReport report, FileCallback callback) {
158-
if (!report.has_program_name()) {
159-
FX_LOGS(ERROR) << "Input report missing required program name. Won't file.";
160-
callback(::fpromise::error(ZX_ERR_INVALID_ARGS));
161-
info_.LogCrashState(cobalt::CrashState::kDropped);
162-
return;
163-
}
164-
165-
// Execute the callback informing the client the report has been filed. The rest of the async flow
166-
// can take quite some time and blocking clients would defeat the purpose of sharing the snapshot.
167-
callback(::fpromise::ok());
168-
169-
File(std::move(report), /*is_hourly_snapshot=*/false,
170-
[](const CrashReporter_FileReport_Result& result) {});
171-
}
172-
173157
void CrashReporter::FileReport(fuchsia::feedback::CrashReport report, FileReportCallback callback) {
174158
if (!report.has_program_name()) {
175159
FX_LOGS(ERROR) << "Input report missing required program name. Won't file.";

src/developer/forensics/crash_reports/crash_reporter.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ class CrashReporter : public fuchsia::feedback::CrashReporter {
5252
// reports.
5353
void PersistAllCrashReports();
5454

55-
// |fuchsia::feedback::CrashReporter|
56-
void File(fuchsia::feedback::CrashReport report, FileCallback callback) override;
57-
5855
// |fuchsia::feedback::CrashReporter|
5956
void FileReport(fuchsia::feedback::CrashReport report, FileReportCallback callback) override;
6057

src/developer/forensics/crash_reports/tests/crash_reporter_unittest.cc

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -465,30 +465,6 @@ TEST_F(CrashReporterTest, Succeed_OnInputCrashReport) {
465465
CheckAttachmentsOnServer({kDefaultAttachmentBundleKey});
466466
}
467467

468-
// TODO(https://fxbug.dev/117123): delete when CrashReporter::File is removed.
469-
TEST_F(CrashReporterTest, Succeed_OnInputCrashReport_OldFile) {
470-
SetUpDataProviderServer(
471-
std::make_unique<stubs::DataProvider>(kFeedbackAnnotations, kDefaultAttachmentBundleKey));
472-
SetUpCrashReporterDefaultConfig({kUploadSuccessful});
473-
474-
CrashReport report;
475-
report.set_program_name(kProgramName);
476-
477-
// Run loop to start the clock.
478-
RunLoopUntilIdle();
479-
std::optional<::fpromise::result<void, zx_status_t>> out_result{std::nullopt};
480-
crash_reporter_->File(std::move(report),
481-
[&out_result](::fpromise::result<void, zx_status_t> result) {
482-
out_result = std::move(result);
483-
});
484-
RunLoopFor(kSnapshotSharedRequestWindow);
485-
FX_CHECK(out_result.has_value());
486-
ASSERT_TRUE(out_result->is_ok());
487-
488-
CheckAnnotationsOnServer();
489-
CheckAttachmentsOnServer({kDefaultAttachmentBundleKey});
490-
}
491-
492468
TEST_F(CrashReporterTest, EnforcesQuota) {
493469
SetUpDataProviderServer(
494470
std::make_unique<stubs::DataProvider>(kFeedbackAnnotations, kDefaultAttachmentBundleKey));
@@ -722,24 +698,6 @@ TEST_F(CrashReporterTest, Fail_OnInvalidInputCrashReport) {
722698
EXPECT_EQ(result.err(), FilingError::INVALID_ARGS_ERROR);
723699
}
724700

725-
// TODO(https://fxbug.dev/117123): delete when CrashReporter::File is removed.
726-
TEST_F(CrashReporterTest, Fail_OnInvalidInputCrashReport_OldFile) {
727-
SetUpDataProviderServer(std::make_unique<stubs::DataProviderReturnsEmptySnapshot>());
728-
SetUpCrashReporterDefaultConfig();
729-
730-
// Run loop to start the clock.
731-
RunLoopUntilIdle();
732-
CrashReport report;
733-
std::optional<::fpromise::result<void, zx_status_t>> out_result{std::nullopt};
734-
crash_reporter_->File(std::move(report),
735-
[&out_result](::fpromise::result<void, zx_status_t> result) {
736-
out_result = std::move(result);
737-
});
738-
RunLoopFor(kSnapshotSharedRequestWindow);
739-
ASSERT_TRUE(out_result.has_value());
740-
EXPECT_TRUE(out_result->is_error());
741-
}
742-
743701
TEST_F(CrashReporterTest, Succeed_OnInputCrashReportWithIsFatalTrue) {
744702
SetUpDataProviderServer(
745703
std::make_unique<stubs::DataProvider>(kFeedbackAnnotations, kDefaultAttachmentBundleKey));

src/developer/forensics/exceptions/tests/crash_reporter_unittest.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,6 @@ constexpr zx::duration kDefaultTimeout{zx::duration::infinite()};
4545

4646
class StubCrashReporter : public fuchsia::feedback::CrashReporter {
4747
public:
48-
void File(fuchsia::feedback::CrashReport report, FileCallback callback) override {
49-
reports_.push_back(std::move(report));
50-
51-
fuchsia::feedback::CrashReporter_File_Result result;
52-
result.set_response({});
53-
callback(std::move(result));
54-
}
55-
5648
void FileReport(fuchsia::feedback::CrashReport report, FileReportCallback callback) override {
5749
reports_.push_back(std::move(report));
5850

src/developer/forensics/public/fakes/crash_reporter.cc

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,6 @@ namespace fakes {
1717

1818
using namespace fuchsia::feedback;
1919

20-
void CrashReporter::File(CrashReport report, FileCallback callback) {
21-
if (!report.has_program_name()) {
22-
callback(CrashReporter_File_Result::WithErr(ZX_ERR_INVALID_ARGS));
23-
} else {
24-
callback(CrashReporter_File_Result::WithResponse(CrashReporter_File_Response()));
25-
}
26-
27-
++num_crash_reports_filed_;
28-
if (querier_) {
29-
querier_->UpdateAndNotify(num_crash_reports_filed_);
30-
}
31-
}
32-
3320
void CrashReporter::FileReport(CrashReport report, FileReportCallback callback) {
3421
if (!report.has_program_name()) {
3522
callback(fpromise::error(FilingError::INVALID_ARGS_ERROR));

src/developer/forensics/public/fakes/crash_reporter.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ class CrashReporter : public fuchsia::feedback::CrashReporter {
2424
fidl::InterfaceRequest<fuchsia::feedback::testing::FakeCrashReporterQuerier> request);
2525
void ResetQuerier();
2626

27-
// |fuchsia::feedback::CrashReporter|
28-
void File(fuchsia::feedback::CrashReport report, FileCallback callback) override;
29-
3027
// |fuchsia::feedback::CrashReporter|
3128
void FileReport(fuchsia::feedback::CrashReport report, FileReportCallback callback) override;
3229

src/developer/forensics/testing/stubs/crash_reporter.cc

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,6 @@ CrashReporter::~CrashReporter() {
5454
<< ErrorMessage("is fatal", ToString(is_fatal_), ToString(expectations_.is_fatal));
5555
}
5656

57-
void CrashReporter::File(fuchsia::feedback::CrashReport report, FileCallback callback) {
58-
FileReport(std::move(report),
59-
[callback = std::move(callback)](
60-
const fuchsia::feedback::CrashReporter_FileReport_Result& result) {
61-
if (result.is_err()) {
62-
callback(fpromise::error(ZX_ERR_INTERNAL));
63-
} else {
64-
callback(fpromise::ok());
65-
}
66-
});
67-
}
68-
6957
void CrashReporter::FileReport(fuchsia::feedback::CrashReport report, FileReportCallback callback) {
7058
FX_CHECK(report.has_crash_signature());
7159
FX_CHECK(report.has_attachments());
@@ -98,21 +86,11 @@ void CrashReporter::FileReport(fuchsia::feedback::CrashReport report, FileReport
9886
callback(fpromise::ok(std::move(results)));
9987
}
10088

101-
void CrashReporterAlwaysReturnsError::File(fuchsia::feedback::CrashReport report,
102-
FileCallback callback) {
103-
callback(::fpromise::error(ZX_ERR_INTERNAL));
104-
}
105-
10689
void CrashReporterAlwaysReturnsError::FileReport(fuchsia::feedback::CrashReport report,
10790
FileReportCallback callback) {
10891
callback(::fpromise::error(fuchsia::feedback::FilingError::INVALID_ARGS_ERROR));
10992
}
11093

111-
void CrashReporterNoFileExpected::File(fuchsia::feedback::CrashReport report,
112-
FileCallback callback) {
113-
FX_CHECK(false) << "No call to File() expected";
114-
}
115-
11694
void CrashReporterNoFileExpected::FileReport(fuchsia::feedback::CrashReport report,
11795
FileReportCallback callback) {
11896
FX_CHECK(false) << "No call to FileReport() expected";

src/developer/forensics/testing/stubs/crash_reporter.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ class CrashReporter : public CrashReporterBase {
3131

3232
~CrashReporter();
3333

34-
// |fuchsia::feedback::CrashReporter|
35-
void File(fuchsia::feedback::CrashReport report, FileCallback callback) override;
36-
3734
// |fuchsia::feedback::CrashReporter|
3835
void FileReport(fuchsia::feedback::CrashReport report, FileReportCallback callback) override;
3936

@@ -48,27 +45,18 @@ class CrashReporter : public CrashReporterBase {
4845

4946
class CrashReporterClosesConnection : public CrashReporterBase {
5047
public:
51-
// |fuchsia::feedback::CrashReporter|
52-
STUB_METHOD_CLOSES_CONNECTION(File, fuchsia::feedback::CrashReport, FileCallback)
53-
5448
// |fuchsia::feedback::CrashReporter|
5549
STUB_METHOD_CLOSES_CONNECTION(FileReport, fuchsia::feedback::CrashReport, FileReportCallback)
5650
};
5751

5852
class CrashReporterAlwaysReturnsError : public CrashReporterBase {
5953
public:
60-
// |fuchsia::feedback::CrashReporter|
61-
void File(fuchsia::feedback::CrashReport report, FileCallback callback) override;
62-
6354
// |fuchsia::feedback::CrashReporter|
6455
void FileReport(fuchsia::feedback::CrashReport report, FileReportCallback callback) override;
6556
};
6657

6758
class CrashReporterNoFileExpected : public CrashReporterBase {
6859
public:
69-
// |fuchsia::feedback::CrashReporter|
70-
void File(fuchsia::feedback::CrashReport report, FileCallback callback) override;
71-
7260
// |fuchsia::feedback::CrashReporter|
7361
void FileReport(fuchsia::feedback::CrashReport report, FileReportCallback callback) override;
7462
};

0 commit comments

Comments
 (0)