crashpad/client/upload_behavior_ios.h
Ben Hamilton 833219f1ad [ios] Add optional UploadBehavior enum to InProcessHandler::StartProcessingPendingReports()
Previously, StartProcessingPendingReports() only started the prune and
upload threads if it thought the application was actively running in
the foreground.

However, some Crashpad clients would like to replicate Breakpad's
behavior of allowing uploads while the application is starting up
(before it moves to the foreground).

This CL introdues an optional UploadBehavior enum to
InProcessHandler::StartProcessingPendingReports(), defaulting to the
current behavior of only uploading processed crash reports while the
application is in the foreground.

If the enum is set to UploadBehavior::kUploadImmediately, then
InProcessHandler will start the prune and upload threads regardless
of the application state. (If the application state later transitions
to a non-active state, then InProcessHandler will stop the prune and
upload threads as normal.)

Change-Id: I4f13f3a3006d636dd3e511b21ccc23a90b2ea639
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3894230
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Justin Cohen <justincohen@chromium.org>
2022-09-15 20:16:25 +00:00

34 lines
1.1 KiB
C++

// Copyright 2022 The Crashpad Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef CRASHPAD_CLIENT_UPLOAD_BEHAVIOR_IOS_H_
#define CRASHPAD_CLIENT_UPLOAD_BEHAVIOR_IOS_H_
namespace crashpad {
//! \brief Enum to control upload behavior when processing pending reports.
enum class UploadBehavior {
//! \brief Only upload reports while the application is active (e.g., in the
//! foreground).
kUploadWhenAppIsActive = 1,
//! \brief Upload reports immediately, regardless of whether or not the
//! application is active.
kUploadImmediately = 2,
};
} // namespace crashpad
#endif // CRASHPAD_CLIENT_UPLOAD_BEHAVIOR_IOS_H_