| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |