Home | History | Annotate | Download | only in appcache
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_HISTOGRAMS_H_
      6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_HISTOGRAMS_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "content/browser/appcache/appcache_update_job.h"
     10 
     11 namespace base {
     12 class TimeDelta;
     13 }
     14 
     15 namespace content {
     16 
     17 class AppCacheHistograms {
     18  public:
     19   enum InitResultType {
     20     INIT_OK, SQL_DATABASE_ERROR, DISK_CACHE_ERROR,
     21     NUM_INIT_RESULT_TYPES
     22   };
     23   static void CountInitResult(InitResultType init_result);
     24   static void CountReinitAttempt(bool repeated_attempt);
     25   static void CountCorruptionDetected();
     26   static void CountUpdateJobResult(AppCacheUpdateJob::ResultType result,
     27                                    const GURL& origin_url);
     28   enum CheckResponseResultType {
     29     RESPONSE_OK, MANIFEST_OUT_OF_DATE, RESPONSE_OUT_OF_DATE, ENTRY_NOT_FOUND,
     30     READ_HEADERS_ERROR, READ_DATA_ERROR, UNEXPECTED_DATA_SIZE, CHECK_CANCELED,
     31     NUM_CHECK_RESPONSE_RESULT_TYPES
     32   };
     33   static void CountCheckResponseResult(CheckResponseResultType result);
     34   static void CountResponseRetrieval(
     35       bool success, bool is_main_resource, const GURL& origin_url);
     36   static void LogUpdateFailureStats(
     37       const GURL& origin_url,
     38       int percent_complete,
     39       bool was_making_progress,
     40       bool off_origin_resource_failure);
     41   static void AddTaskQueueTimeSample(const base::TimeDelta& duration);
     42   static void AddTaskRunTimeSample(const base::TimeDelta& duration);
     43   static void AddCompletionQueueTimeSample(const base::TimeDelta& duration);
     44   static void AddCompletionRunTimeSample(const base::TimeDelta& duration);
     45   static void AddNetworkJobStartDelaySample(const base::TimeDelta& duration);
     46   static void AddErrorJobStartDelaySample(const base::TimeDelta& duration);
     47   static void AddAppCacheJobStartDelaySample(const base::TimeDelta& duration);
     48   static void AddMissingManifestEntrySample();
     49 
     50   enum MissingManifestCallsiteType {
     51     CALLSITE_0, CALLSITE_1, CALLSITE_2, CALLSITE_3,
     52     NUM_MISSING_MANIFEST_CALLSITE_TYPES
     53   };
     54   static void AddMissingManifestDetectedAtCallsite(
     55       MissingManifestCallsiteType type);
     56 
     57  private:
     58   DISALLOW_IMPLICIT_CONSTRUCTORS(AppCacheHistograms);
     59 };
     60 
     61 }  // namespace content
     62 
     63 #endif  // CONTENT_BROWSER_APPCACHE_APPCACHE_HISTOGRAMS_H_
     64