Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: chrome/browser/prerender/prerender_link_manager.cc

Issue 2886933003: Use stricter type checking in UMA_HISTOGRAM_ENUMERATION (Closed)
Patch Set: simplify type checking Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/prerender/prerender_link_manager.h" 5 #include "chrome/browser/prerender/prerender_link_manager.h"
6 6
7 #include <functional> 7 #include <functional>
8 #include <limits> 8 #include <limits>
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 enum RelTypeHistogramEnum { 67 enum RelTypeHistogramEnum {
68 RelTypeHistogramEnumNone = 0, 68 RelTypeHistogramEnumNone = 0,
69 RelTypeHistogramEnumPrerender = PrerenderRelTypePrerender, 69 RelTypeHistogramEnumPrerender = PrerenderRelTypePrerender,
70 RelTypeHistogramEnumNext = PrerenderRelTypeNext, 70 RelTypeHistogramEnumNext = PrerenderRelTypeNext,
71 RelTypeHistogramEnumPrerenderAndNext = 71 RelTypeHistogramEnumPrerenderAndNext =
72 PrerenderRelTypePrerender | PrerenderRelTypeNext, 72 PrerenderRelTypePrerender | PrerenderRelTypeNext,
73 RelTypeHistogramEnumMax, 73 RelTypeHistogramEnumMax,
74 }; 74 };
75 75
76 void RecordLinkManagerAdded(const uint32_t rel_types) { 76 void RecordLinkManagerAdded(const uint32_t rel_types) {
77 const uint32_t enum_value = rel_types & (RelTypeHistogramEnumMax - 1); 77 const RelTypeHistogramEnum enum_value = static_cast<RelTypeHistogramEnum>(
78 rel_types & (RelTypeHistogramEnumMax - 1));
78 UMA_HISTOGRAM_ENUMERATION("Prerender.RelTypesLinkAdded", enum_value, 79 UMA_HISTOGRAM_ENUMERATION("Prerender.RelTypesLinkAdded", enum_value,
79 RelTypeHistogramEnumMax); 80 RelTypeHistogramEnumMax);
80 } 81 }
81 82
82 void RecordLinkManagerStarting(const uint32_t rel_types) { 83 void RecordLinkManagerStarting(const uint32_t rel_types) {
83 const uint32_t enum_value = rel_types & (RelTypeHistogramEnumMax - 1); 84 const RelTypeHistogramEnum enum_value = static_cast<RelTypeHistogramEnum>(
85 rel_types & (RelTypeHistogramEnumMax - 1));
84 UMA_HISTOGRAM_ENUMERATION("Prerender.RelTypesLinkStarted", enum_value, 86 UMA_HISTOGRAM_ENUMERATION("Prerender.RelTypesLinkStarted", enum_value,
85 RelTypeHistogramEnumMax); 87 RelTypeHistogramEnumMax);
86 } 88 }
87 89
88 void Send(int child_id, IPC::Message* raw_message) { 90 void Send(int child_id, IPC::Message* raw_message) {
89 using content::RenderProcessHost; 91 using content::RenderProcessHost;
90 std::unique_ptr<IPC::Message> own_message(raw_message); 92 std::unique_ptr<IPC::Message> own_message(raw_message);
91 93
92 RenderProcessHost* render_process_host = RenderProcessHost::FromID(child_id); 94 RenderProcessHost* render_process_host = RenderProcessHost::FromID(child_id);
93 if (!render_process_host) 95 if (!render_process_host)
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 Send(prerender->launcher_child_id, 532 Send(prerender->launcher_child_id,
531 new PrerenderMsg_OnPrerenderStop(prerender->prerender_id)); 533 new PrerenderMsg_OnPrerenderStop(prerender->prerender_id));
532 RemovePrerender(prerender); 534 RemovePrerender(prerender);
533 StartPrerenders(); 535 StartPrerenders();
534 } 536 }
535 537
536 void PrerenderLinkManager::OnPrerenderNetworkBytesChanged( 538 void PrerenderLinkManager::OnPrerenderNetworkBytesChanged(
537 PrerenderHandle* prerender_handle) {} 539 PrerenderHandle* prerender_handle) {}
538 540
539 } // namespace prerender 541 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud/cloud_policy_invalidator.cc ('k') | chrome/browser/ui/toolbar/app_menu_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698