Commit ae76d425 authored by sdefresne's avatar sdefresne Committed by Commit bot

[iOS] Upstream CrashReportBackgroundUploader

CrashReportBackgroundUploader handle uploading crashes in background using
iOS 7 capability of periodically waking up the application in background.

BUG=429756

Review URL: https://codereview.chromium.org/1138703004

Cr-Commit-Position: refs/heads/master@{#329643}
parent 2f8f7b1b
include_rules = [ include_rules = [
"+ios/chrome/grit", "+ios/chrome/grit",
"+breakpad/src/client/ios",
"+components/autofill/core/browser", "+components/autofill/core/browser",
"+components/autofill/ios/browser", "+components/autofill/ios/browser",
"+components/data_reduction_proxy/core/common", "+components/data_reduction_proxy/core/common",
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_CRASH_REPORT_CRASH_REPORT_BACKGROUND_UPLOADER_H_
#define IOS_CHROME_BROWSER_CRASH_REPORT_CRASH_REPORT_BACKGROUND_UPLOADER_H_
#import <UIKit/UIKit.h>
#include "base/ios/block_types.h"
typedef void (^BackgroundFetchCompletionBlock)(UIBackgroundFetchResult);
@interface CrashReportBackgroundUploader : NSObject
+ (instancetype)sharedInstance;
// Handler for the application delegate |performFetchWithCompletionHandler|
// message. Sends the next breakpad report if available.
+ (void)performFetchWithCompletionHandler:
(BackgroundFetchCompletionBlock)completionHandler;
// Handler for the application delegate |handleEventsForBackgroundURLSession|
// message. Retrieves info from the URL Session.
+ (void)handleEventsForBackgroundURLSession:(NSString*)identifier
completionHandler:(ProceduralBlock)completionHandler;
// Returns YES if the session is a breakpad upload session.
+ (BOOL)canHandleBackgroundURLSession:(NSString*)identifier;
// Returns YES if crash reports where uploaded in the background.
+ (BOOL)hasUploadedCrashReportsInBackground;
// Resets the number of crash reports that have been uploaded.
+ (void)resetReportsUploadedInBackgroundCount;
// Flag to determine if there are any pending crash reports on startup. This is
// not an indication that there are pending crash reports at the moment this
// flag is checked.
@property(nonatomic, assign) BOOL hasPendingCrashReportsToUploadAtStartup;
@end
#endif // IOS_CHROME_BROWSER_CRASH_REPORT_CRASH_REPORT_BACKGROUND_UPLOADER_H_
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
'dependencies': [ 'dependencies': [
'../../base/base.gyp:base', '../../base/base.gyp:base',
'../../base/base.gyp:base_prefs', '../../base/base.gyp:base_prefs',
'../../breakpad/breakpad.gyp:breakpad_client',
'../../components/components.gyp:autofill_core_browser', '../../components/components.gyp:autofill_core_browser',
'../../components/components.gyp:autofill_ios_browser', '../../components/components.gyp:autofill_ios_browser',
'../../components/components.gyp:data_reduction_proxy_core_common', '../../components/components.gyp:data_reduction_proxy_core_common',
...@@ -118,6 +119,8 @@ ...@@ -118,6 +119,8 @@
'browser/chrome_switches.h', 'browser/chrome_switches.h',
'browser/chrome_url_constants.cc', 'browser/chrome_url_constants.cc',
'browser/chrome_url_constants.h', 'browser/chrome_url_constants.h',
'browser/crash_report/crash_report_background_uploader.h',
'browser/crash_report/crash_report_background_uploader.mm',
'browser/dom_distiller/distiller_viewer.cc', 'browser/dom_distiller/distiller_viewer.cc',
'browser/dom_distiller/distiller_viewer.h', 'browser/dom_distiller/distiller_viewer.h',
'browser/dom_distiller/dom_distiller_service_factory.cc', 'browser/dom_distiller/dom_distiller_service_factory.cc',
......
...@@ -1063,6 +1063,22 @@ should be able to be added at any place in this file. ...@@ -1063,6 +1063,22 @@ should be able to be added at any place in this file.
<description>Please enter the description of this user action.</description> <description>Please enter the description of this user action.</description>
</action> </action>
<action name="BackgroundUploadReportAborted">
<owner>olivierrobin@chromium.org</owner>
<owner>pkl@chromium.org</owner>
<description>
An attempt to upload a crash report as a background task failed.
</description>
</action>
<action name="BackgroundUploadReportSucceeded">
<owner>olivierrobin@chromium.org</owner>
<owner>pkl@chromium.org</owner>
<description>
An attempt to upload a crash report as a background task succeeeded.
</description>
</action>
<action name="BadMessageTerminate_ACDH"> <action name="BadMessageTerminate_ACDH">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner> <owner>Please list the metric's owners. Add more owner tags as needed.</owner>
<description>Please enter the description of this user action.</description> <description>Please enter the description of this user action.</description>
......
...@@ -4022,6 +4022,24 @@ Therefore, the affected-histogram name has to have at least one dot in it. ...@@ -4022,6 +4022,24 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</summary> </summary>
</histogram> </histogram>
<histogram name="CrashReport.CrashBackgroundUploadDelay" units="ms">
<owner>olivierrobin@chromium.org</owner>
<owner>pkl@chromium.org</owner>
<summary>
Time delta between when the crash took place and when the crash was uploaded
by the app as a background task. Only logged on iOS.
</summary>
</histogram>
<histogram name="CrashReport.PendingReportsOnBackgroundWakeUp">
<owner>olivierrobin@chromium.org</owner>
<owner>pkl@chromium.org</owner>
<summary>
The number of crash reports present when the app wakes up as a background
task to upload crash reports. Only logged on iOS.
</summary>
</histogram>
<histogram name="CrashReport.PermanentUploadFailure" enum="BooleanHit"> <histogram name="CrashReport.PermanentUploadFailure" enum="BooleanHit">
<owner>erikwright@chromium.org</owner> <owner>erikwright@chromium.org</owner>
<summary> <summary>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment