Home | History | Annotate | Download | only in prerender
      1 // Copyright (c) 2013 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 #include "chrome/browser/prerender/prerender_events.h"
      6 
      7 #include "base/basictypes.h"
      8 #include "base/logging.h"
      9 
     10 namespace prerender {
     11 
     12 namespace {
     13 
     14 const char* kEventNames[] = {
     15   "swapin no delegate",
     16   "swapin candidate",
     17   "swapin candidate namespace matches",
     18   "swapin no merge pending",
     19   "swapin merging disabled",
     20   "swapin issuing merge",
     21   "swapin merge for swapin candidate",
     22   "merge result no pending swapin",
     23   "merge result timeout cb",
     24   "merge result result cb",
     25   "merge result timed out",
     26   "merge result merge done",
     27   "merge result result namespace not found",
     28   "merge result result namespace not alias",
     29   "merge result result not logging",
     30   "merge result result no transactions",
     31   "merge result result too many transactions",
     32   "merge result result not mergeable",
     33   "merge result result mergeable",
     34   "merge result merge failed",
     35   "merge result swapping in",
     36   "merge result swapin successful",
     37   "merge result swapin failed",
     38   "Max",
     39 };
     40 
     41 COMPILE_ASSERT(arraysize(kEventNames) == PRERENDER_EVENT_MAX + 1,
     42                PrerenderEvent_name_count_mismatch);
     43 
     44 }  // namespace
     45 
     46 const char* NameFromPrerenderEvent(PrerenderEvent event) {
     47   DCHECK(static_cast<int>(event) >= 0 &&
     48          event <= PRERENDER_EVENT_MAX);
     49   return kEventNames[event];
     50 }
     51 
     52 }  // namespace prerender
     53