| OLD | NEW |
| 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/render_thread.h" | 5 #include "chrome/renderer/render_thread.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 if (gpu_channel_->state() != GpuChannelHost::kConnected) | 791 if (gpu_channel_->state() != GpuChannelHost::kConnected) |
| 792 return NULL; | 792 return NULL; |
| 793 | 793 |
| 794 return gpu_channel_.get(); | 794 return gpu_channel_.get(); |
| 795 } | 795 } |
| 796 | 796 |
| 797 static void* CreateHistogram( | 797 static void* CreateHistogram( |
| 798 const char *name, int min, int max, size_t buckets) { | 798 const char *name, int min, int max, size_t buckets) { |
| 799 if (min <= 0) | 799 if (min <= 0) |
| 800 min = 1; | 800 min = 1; |
| 801 scoped_refptr<base::Histogram> histogram = base::Histogram::FactoryGet( | 801 base::Histogram* histogram = base::Histogram::FactoryGet( |
| 802 name, min, max, buckets, base::Histogram::kUmaTargetedHistogramFlag); | 802 name, min, max, buckets, base::Histogram::kUmaTargetedHistogramFlag); |
| 803 // We'll end up leaking these histograms, unless there is some code hiding in | 803 return histogram; |
| 804 // there to do the dec-ref. | |
| 805 // TODO(jar): Handle reference counting in webkit glue. | |
| 806 histogram->AddRef(); | |
| 807 return histogram.get(); | |
| 808 } | 804 } |
| 809 | 805 |
| 810 static void AddHistogramSample(void* hist, int sample) { | 806 static void AddHistogramSample(void* hist, int sample) { |
| 811 base::Histogram* histogram = static_cast<base::Histogram*>(hist); | 807 base::Histogram* histogram = static_cast<base::Histogram*>(hist); |
| 812 histogram->Add(sample); | 808 histogram->Add(sample); |
| 813 } | 809 } |
| 814 | 810 |
| 815 void RenderThread::EnsureWebKitInitialized() { | 811 void RenderThread::EnsureWebKitInitialized() { |
| 816 if (webkit_client_.get()) | 812 if (webkit_client_.get()) |
| 817 return; | 813 return; |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 return true; | 1056 return true; |
| 1061 } | 1057 } |
| 1062 | 1058 |
| 1063 return false; | 1059 return false; |
| 1064 } | 1060 } |
| 1065 | 1061 |
| 1066 void RenderThread::RegisterExtension(v8::Extension* extension) { | 1062 void RenderThread::RegisterExtension(v8::Extension* extension) { |
| 1067 WebScriptController::registerExtension(extension); | 1063 WebScriptController::registerExtension(extension); |
| 1068 v8_extensions_.insert(extension->name()); | 1064 v8_extensions_.insert(extension->name()); |
| 1069 } | 1065 } |
| OLD | NEW |