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

Side by Side Diff: chrome/renderer/renderer_histogram_snapshots.cc

Issue 8523037: base::Bind migrations in chrome/renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/renderer_histogram_snapshots.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/renderer/renderer_histogram_snapshots.h" 5 #include "chrome/renderer/renderer_histogram_snapshots.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 8
9 #include "base/bind.h"
9 #include "base/logging.h" 10 #include "base/logging.h"
10 #include "base/message_loop.h" 11 #include "base/message_loop.h"
11 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
12 #include "chrome/common/render_messages.h" 13 #include "chrome/common/render_messages.h"
13 #include "content/public/renderer/render_thread.h" 14 #include "content/public/renderer/render_thread.h"
14 15
15 // TODO(raman): Before renderer shuts down send final snapshot lists. 16 // TODO(raman): Before renderer shuts down send final snapshot lists.
16 17
17 using base::Histogram; 18 using base::Histogram;
18 using base::StatisticsRecorder; 19 using base::StatisticsRecorder;
19 using content::RenderThread; 20 using content::RenderThread;
20 21
21 RendererHistogramSnapshots::RendererHistogramSnapshots() 22 RendererHistogramSnapshots::RendererHistogramSnapshots()
22 : ALLOW_THIS_IN_INITIALIZER_LIST( 23 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
23 renderer_histogram_snapshots_factory_(this)) {
24 } 24 }
25 25
26 RendererHistogramSnapshots::~RendererHistogramSnapshots() { 26 RendererHistogramSnapshots::~RendererHistogramSnapshots() {
27 } 27 }
28 28
29 // Send data quickly! 29 // Send data quickly!
30 void RendererHistogramSnapshots::SendHistograms(int sequence_number) { 30 void RendererHistogramSnapshots::SendHistograms(int sequence_number) {
31 RenderThread::Get()->GetMessageLoop()->PostTask(FROM_HERE, 31 RenderThread::Get()->GetMessageLoop()->PostTask(
32 renderer_histogram_snapshots_factory_.NewRunnableMethod( 32 FROM_HERE, base::Bind(&RendererHistogramSnapshots::UploadAllHistrograms,
33 &RendererHistogramSnapshots::UploadAllHistrograms, sequence_number)); 33 weak_factory_.GetWeakPtr(), sequence_number));
34 } 34 }
35 35
36 bool RendererHistogramSnapshots::OnControlMessageReceived( 36 bool RendererHistogramSnapshots::OnControlMessageReceived(
37 const IPC::Message& message) { 37 const IPC::Message& message) {
38 bool handled = true; 38 bool handled = true;
39 IPC_BEGIN_MESSAGE_MAP(RendererHistogramSnapshots, message) 39 IPC_BEGIN_MESSAGE_MAP(RendererHistogramSnapshots, message)
40 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetRendererHistograms, 40 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetRendererHistograms,
41 OnGetRendererHistograms) 41 OnGetRendererHistograms)
42 IPC_MESSAGE_UNHANDLED(handled = false) 42 IPC_MESSAGE_UNHANDLED(handled = false)
43 IPC_END_MESSAGE_MAP() 43 IPC_END_MESSAGE_MAP()
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 void RendererHistogramSnapshots::UniqueInconsistencyDetected(int problem) { 83 void RendererHistogramSnapshots::UniqueInconsistencyDetected(int problem) {
84 UMA_HISTOGRAM_ENUMERATION("Histogram.InconsistenciesRendererUnique", 84 UMA_HISTOGRAM_ENUMERATION("Histogram.InconsistenciesRendererUnique",
85 problem, Histogram::NEVER_EXCEEDED_VALUE); 85 problem, Histogram::NEVER_EXCEEDED_VALUE);
86 } 86 }
87 87
88 void RendererHistogramSnapshots::SnapshotProblemResolved(int amount) { 88 void RendererHistogramSnapshots::SnapshotProblemResolved(int amount) {
89 UMA_HISTOGRAM_COUNTS("Histogram.InconsistentSnapshotRenderer", 89 UMA_HISTOGRAM_COUNTS("Histogram.InconsistentSnapshotRenderer",
90 std::abs(amount)); 90 std::abs(amount));
91 } 91 }
92 92
OLDNEW
« no previous file with comments | « chrome/renderer/renderer_histogram_snapshots.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698