toolkit/crashreporter/google-breakpad/src/client/ios/BreakpadController.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 // Copyright (c) 2012, Google Inc.
     2 // All rights reserved.
     3 //
     4 // Redistribution and use in source and binary forms, with or without
     5 // modification, are permitted provided that the following conditions are
     6 // met:
     7 //
     8 //     * Redistributions of source code must retain the above copyright
     9 // notice, this list of conditions and the following disclaimer.
    10 //     * Redistributions in binary form must reproduce the above
    11 // copyright notice, this list of conditions and the following disclaimer
    12 // in the documentation and/or other materials provided with the
    13 // distribution.
    14 //     * Neither the name of Google Inc. nor the names of its
    15 // contributors may be used to endorse or promote products derived from
    16 // this software without specific prior written permission.
    17 //
    18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    30 #ifndef CLIENT_IOS_HANDLER_IOS_BREAKPAD_CONTROLLER_H_
    31 #define CLIENT_IOS_HANDLER_IOS_BREAKPAD_CONTROLLER_H_
    33 #import <Foundation/Foundation.h>
    35 #import "client/ios/Breakpad.h"
    37 // This class is used to offer a higher level API around BreakpadRef. It
    38 // configures it, ensures thread-safety, and sends crash reports back to the
    39 // collecting server. By default, no crash reports are sent, the user must call
    40 // |setUploadingEnabled:YES| to start the uploading.
    41 @interface BreakpadController : NSObject {
    42  @private
    43   // The dispatch queue that will own the breakpad reference.
    44   dispatch_queue_t queue_;
    46   // Instance of Breakpad crash reporter. This is owned by the queue, but can
    47   // be created on the main thread at startup.
    48   BreakpadRef breakpadRef_;
    50   // The dictionary that contains configuration for breakpad. Modifying it
    51   // should only happen when the controller is not started. The initial value
    52   // is the infoDictionary of the bundle of the application.
    53   NSMutableDictionary* configuration_;
    55   // Whether or not crash reports should be uploaded.
    56   BOOL enableUploads_;
    58   // Whether the controller has been started on the main thread. This is only
    59   // used to assert the initialization order is correct.
    60   BOOL started_;
    62   // The interval to wait between two uploads. Value is 0 if no upload must be
    63   // done.
    64   int uploadIntervalInSeconds_;
    65 }
    67 // Singleton.
    68 + (BreakpadController*)sharedInstance;
    70 // Update the controller configuration. Merges its old configuration with the
    71 // new one. Merge is done by replacing the old values by the new values.
    72 - (void)updateConfiguration:(NSDictionary*)configuration;
    74 // Configure the URL to upload the report to. This must be called at least once
    75 // if the URL is not in the bundle information.
    76 - (void)setUploadingURL:(NSString*)url;
    78 // Set the minimal interval between two uploads in seconds. This must be called
    79 // at least once if the interval is not in the bundle information. A value of 0
    80 // will prevent uploads.
    81 - (void)setUploadInterval:(int)intervalInSeconds;
    83 // Specify a parameter that will be uploaded to the crash server. See
    84 // |BreakpadAddUploadParameter|.
    85 - (void)addUploadParameter:(NSString*)value forKey:(NSString*)key;
    87 // Remove a previously-added parameter from the upload parameter set. See
    88 // |BreakpadRemoveUploadParameter|.
    89 - (void)removeUploadParameterForKey:(NSString*)key;
    91 // Access the underlying BreakpadRef. This method is asynchronous, and will be
    92 // executed on the thread owning the BreakpadRef variable. Moreover, if the
    93 // controller is not started, the block will be called with a NULL parameter.
    94 - (void)withBreakpadRef:(void(^)(BreakpadRef))callback;
    96 // Starts the BreakpadController by registering crash handlers. If
    97 // |onCurrentThread| is YES, all setup is done on the current thread, otherwise
    98 // it is done on a private queue.
    99 - (void)start:(BOOL)onCurrentThread;
   101 // Unregisters the crash handlers.
   102 - (void)stop;
   104 // Enables or disables uploading of crash reports, but does not stop the
   105 // BreakpadController.
   106 - (void)setUploadingEnabled:(BOOL)enabled;
   108 // Check if there is currently a crash report to upload.
   109 - (void)hasReportToUpload:(void(^)(BOOL))callback;
   111 @end
   113 #endif  // CLIENT_IOS_HANDLER_IOS_BREAKPAD_CONTROLLER_H_

mercurial