OLD | NEW |
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 "content/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 : public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { | 199 : public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { |
200 public: | 200 public: |
201 GpuVDAContextLostCallback() {} | 201 GpuVDAContextLostCallback() {} |
202 virtual ~GpuVDAContextLostCallback() {} | 202 virtual ~GpuVDAContextLostCallback() {} |
203 virtual void onContextLost() { | 203 virtual void onContextLost() { |
204 ChildThread::current()->message_loop()->PostTask(FROM_HERE, base::Bind( | 204 ChildThread::current()->message_loop()->PostTask(FROM_HERE, base::Bind( |
205 &RenderThreadImpl::OnGpuVDAContextLoss)); | 205 &RenderThreadImpl::OnGpuVDAContextLoss)); |
206 } | 206 } |
207 }; | 207 }; |
208 | 208 |
209 RenderThreadImpl::HistogramCustomizer::HistogramCustomizer() { | 209 RenderThreadImpl::HistogramCustomizer::HistogramCustomizer() |
| 210 : memory_renderer_used_(NULL) { |
| 211 custom_histograms_.insert("Memory.RendererUsed"); |
210 custom_histograms_.insert("V8.MemoryExternalFragmentationTotal"); | 212 custom_histograms_.insert("V8.MemoryExternalFragmentationTotal"); |
211 custom_histograms_.insert("V8.MemoryHeapSampleTotalCommitted"); | 213 custom_histograms_.insert("V8.MemoryHeapSampleTotalCommitted"); |
212 custom_histograms_.insert("V8.MemoryHeapSampleTotalUsed"); | 214 custom_histograms_.insert("V8.MemoryHeapSampleTotalUsed"); |
213 } | 215 } |
214 | 216 |
215 RenderThreadImpl::HistogramCustomizer::~HistogramCustomizer() {} | 217 RenderThreadImpl::HistogramCustomizer::~HistogramCustomizer() {} |
216 | 218 |
217 void RenderThreadImpl::HistogramCustomizer::RenderViewNavigatedToHost( | 219 void RenderThreadImpl::HistogramCustomizer::RenderViewNavigatedToHost( |
218 const std::string& host, size_t view_count) { | 220 const std::string& host, size_t view_count) { |
219 if (CommandLine::ForCurrentProcess()->HasSwitch( | 221 if (CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 19 matching lines...) Expand all Loading... |
239 name += common_host_histogram_suffix_; | 241 name += common_host_histogram_suffix_; |
240 return name; | 242 return name; |
241 } | 243 } |
242 | 244 |
243 void RenderThreadImpl::HistogramCustomizer::SetCommonHost( | 245 void RenderThreadImpl::HistogramCustomizer::SetCommonHost( |
244 const std::string& host) { | 246 const std::string& host) { |
245 if (host != common_host_) { | 247 if (host != common_host_) { |
246 common_host_ = host; | 248 common_host_ = host; |
247 common_host_histogram_suffix_ = HostToCustomHistogramSuffix(host); | 249 common_host_histogram_suffix_ = HostToCustomHistogramSuffix(host); |
248 v8::V8::SetCreateHistogramFunction(CreateHistogram); | 250 v8::V8::SetCreateHistogramFunction(CreateHistogram); |
| 251 memory_renderer_used_ = NULL; |
249 } | 252 } |
250 } | 253 } |
251 | 254 |
| 255 base::Histogram* RenderThreadImpl::HistogramCustomizer::memory_renderer_used() { |
| 256 if (!memory_renderer_used_) { |
| 257 memory_renderer_used_ = base::Histogram::FactoryGet( |
| 258 ConvertToCustomHistogramName("Memory.RendererUsed"), |
| 259 1000, |
| 260 500000, |
| 261 50, |
| 262 base::Histogram::kUmaTargetedHistogramFlag); |
| 263 } |
| 264 return memory_renderer_used_; |
| 265 } |
| 266 |
252 RenderThreadImpl* RenderThreadImpl::current() { | 267 RenderThreadImpl* RenderThreadImpl::current() { |
253 return lazy_tls.Pointer()->Get(); | 268 return lazy_tls.Pointer()->Get(); |
254 } | 269 } |
255 | 270 |
256 // When we run plugins in process, we actually run them on the render thread, | 271 // When we run plugins in process, we actually run them on the render thread, |
257 // which means that we need to make the render thread pump UI events. | 272 // which means that we need to make the render thread pump UI events. |
258 RenderThreadImpl::RenderThreadImpl() { | 273 RenderThreadImpl::RenderThreadImpl() { |
259 Init(); | 274 Init(); |
260 } | 275 } |
261 | 276 |
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 RenderThreadImpl::GetFileThreadMessageLoopProxy() { | 1152 RenderThreadImpl::GetFileThreadMessageLoopProxy() { |
1138 DCHECK(message_loop() == MessageLoop::current()); | 1153 DCHECK(message_loop() == MessageLoop::current()); |
1139 if (!file_thread_.get()) { | 1154 if (!file_thread_.get()) { |
1140 file_thread_.reset(new base::Thread("Renderer::FILE")); | 1155 file_thread_.reset(new base::Thread("Renderer::FILE")); |
1141 file_thread_->Start(); | 1156 file_thread_->Start(); |
1142 } | 1157 } |
1143 return file_thread_->message_loop_proxy(); | 1158 return file_thread_->message_loop_proxy(); |
1144 } | 1159 } |
1145 | 1160 |
1146 } // namespace content | 1161 } // namespace content |
OLD | NEW |