Coverage for /Syzygy/kasko/reporter.h

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
0.0%0037.C++source

Line-by-line coverage:

   1    :  // Copyright 2014 Google Inc. All Rights Reserved.
   2    :  //
   3    :  // Licensed under the Apache License, Version 2.0 (the "License");
   4    :  // you may not use this file except in compliance with the License.
   5    :  // You may obtain a copy of the License at
   6    :  //
   7    :  //     http://www.apache.org/licenses/LICENSE-2.0
   8    :  //
   9    :  // Unless required by applicable law or agreed to in writing, software
  10    :  // distributed under the License is distributed on an "AS IS" BASIS,
  11    :  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12    :  // See the License for the specific language governing permissions and
  13    :  // limitations under the License.
  14    :  
  15    :  #ifndef SYZYGY_KASKO_REPORTER_H_
  16    :  #define SYZYGY_KASKO_REPORTER_H_
  17    :  
  18    :  #include "base/macros.h"
  19    :  #include "base/files/file_path.h"
  20    :  #include "base/memory/scoped_ptr.h"
  21    :  #include "base/process/process_handle.h"
  22    :  #include "base/strings/string16.h"
  23    :  #include "syzygy/kasko/minidump_type.h"
  24    :  #include "syzygy/kasko/report_repository.h"
  25    :  #include "syzygy/kasko/service_bridge.h"
  26    :  
  27  m :  namespace base {
  28  m :  class TimeDelta;
  29  m :  }  // namespace base
  30    :  
  31  m :  namespace kasko {
  32    :  
  33  m :  class ServiceBridge;
  34  m :  class UploadThread;
  35    :  
  36    :  // Implements the reporter process lifetime. Maintains state, operates a
  37    :  // reporter RPC service, and configures background uploading of reports.
  38    :  //
  39    :  // Reports that exceed upload retry limits will be moved to a permanent failure
  40    :  // destination. The reports consist of two files: a minidump file (extension
  41    :  // kPermanentFailureMinidumpExtension, which is '.dmp') and a crash keys file
  42    :  // (extension kPermanentFailureCrashKeysExtension, which is '.kys'). The two
  43    :  // file names will be identical apart from the extension. The crash keys file
  44    :  // will contain a JSON dictionary mapping crash key names to string values.
  45  m :  class Reporter {
  46  m :   public:
  47    :    // The extension given to crash keys files in the permanent failure directory.
  48  m :    static const base::char16* const kPermanentFailureCrashKeysExtension;
  49    :    // The extension given to minidump files in the permanent failure directory.
  50  m :    static const base::char16* const kPermanentFailureMinidumpExtension;
  51    :    // The parameter name assigned to the uploaded minidump file.
  52  m :    static const base::char16* const kMinidumpUploadFilePart;
  53    :    // The stream type assigned to the protobuf stream in the uploaded minidump
  54    :    // file.
  55  m :    static const uint32_t kProtobufStreamType;
  56    :  
  57    :    // Creates a Reporter process. The process is already running in the
  58    :    // background when this method returns.
  59    :    // @param endpoint_name The RPC endpoint name to listen on.
  60    :    // @param url The URL that crash reports should be uploaded to.
  61    :    // @param data_directory The directory where crash reports will be generated
  62    :    //     and stored for uploading.
  63    :    // @param permanent_failure_directory The directory where crash reports that
  64    :    //     have exceeded retry limits will be moved to.
  65    :    // @param upload_interval The minimum interval between two upload operations.
  66    :    // @param retry_interval The minimum interval between upload attempts for a
  67    :    //     single crash report.
  68    :    // @returns a Reporter instance if successful.
  69  m :    static scoped_ptr<Reporter> Create(
  70  m :        const base::string16& endpoint_name,
  71  m :        const base::string16& url,
  72  m :        const base::FilePath& data_directory,
  73  m :        const base::FilePath& permanent_failure_directory,
  74  m :        const base::TimeDelta& upload_interval,
  75  m :        const base::TimeDelta& retry_interval);
  76    :  
  77  m :    ~Reporter();
  78    :  
  79    :    // Sends a diagnostic report for a specified process with the specified crash
  80    :    // keys.
  81    :    // @param process_handle A handle to the process to report on.
  82    :    // @param minidump_type The type of minidump to be included in the report.
  83    :    // @param crash_keys Crash keys to include in the report.
  84  m :    void SendReportForProcess(
  85  m :        base::ProcessHandle process_handle,
  86  m :        MinidumpType minidump_type,
  87  m :        const std::map<base::string16, base::string16>& crash_keys);
  88    :  
  89    :    // Shuts down and destroys a Reporter process. Blocks until all background
  90    :    // tasks have terminated.
  91    :    // @param instance The Reporter process instance to shut down.
  92  m :    static void Shutdown(scoped_ptr<Reporter> instance);
  93    :  
  94  m :   private:
  95    :    // Instantiates a Reporter process instance. Does not start any background
  96    :    // processes.
  97    :    // @param report_repository The report repository to store reports in.
  98    :    // @param upload_thread An upload thread that is configured to upload reports
  99    :    //     from |report_repository|.
 100    :    // @param endpoint_name The RPC endpoint name to listen on.
 101    :    // @param temporary_minidump_directory A directory where minidumps may be
 102    :    //     temporarily stored before uploading.
 103  m :    Reporter(scoped_ptr<ReportRepository> report_repository,
 104  m :             scoped_ptr<UploadThread> upload_thread,
 105  m :             const base::string16& endpoint_name,
 106  m :             const base::FilePath& temporary_minidump_directory);
 107    :  
 108    :    // A repository for generated reports.
 109  m :    scoped_ptr<ReportRepository> report_repository_;
 110    :  
 111    :    // A background upload scheduler.
 112  m :    scoped_ptr<UploadThread> upload_thread_;
 113    :  
 114    :    // The directory where minidumps will be initially created.
 115  m :    base::FilePath temporary_minidump_directory_;
 116    :  
 117    :    // An RPC service endpoint.
 118  m :    ServiceBridge service_bridge_;
 119    :  
 120  m :    DISALLOW_COPY_AND_ASSIGN(Reporter);
 121  m :  };
 122    :  
 123  m :  }  // namespace kasko
 124    :  
 125    :  #endif  // SYZYGY_KASKO_REPORTER_H_

Coverage information generated Thu Mar 26 16:15:41 2015.