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

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

Issue 462027: Use factory to create histograms, and refcounts to track lifetimes... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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/browser/sync/profile_sync_service.cc ('k') | net/base/connection_type_histograms.cc » ('j') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/render_thread.h" 5 #include "chrome/renderer/render_thread.h"
6 6
7 #include <v8.h> 7 #include <v8.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 void RenderThread::CloseIdleConnections() { 475 void RenderThread::CloseIdleConnections() {
476 Send(new ViewHostMsg_CloseIdleConnections()); 476 Send(new ViewHostMsg_CloseIdleConnections());
477 } 477 }
478 478
479 void RenderThread::SetCacheMode(bool enabled) { 479 void RenderThread::SetCacheMode(bool enabled) {
480 Send(new ViewHostMsg_SetCacheMode(enabled)); 480 Send(new ViewHostMsg_SetCacheMode(enabled));
481 } 481 }
482 482
483 static void* CreateHistogram( 483 static void* CreateHistogram(
484 const char *name, int min, int max, size_t buckets) { 484 const char *name, int min, int max, size_t buckets) {
485 Histogram* histogram = new Histogram(name, min, max, buckets); 485 if (min <= 0)
486 if (histogram) { 486 min = 1;
487 histogram->SetFlags(kUmaTargetedHistogramFlag); 487 scoped_refptr<Histogram> histogram =
488 } 488 Histogram::HistogramFactoryGet(name, min, max, buckets);
489 return histogram; 489 // We verify this was not being destructed by setting a novel "PlannedLeak"
490 // flag and watching out for the flag in the destructor.
491 histogram->SetFlags(kUmaTargetedHistogramFlag | kPlannedLeakFlag);
492 // We'll end up leaking these histograms, unless there is some code hiding in
493 // there to do the dec-ref.
494 histogram->AddRef();
495 return histogram.get();
490 } 496 }
491 497
492 static void AddHistogramSample(void* hist, int sample) { 498 static void AddHistogramSample(void* hist, int sample) {
493 Histogram* histogram = static_cast<Histogram *>(hist); 499 Histogram* histogram = static_cast<Histogram *>(hist);
494 histogram->Add(sample); 500 histogram->Add(sample);
495 } 501 }
496 502
497 void RenderThread::EnsureWebKitInitialized() { 503 void RenderThread::EnsureWebKitInitialized() {
498 if (webkit_client_.get()) 504 if (webkit_client_.get())
499 return; 505 return;
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 spellchecker_->EnableAutoSpellCorrect(auto_spell_correct); 692 spellchecker_->EnableAutoSpellCorrect(auto_spell_correct);
687 } 693 }
688 694
689 void RenderThread::OnSpellCheckWordAdded(const std::string& word) { 695 void RenderThread::OnSpellCheckWordAdded(const std::string& word) {
690 spellchecker_->WordAdded(word); 696 spellchecker_->WordAdded(word);
691 } 697 }
692 698
693 void RenderThread::OnSpellCheckEnableAutoSpellCorrect(bool enable) { 699 void RenderThread::OnSpellCheckEnableAutoSpellCorrect(bool enable) {
694 spellchecker_->EnableAutoSpellCorrect(enable); 700 spellchecker_->EnableAutoSpellCorrect(enable);
695 } 701 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service.cc ('k') | net/base/connection_type_histograms.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698